-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Support listening on UNIX domain sockets #97
Comments
@gi0baro, hi! You will need to re-implement the handler depending on the passed parameter This will be a critical change. Are you considering unix socket and file descriptor support as a listen server? |
@ArtemIsmagilov not necessarily. We can adapt
That's not the point to enable support though; the whole Granian code nowadays expects a
To be honest, I see this as a very low priority atm. |
UDS are quite popular with uwsgi users: https://github.com/search?q=socket%3D%2F+uwsgi&type=code I believe most uwsgi users looking for an alternative would look for something with comparable performance or comparable feature parity, or both. You have the performance but not the feature parity. This feature is as niche as gluing up a bunch of docker containers on the same host is - so is it really? One could even argue that granian is a niche performance server with just one way to run it, given how enormous uwsgi's feature set is... At least give it some thought and outline how this could be implemented, or how much funding would change the priority on this. |
Granian never stated or aimed to be a feature complete alternative to uWSGI. It's definitely not the purpose of the project: as a matter of fact Granian started supporting RSGI and ASGI and added WSGI only later. It's also confusing to me to compare the features between the two projects: the world in 2024 is a very different place compared to when uWSGI project started (and thus designed its architecture).
I don't get why you would need UDS for that, especially with containers: I expect developers to rely on orchestration utilities (like a trivial compose file) and thus rely on services – and thus TCP.
I think my last comment was pretty clear. And in regards of funding, I don't generally change my schedule based on that; to me funding issues is more of a metric on how much business related entities are interested into a specific feature. But my general feeling about this is still the same: it's more about wether it makes sense for a feature to land on Granian based on how it should be used, rather than how it compares to other projects/environments/setups. |
Filesystem is just better for access control if you're connecting two things in the same machine. It's not that I need it, it's the fact that it is better than playing it loose with those ports. Maybe it's just me, but to me this seems an essential feature in a setup where you'd have a nginx/whatever frontend. It simplifies a lot some things: you can shove 2 containers (1 for granian, 1 for nginx) in a kubernetes pod without having to worry about service and ports configuration - in kubernetes it's quite a bit more verbose than compose config). For you this seems like nothing, just a drop in the ocean of changes if one would want to switch from uwsgi to granian but it's not like that, maybe it's just the last drop that would prevent someone from switching. Anyway, I'd make a PR but Rust is a bit over my hear, for now 🤪 |
Debatable 🤷♂️
Again, I don't get why you want to bundle together nginx and Granian. Just because that's the way you operate uwsgi, it doesn't mean it should be the way to operate Granian. It doesn't need another proxy on top of it. |
Nginx serves static files and has more configurable tls. It's just better at being a frontend. |
Now that can be (IMO) a more interesting feature request for Granian.
🤔 like? can you expand on this?
Better than what? Better at what?
So again, I don't see any particular reason to prioritise this atm. |
Basically all these options in here: https://ssl-config.mozilla.org/#server=nginx&version=1.26.0&config=intermediate&openssl=1.1.1w&guideline=5.7 To name a few I don't see an equivalent: ssl_stapling, ssl_ciphers, ssl_prefer_server_ciphers, ssl_protocols, ssl_dhparam, ssl_session_cache, ssl_session_timeout. And there's the other less mainstream options: http://nginx.org/en/docs/http/ngx_http_ssl_module.html I consider mozilla's ssl guide to have the "mainstream options".
Pretty sure you ain't testing a static file over there - that would be more of a apples-to-apples comparison. I suspect I struck a nerve to make you run benchmarks for the sake of an argument, sorry. I don't want to annoy you but we can't both be right :-)I joke, if you laugh you have to implement this 😂Nginx is a better frontend webserver because it can handle statics with lots of options, tls with lots of options, auth with lots of options, proxy with lots of options and protocols and so on, none of which granian can do natively. You could maybe do statics/auth/proxy with a python wsgi app but it will be slow, or with rsgi but it will be complicated enough to not be worth it compared to nginx's "batteries included". And I haven't even mentioned letsencrypt certificates, another quagmire of complexity. It's the same deal with uwsgi ... it can do statics, it can do tls, it can do proxy but it's really crummy for that and you hit lots of rough edges. It's really hard to be a good frontend. I think it's easier to be a good backend. You'll say "but why this frontend-backend" dichotomy but then I'll say I have more than one service, and more than one kind that I want to be exposed on a single frontend. |
Fair enough, I encourage you to open an issue to request the ones you judge relevant to have in Granian.
App code here https://github.com/emmett-framework/granian/blob/master/benchmarks/app/wsgi.py, function
It's not about being right – especially given we're arguing on opinions on how to deploy a Python WSGI application – I'm just giving you all the reasons why I won't work on this anytime soon ;)
Again, I encourage you to open relevant issues for all those features if you think might be interesting to have those in Granian (regardless of UDS).
That's not the argument. Here's my overall recap:
So again, I confirm my previous statement: I don't see any reason to prioritise this. And I don't think it makes any sense to keep the discussion proceed any further unless it's about specific UDS use cases that are not achievable with TCP. |
I have and granian has appalling performance in a proxy setup - actual apples to apples results (both using proxy setup and wsgi):
I suspect you have compared nginx+uwsgi (a badly configured uwsgi at that) against a naked granian (no proxy) with the most efficient protocols available (http2/rsgi). This is my nginx config: https://github.com/ionelmc/testbench/blob/main/docker/python/nginx.site#L42-L56 and granian config: About the other things:
I cannot use a dumb tcp proxy cause I need a http protocol to have adequate logging, buffering and other good stuff. Can you look at the performance issue? Why is granian so slow in my proxy setup? |
You have to put more attention in what I write, as I pointed you to a WSGI app. And
I'm starting feeling severe difficulties in trying to understand what you're trying to achieve here. |
Adding a comment to this issue as it's fairly similar, it would be nice to have socket activation support - so listening on a file descriptor passed from the process manager (eg. systemd). For flexibility, it would be fantastic to see:
|
It would be nice if granian could also listen on UNIX domain sockets (UDS), leveraging filesystem permissions to controll access. Both nginx and apache2 (and possible more webservers) support proxying to UDS.
Funding
The text was updated successfully, but these errors were encountered: