Skip to content

Commit

Permalink
Notes on what we're doing in trunk_requests_per_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Dec 9, 2019
1 parent caa9956 commit 6ef48cd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/lib/server/trunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,23 @@ static uint32_t trunk_requests_per_connnection(uint16_t *conn_count_out, uint32_
if (trunk->freeing) goto done;

/*
* All states except draining.
* Count all connections except draining and draining to free.
*
* Omitting these connection states artificially raises the
* request to connection ratio, so that we can preemptively spawn
* new connections.
*
* In the case of FR_TRUNK_CONN_DRAINING the trunk management
* code has enough hysteresis to not immediately reactivate the
* connection.
*
* In the case of TRUNK_CONN_DRAINING_TO_FREE the trunk
* management code should spawn a new connection to takes its place.
*
* Connections placed in the DRAINING_TO_FREE sate are being
* closed preemptively to deal with bugs on the server we're
* talking to, or misconfigured firewalls which are trashing
* TCP/UDP connection states.
*/
conn_count = fr_trunk_connection_count_by_state(trunk, FR_TRUNK_CONN_ALL ^
(FR_TRUNK_CONN_DRAINING | FR_TRUNK_CONN_DRAINING_TO_FREE));
Expand Down

0 comments on commit 6ef48cd

Please sign in to comment.