Skip to content
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

use --preload but workers did not share memory from master process #3178

Open
Jimmy9507 opened this issue Mar 26, 2024 · 1 comment
Open

Comments

@Jimmy9507
Copy link

Jimmy9507 commented Mar 26, 2024

Hi,

To save memory, I try to use --preload so only master process will upload large object in memory, and child processes can share it and don' t have to upload duplicate objects to memory.

Here is the command I use, However, the large object is still uploaded multiple times by child process.

gunicorn -b 127.0.0.1:8090 --worker-class gevent app:app --timeout 300 --keep-alive 60 --workers 5 --preload

However, when I use worker class sync. I see the object only uploaded once in memory.

gunicorn -b 127.0.0.1:8090 --worker-class sync app:app --timeout 300 --keep-alive 60 --workers 5 --preload

But sync can not meet my requirement of high concurrency. Why sync works but gevent does not work?

Does anyone see the same problem before?

Thanks in advance.

I am using Flask + Gunicorn

@Jimmy9507 Jimmy9507 changed the title use --preload but workers did not share memory from parent process use --preload but workers did not share memory from master process Mar 26, 2024
@benoitc
Copy link
Owner

benoitc commented Mar 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants