mtrudel/bandit

High CPU usage

MrYawe opened this issue · 2 comments

First, thanks for all the amazing work on Bandit :)

In our production we had CPU load increase over time and we fixed it the 22/04 by switching back to Cowboy.
We were using bandit 1.4.2 and thousand_island 1.3.5.

image image

Last weekend (20/04-21/04), I took some screenshots about our live running processes.

We can see that processes with highest reductions count (CPU usage) are all LiveView processes:
image

Bandit.DelegatingHandler.init/1 was often in the top most memory-hungry processes. Maybe there is a link with #339:

image

PS: these two LiveDashboard screenshots were not taken at the same time

I have a hunch that this may be due to older connections not shutting down when the client disconnects (which traces back to the same issues as #344). It's actually next up on my list of things to look at!

Update: It's not the same issue as #344, but I've got a repro case for this locally (it looks like it may be related to what's left of #339). Not entirely sure what's causing it yet, but I can reproduce a significant reduction / memory difference between Cowboy and Bandit on the exact same workload, so it's just a matter of digging until I can explain / mitigate it.