You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e114ca7
Browse filesBrowse the repository at this point in the historyBrowse files
feature: added the pool_size argument to the balancer keepalive FFI API.
The balancer keepalive cache has a single capacity per upstream {} block,
set by balancer_keepalive (32 by default), and evicts the least recently
used idle connection regardless of which pool it belongs to. When many
pools share one upstream, as is typical when peers are picked dynamically
in balancer_by_lua*, a burst to one peer can push out the idle connections
of every other peer.
ngx_http_lua_ffi_balancer_enable_keepalive() now takes a pool_size
argument. A pool is the same key the cache already matches on for reuse:
the peer address, the host given to set_current_peer() and the local
address. When a connection is about to be cached and its pool already
holds pool_size idle connections, the least recently used idle connection
of that same pool is closed and its slot reused, instead of taking a slot
from the global LRU. Items are inserted at the head of their hash bucket,
so walking a bucket from its tail meets the oldest connection of the pool
first.
pool_size 0 keeps the previous behaviour. pool_size never raises the
balancer_keepalive total, it only bounds one pool inside it.
The key comparison used by the reuse path is factored out into
ngx_http_lua_balancer_item_match() so that counting and reuse can never
disagree on what a pool is.
This changes the FFI signature, lua-resty-core needs to be updated
accordingly.
0 commit comments