-
-
Notifications
You must be signed in to change notification settings - Fork 88
Using supervisor to monitor forks #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for trying this out and reporting all the details of your use case. I'll review it in more detail tomorrow. |
Any updates on this? |
I would love to allocate some time to investigating this. |
We recently introduced https://socketry.github.io/falcon/releases/index#introduce-async::container::supervisor. which includes support for a memory leak monitor. It sounds like you have a memory / resource leak. Can you try the updated supervisor with the memory leak detector to see if it helps capture the issues? When a memory leak is detected, you can dump the heap to debug: https://github.com/socketry/falcon/blob/main/examples/supervisor/falcon.rb#L11-L25. Then, you can analyse this, there are a number of tools, e.g.: https://github.com/Shopify/heap-profiler |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I'm migrating puma->falcon for a quiet loaded app 200-500 req/s, average response time is below 30ms, once on falcon the memory usage started growing over time quiet fast, first suggestion was that's memory allocation/fragmentation and switching to
MALLOC_ARENA_MAX=2
and later to jemalloc did help improve situation but didn't resolve the issue completely.The next idea was if we have a supervisor and it can report stats on siblings processes maybe it's possible extend it's functionality to restart forks if they start to bloat or at least report the memory leak.
My initial idea was that I can use something like:
But probably it's not intended to be used like that, but maybe this is good idea if we could have multiple reactors inside supervisor including custom ones?
Next I tried code below which runs after fork, in my case it's
config.ru
:This works however after around ~250 restarts it ended up with:
I was expecting that fork should release all it's open files when restarting. One thing I noticed that if I send
INT
once to each forked process the memory usage seams to be stable and not growing over time. I'm still figuring out what is the issue of that memory bloating.I know it's a lot for a story and probably not really an issue of the falcon but I think my use case I can really push falcon to it's edges in a good way but need to figure out how to do it properly.
To outline above I'm looking for two things here:
The text was updated successfully, but these errors were encountered: