2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

DoH: Flush HTTP write buffer on an outgoing DNS message

Previously, the code would try to avoid sending any data regardless of
what it is unless:

a) The flush limit is reached;
b) There are no sends in flight.

This strategy is used to avoid too numerous send requests with little
amount of data. However, it has been proven to be too aggressive and,
in fact, harms performance in some cases (e.g., on longer (≥1h) runs
of "stress:long:rpz:doh+udp:linux:*").

Now, additionally to the listed cases, we also:

c) Flush the buffer and perform a send operation when there is an
outgoing DNS message passed to the code (which is indicated by the
presence of a send callback).

That helps improve performance for "stress:long:rpz:doh+udp:linux:*"
tests.
This commit is contained in:
Artem Boldariev 2025-02-25 09:52:19 +02:00
parent 0e1b02868a
commit c5f7968856

View File

@ -1467,26 +1467,27 @@ http_send_outgoing(isc_nm_http_session_t *session, isc_nmhandle_t *httphandle,
* to avoid hitting unnecessary limitations on a TLS record size * to avoid hitting unnecessary limitations on a TLS record size
* within some tools (e.g. flamethrower). * within some tools (e.g. flamethrower).
*/ */
if (max_total_write_size >= FLUSH_HTTP_WRITE_BUFFER_AFTER) { if (cb != NULL) {
/* /*
* Case 1: We have at least FLUSH_HTTP_WRITE_BUFFER_AFTER * Case 0: The callback is specified, that means that a DNS
* bytes to send. Let's flush it. * message is ready. Let's flush the the buffer.
*/
total = max_total_write_size;
} else if (max_total_write_size >= FLUSH_HTTP_WRITE_BUFFER_AFTER) {
/*
* Case 1: We have equal or more than
* FLUSH_HTTP_WRITE_BUFFER_AFTER bytes to send. Let's flush it.
*/ */
total = max_total_write_size; total = max_total_write_size;
} else if (session->sending > 0 && total > 0) { } else if (session->sending > 0 && total > 0) {
/* /*
* Case 2: There is one or more write requests in flight and * Case 2: There is one or more write requests in flight and
* we have some new data form nghttp2 to send. Let's put the * we have some new data form nghttp2 to send.
* write callback (if any) into the pending write callbacks * Then let's return from the function: as soon as the
* list. Then let's return from the function: as soon as the
* "in-flight" write callback get's called or we have reached * "in-flight" write callback get's called or we have reached
* FLUSH_HTTP_WRITE_BUFFER_AFTER bytes in the write buffer, we * FLUSH_HTTP_WRITE_BUFFER_AFTER bytes in the write buffer, we
* will flush the buffer. * will flush the buffer. */
*/ INSIST(cb == NULL);
if (cb != NULL) {
http_append_pending_send_request(session, httphandle,
cb, cbarg);
}
goto nothing_to_send; goto nothing_to_send;
} else if (session->sending == 0 && total == 0 && } else if (session->sending == 0 && total == 0 &&
session->pending_write_data != NULL) session->pending_write_data != NULL)