fail2ban
fail2ban copied to clipboard
Pages load slowly when plugin enabled
Hi, we have tried running this plugin (v0.6.6) in production to test out the fix of #52 but all the pages have started to load very slowly (before 200ms, 5-10s after enabling the plugin)
I suspect #51 to be the problem, where it always locks and waits until a requests is finished (maybe?)
Hello @aqos156,
Thanks for your interest in this Traefik plugin !
Oh! yeah, you might be right. The mutex is closed when the function end using a defer
.
https://github.com/tomMoulard/fail2ban/blob/5b110872e0c520f95158377ab8bc190630e62360/fail2ban.go#L245
This implies that the mutext is unlocked after the HTTP request has been served.
https://github.com/tomMoulard/fail2ban/blob/5b110872e0c520f95158377ab8bc190630e62360/fail2ban.go#L297
A good fix might be to remove the defer
and unlock the mutex after ipViewed
has been used.
@tomMoulard would this issue make the plugin unusable? I that is the case, I would love seeing it fixed -- it's a shame that GoLang is not my strong suite :cry:
No, this plugin is usable as is, but it might not be as fast as it can be. Using the plugin might throttle a bit down the overall HTTP performance of the request handling of Traefik.
As this issue is being too broad, following my comment https://github.com/tomMoulard/fail2ban/issues/59#issuecomment-1031181693, the pr #77 closes this issue.