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

Maximum number of open files #385

Open
mindflayer opened this issue Aug 22, 2024 · 4 comments
Open

Maximum number of open files #385

mindflayer opened this issue Aug 22, 2024 · 4 comments

Comments

@mindflayer
Copy link

It'd be great if we had a way to set the max number of file descriptors.
See for instance the uWSGI setting for it: https://uwsgi-docs.readthedocs.io/en/latest/Options.html#max-fd

@gi0baro
Copy link
Member

gi0baro commented Aug 22, 2024

It'd be great if we had a way to set the max number of file descriptors.

I'm not sure complicating Granian code to manage system related stuff is a good idea.
What prevents you from using the relevant system configuration utilities for this (like sysctl and ulimit, or some supervisors)?

@mindflayer
Copy link
Author

mindflayer commented Aug 22, 2024

Of course it's something I could fix in a different way.
I've just changed the command with the prefix prlimit -n=8192 to set it at the process level.

It's worth mentioning I thought it was a simple change, and I believe it's a nice setting to have.
Why did I think it was simple? Because in Python there is a simple way to play with resources: https://docs.python.org/3/library/resource.html.

The main reason for it would be not depending on external packages/commands. In the end ulimit values are usually specific to the application I am running, and I love to keep all the settings for an application in the same place.

@mindflayer
Copy link
Author

mindflayer commented Aug 22, 2024

This said, feel free to close the issue if it's outside the scope of granian, and kudos for what you achieved.

@gi0baro
Copy link
Member

gi0baro commented Aug 22, 2024

It's worth mentioning I thought it was a simple change, and I believe it's a nice setting to have. Why did I think it was simple? Because in Python there is a simple way to play with resources: https://docs.python.org/3/library/resource.html.

AFAIK, resource is available in Unix only, whereas Granian also supports Windows. Also I'm not sure about the implications of those limits with child processes, given that's the actual Granian implementation for workers.

That being said, I'm not completely against some limits features in Granian, as soon as the implementation is clearly documented (an option might be to describe those parameters are Unix-available only and warn the users in other cases).
In the end: right now I don't have time to invest on this given the current priorities, but I'm willing to review PRs in this direction.

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