-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Gunicorn worker #545
Gunicorn worker #545
Conversation
Performance (MacBook Pro (Retina, 15-inch, Mid 2015)):
|
The |
That's impressive that they're going the same speed. We saw a more significant slowdown when we implemented this. What benchmarks do you see with a single worker? |
|
if ssl is not None: | ||
proto = "https" | ||
log.info('Goin\' Fast @ {}://{}:{}'.format(proto, host, port)) | ||
if host and port: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always be true because they have default values "127.0.0.1"
and 8000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In GunicornWorker
they are set to None
while passing sock
.
https://github.com/channelcat/sanic/pull/545/files#diff-e2075948e4c12131e25525ec8154ebcfR72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop.create_server
sock can optionally be specified in order to use a preexisting socket object. If specified, host and port should be omitted (must be None).
Mostly working now, websocket works but seems not closing on signal int while client still connected. |
Actually, it won't shutdown in Ping #469 |
@messense yes, sanic simply waits for all connections to end, assuming they are short lived, but websocket will go on until the client goes away. I'll think about how the websocket tasks can be signaled to exit. |
I have extracted these changes into a package named sanic-gunicorn, feel free to try it. If you guys don't want |
That sounds good. I'm fine with this change but I'm going to leave it up to @seemethere or @channelcat to make the ultimate decision. |
@r0fls Either way, in order to support Gunicorn, Sanic app instance need to be a callable: class Sanic:
def __call__(self):
return self Edit: Add a dirty patch: messense/sanic-gunicorn@e60a683 |
Documentation to go along with this would be amazing |
Addition of a gunicorn worker
Addition of a gunicorn worker
This is really just a WIP, it's working on thesimple_server
andtry_everything
example.Ping #61 #107 #501