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:
Whole sessions map is locked, and cannot create new ones or read whilst GC'ing
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: