crowdsecurity / cs-haproxy-spoa-bouncer

EXPERIMENTAL: HAProxy spoe filter for CrowdSec - WAF and IP protection
MIT License
5 stars 1 forks source link

[enhance] Should we create a sweeping session flush #3

Open LaurenceJJones opened 1 month ago

LaurenceJJones commented 1 month ago

https://github.com/crowdsecurity/cs-haproxy-spoa-bouncer/blob/3c6a8aa47cf440f05e8dc0ee3035a9fe454f0126/internal/session/root.go#L159-L201

Creating an issue to explore an idea, should we create a sweeping flush system. Sweeping flush means we have 2 timers one to sweep the map and mark the session to be deleted and another timer that triggers once enough have been GC'ed. Currently as it stands every tick on the GC timer the whole session for Host is locked to sweep and delete, it doesnt hurt the performance too much for lower end traffic sources, however, if you have alot of captchas / current sessions or misbehaving clients the GC can cause problems: