]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Shrink InternalQueryState's size by reordering its fields 13920/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 15 Mar 2024 10:31:11 +0000 (11:31 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 15 Mar 2024 10:32:40 +0000 (11:32 +0100)
This saves 524 kB per downstream server in the default configuration
(8 bytes times 65536 slots).

pdns/dnsdistdist/dnsdist-idstate.hh

index f83f9b71f5200e16a7c785c0c1c4b84c2d5a7d0f..d22d274ead892cbbc40745375d0f034682ad0c41 100644 (file)
@@ -130,17 +130,17 @@ struct InternalQueryState
   }
 
   boost::optional<Netmask> subnet{boost::none}; // 40
+  std::string poolName; // 32
   ComboAddress origRemote; // 28
   ComboAddress origDest; // 28
   ComboAddress hopRemote;
   ComboAddress hopLocal;
   DNSName qname; // 24
-  std::string poolName; // 24
-  StopWatch queryRealTime{true}; // 24
-  std::shared_ptr<DNSDistPacketCache> packetCache{nullptr}; // 16
 #ifdef HAVE_XSK
-  PacketBuffer xskPacketHeader; // 8
+  PacketBuffer xskPacketHeader; // 24
 #endif /* HAVE_XSK */
+  StopWatch queryRealTime{true}; // 24
+  std::shared_ptr<DNSDistPacketCache> packetCache{nullptr}; // 16
   std::unique_ptr<DNSCryptQuery> dnsCryptQuery{nullptr}; // 8
   std::unique_ptr<QTag> qTag{nullptr}; // 8
   std::unique_ptr<PacketBuffer> d_packet{nullptr}; // Initial packet, so we can restart the query from the response path if needed // 8
@@ -150,9 +150,9 @@ struct InternalQueryState
   ClientState* cs{nullptr}; // 8
   std::unique_ptr<DOHUnitInterface> du; // 8
   size_t d_proxyProtocolPayloadSize{0}; // 8
-  int32_t d_streamID{-1}; // 4
   std::unique_ptr<DOQUnit> doqu{nullptr}; // 8
   std::unique_ptr<DOH3Unit> doh3u{nullptr}; // 8
+  int32_t d_streamID{-1}; // 4
   uint32_t cacheKey{0}; // 4
   uint32_t cacheKeyNoECS{0}; // 4
   // DoH-only */