mtrudel / bandit

Bandit is a pure Elixir HTTP server for Plug & WebSock applications
MIT License
1.7k stars 86 forks source link

High CPU usage #345

Closed MrYawe closed 1 month ago

MrYawe commented 7 months ago

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 https://github.com/mtrudel/bandit/issues/339:

image

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

mtrudel commented 7 months ago

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!

mtrudel commented 6 months ago

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.

mtrudel commented 1 month ago

Closing due to inactivity