]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
doq: properly configure maxInFlight and max buffered data
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 22 Sep 2023 13:37:26 +0000 (15:37 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 9 Oct 2023 11:37:57 +0000 (13:37 +0200)
pdns/dnsdist-lua.cc
pdns/dnsdistdist/docs/reference/config.rst
pdns/dnsdistdist/doq.cc
pdns/dnsdistdist/doq.hh

index eccb9a936351a77c3832ab963fa7786576b1aa9d..c3aa3c52f9d1ca1dbdcb01e7a4f3bdefd952cd2e 100644 (file)
@@ -2510,7 +2510,9 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
 
     if (vars) {
       parseLocalBindVars(vars, reusePort, tcpFastOpenQueueSize, interface, cpus, tcpListenQueueSize, maxInFlightQueriesPerConn, tcpMaxConcurrentConnections);
-
+      if (maxInFlightQueriesPerConn > 0) {
+        frontend->d_maxInFlight = maxInFlightQueriesPerConn;
+      }
       getOptionalValue<int>(vars, "internalPipeBufferSize", frontend->d_internalPipeBufferSize);
       getOptionalValue<int>(vars, "idleTimeout", frontend->d_idleTimeout);
 
index c0a3287f4187b67d7557a42cacec281065319986..f6ad305783048dfea729f7a4ebedddbca692f8a0 100644 (file)
@@ -190,6 +190,7 @@ Listen Sockets
   * ``cpus={}``: table - Set the CPU affinity for this listener thread, asking the scheduler to run it on a single CPU id, or a set of CPU ids. This parameter is only available if the OS provides the pthread_setaffinity_np() function.
   * ``idleTimeout=5``: int - Set the idle timeout, in seconds.
   * ``internalPipeBufferSize=0``: int - Set the size in bytes of the internal buffer of the pipes used internally to pass queries and responses between threads. Requires support for ``F_SETPIPE_SZ`` which is present in Linux since 2.6.35. The actual size might be rounded up to a multiple of a page size. 0 means that the OS default size is used. The default value is 0, except on Linux where it is 1048576 since 1.6.0.
+  * ``maxInFlight=0``: int - Maximum number of in-flight queries. The default is 0, which disables out-of-order processing.
 
 .. function:: addTLSLocal(address, certFile(s), keyFile(s) [, options])
 
index 160f3e7ae80d1f2dc32869a5814af55be941fb31..e283a754b4bdce36e050d2bf1250ac7034246a06 100644 (file)
@@ -298,10 +298,20 @@ void DOQFrontend::setup()
   quiche_config_set_max_idle_timeout(config.get(), d_idleTimeout * 1000);
   quiche_config_set_max_recv_udp_payload_size(config.get(), MAX_DATAGRAM_SIZE);
   quiche_config_set_max_send_udp_payload_size(config.get(), MAX_DATAGRAM_SIZE);
-  quiche_config_set_initial_max_data(config.get(), 10000000);
-  quiche_config_set_initial_max_stream_data_bidi_local(config.get(), 1000000);
-  quiche_config_set_initial_max_stream_data_bidi_remote(config.get(), 1000000);
-  quiche_config_set_initial_max_streams_bidi(config.get(), 100);
+
+  // The number of concurrent remotely-initiated bidirectional streams to be open at any given time
+  // https://docs.rs/quiche/latest/quiche/struct.Config.html#method.set_initial_max_streams_bidi
+  // 0 means none will get accepted, that's why we have a default value of 65535
+  quiche_config_set_initial_max_streams_bidi(config.get(), d_maxInFlight);
+
+  // The number of bytes of incoming stream data to be buffered for each localy or remotely-initiated bidirectional stream
+  quiche_config_set_initial_max_stream_data_bidi_local(config.get(), 8192);
+  quiche_config_set_initial_max_stream_data_bidi_remote(config.get(), 8192);
+
+  // The number of total bytes of incoming stream data to be buffered for the whole connection
+  // https://docs.rs/quiche/latest/quiche/struct.Config.html#method.set_initial_max_data
+  quiche_config_set_initial_max_data(config.get(), 8192 * d_maxInFlight);
+
   quiche_config_set_cc_algorithm(config.get(), QUICHE_CC_RENO);
 
   {
index 9cd69fe928dbbace421da8a0e5b64fa1d21f37ef..624af04d87f7b827d34a66872082dff51bd7fcb5 100644 (file)
@@ -53,6 +53,7 @@ struct DOQFrontend
   uint32_t d_internalPipeBufferSize{0};
 #endif
   uint64_t d_idleTimeout{5};
+  uint64_t d_maxInFlight{65535};
 };
 
 struct DOQUnit