From 1731b908b4e77b5294aad64a2c2aec750e4a03be Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 15 Mar 2024 11:31:11 +0100 Subject: [PATCH] dnsdist: Shrink InternalQueryState's size by reordering its fields This saves 524 kB per downstream server in the default configuration (8 bytes times 65536 slots). --- pdns/dnsdistdist/dnsdist-idstate.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pdns/dnsdistdist/dnsdist-idstate.hh b/pdns/dnsdistdist/dnsdist-idstate.hh index f83f9b71f5..d22d274ead 100644 --- a/pdns/dnsdistdist/dnsdist-idstate.hh +++ b/pdns/dnsdistdist/dnsdist-idstate.hh @@ -130,17 +130,17 @@ struct InternalQueryState } boost::optional 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 packetCache{nullptr}; // 16 #ifdef HAVE_XSK - PacketBuffer xskPacketHeader; // 8 + PacketBuffer xskPacketHeader; // 24 #endif /* HAVE_XSK */ + StopWatch queryRealTime{true}; // 24 + std::shared_ptr packetCache{nullptr}; // 16 std::unique_ptr dnsCryptQuery{nullptr}; // 8 std::unique_ptr qTag{nullptr}; // 8 std::unique_ptr 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 du; // 8 size_t d_proxyProtocolPayloadSize{0}; // 8 - int32_t d_streamID{-1}; // 4 std::unique_ptr doqu{nullptr}; // 8 std::unique_ptr doh3u{nullptr}; // 8 + int32_t d_streamID{-1}; // 4 uint32_t cacheKey{0}; // 4 uint32_t cacheKeyNoECS{0}; // 4 // DoH-only */ -- 2.47.2