mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-18 01:58:27 -05:00
- Implement progressive backoff of TCP idle/keepalive timeout.
git-svn-id: file:///svn/unbound/trunk@4806 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
a92b00ef3c
commit
e3f08cb2a2
2 changed files with 19 additions and 5 deletions
|
|
@ -392,10 +392,14 @@ negotiation between Unbound and other servers.
|
|||
.B tcp-idle-timeout: \fI<msec>\fR
|
||||
The period Unbound will wait for a query on a TCP connection.
|
||||
If this timeout expires Unbound closes the connection.
|
||||
This option defaults to 30000 milliseconds. A mimum timeout of
|
||||
200 milliseconds is observed regardless of the configured timeout.
|
||||
This option defaults to 30000 milliseconds.
|
||||
When the number of free incoming TCP buffers falls below 50% of the
|
||||
total number configured, the timeout is reduced to the minimum.
|
||||
total number configured, the option value used is progressively
|
||||
reduced, first to 1% of the configured value, then to 0.2% of the
|
||||
configured value if the number of free buffers falls below 35% of the
|
||||
total number configured, and finally to 0 if the number of free buffers
|
||||
falls below 20% of the total number configured. A minimum timeout of
|
||||
200 milliseconds is observed regardless of the option value used.
|
||||
.TP
|
||||
.B edns-tcp-keepalive: \fI<yes or no>\fR
|
||||
Enable or disable EDNS TCP Keepalive. Default is no.
|
||||
|
|
@ -408,7 +412,11 @@ Unbound sends the timeout value to the client to encourage it to
|
|||
close the connection before the server times out.
|
||||
This option defaults to 120000 milliseconds.
|
||||
When the number of free incoming TCP buffers falls below 50% of
|
||||
the total number configured, the advertised timeout is reduced to 0.
|
||||
the total number configured, the advertised timeout is progressively
|
||||
reduced to 1% of the configured value, then to 0.2% of the configured
|
||||
value if the number of free buffers falls below 35% of the total number
|
||||
configured, and finally to 0 if the number of free buffers falls below
|
||||
20% of the total number configured.
|
||||
A minimum actual timeout of 200 milliseconds is observed regardless of the
|
||||
advertised timeout.
|
||||
.TP
|
||||
|
|
|
|||
|
|
@ -730,6 +730,7 @@ comm_point_udp_callback(int fd, short event, void* arg)
|
|||
static void
|
||||
setup_tcp_handler(struct comm_point* c, int fd, int cur, int max)
|
||||
{
|
||||
int handler_usage;
|
||||
log_assert(c->type == comm_tcp);
|
||||
log_assert(c->fd == -1);
|
||||
sldns_buffer_clear(c->buffer);
|
||||
|
|
@ -742,7 +743,12 @@ setup_tcp_handler(struct comm_point* c, int fd, int cur, int max)
|
|||
/* if more than half the tcp handlers are in use, use a shorter
|
||||
* timeout for this TCP connection, we need to make space for
|
||||
* other connections to be able to get attention */
|
||||
if(cur > max/2)
|
||||
handler_usage = (cur * 100) / max;
|
||||
if(handler_usage > 50 && handler_usage <= 65)
|
||||
c->tcp_timeout_msec /= 100;
|
||||
else if (handler_usage > 65 && handler_usage <= 80)
|
||||
c->tcp_timeout_msec /= 500;
|
||||
else if (handler_usage > 80)
|
||||
c->tcp_timeout_msec = 0;
|
||||
comm_point_start_listening(c, fd,
|
||||
c->tcp_timeout_msec < TCP_QUERY_TIMEOUT_MINIMUM
|
||||
|
|
|
|||
Loading…
Reference in a new issue