]> git.ipfire.org Git - thirdparty/bind9.git/commit
ns_client: reuse TCP send buffers
authorAram Sargsyan <aram@isc.org>
Tue, 12 Mar 2024 15:29:51 +0000 (15:29 +0000)
committerNicki Křížek <nicki@isc.org>
Mon, 10 Jun 2024 16:43:45 +0000 (18:43 +0200)
commit4e70342142f42f6c46d1baf3232f2881ced7a3a2
treec20f2ed064e2d23317889919671da8a4fc1b8b88
parentc6f13f12cd862ffae071e56ee7e1fa9998fc23c3
ns_client: reuse TCP send buffers

Constantly allocating, reallocating and deallocating 64K TCP send
buffers by 'ns_client' instances takes too much CPU time.

There is an existing mechanism to reuse the ns_clent_t structure
associated with the handle using 'isc_nmhandle_getdata/_setdata'
(see ns_client_request()), but it doesn't work with TCP, because
every time ns_client_request() is called it gets a new handle even
for the same TCP connection, see the comments in
streamdns_on_complete_dnsmessage().

To solve the problem, we introduce an array of available (unused)
TCP buffers stored in ns_clientmgr_t structure so that a 'client'
working via TCP can have a chance to reuse one (if there is one)
instead of allocating a new one every time.
lib/ns/client.c
lib/ns/include/ns/client.h