mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-11 12:41:00 +01:00
MEDIUM: stick-tables: Stop as soon as stktable_trash_oldest succeeds.
stktable_trash_oldest() goes through all the shards, trying to free a number of entries. Going through each shard is expensive, as we have to take the shard lock, so stop as soon as we free'd at least one entry, as it is only called when we want to make room for one entry.
This commit is contained in:
parent
7854331c71
commit
cd92aeb366
@ -414,6 +414,14 @@ int stktable_trash_oldest(struct stktable *t)
|
||||
|
||||
HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &t->shards[shard].sh_lock);
|
||||
|
||||
/*
|
||||
* There is not much point in trying to purge more entries,
|
||||
* it will be as costly to acquire the lock for the next shard,
|
||||
* as it would be for the next session creation, so if we
|
||||
* managed to purge at least one entry, give up now.
|
||||
*/
|
||||
if (batched > 0)
|
||||
break;
|
||||
shard++;
|
||||
if (shard >= CONFIG_HAP_TBL_BUCKETS)
|
||||
shard = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user