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

taking uvloop into production? #15

Closed
digitaldavenyc opened this issue May 6, 2016 · 5 comments
Closed

taking uvloop into production? #15

digitaldavenyc opened this issue May 6, 2016 · 5 comments
Labels

Comments

@digitaldavenyc
Copy link

This is not an issue but perhaps a request to maybe expand on documentation on how to use uvloop with other frameworks. The performance on it is very impressive, however, it's so low level, taking this into a production application would be quite a challenge.

What would be the best practice approach to doing this? Combine with tornado or any other async libary? Leverage other smaller libraries to handle things like user authentication and http parsing. Or does uvloop just need these features introduced directly into it to maintain the performance it currently has?

If I am using the wrong forum for asking this question I apologize and happy to move this discussion somewhere else.

@1st1
Copy link
Member

1st1 commented May 6, 2016

What would be the best practice approach to doing this? Combine with tornado or any other async libary?

uvloop only works with asyncio. It cannot work with Tornado, gevent, curio, or any other async Python library other than asyncio.

Leverage other smaller libraries to handle things like user authentication and http parsing. Or does uvloop just need these features introduced directly into it to maintain the performance it currently has?

asyncio is an async library that implements many low-level and high-level abstractions. It has Protocols and Transports, helpers to create network servers and clients, etc. I highly recommend you to glance over the documentation.

asyncio is built around the event loop. That's the thing that runs asyncio. uvloop is an implementation of a fast event loop for asyncio.

Now, asyncio, by itself, doesn't provide any high-level tools for you to write applications. For instance, it lacks an HTTP protocol implementation, etc. You need other libraries built for asyncio to do that for you. For HTTP, right now, there is aiohttp. There are many other libraries for working with databases, using AMQP brokers, etc.

The performance on it is very impressive, however, it's so low level, taking this into a production application would be quite a challenge.

Once you have an asyncio application, speeding it up with uvloop is very easy -- just install the uvloop policy (see the README file).

@1st1 1st1 added the question label May 6, 2016
@digitaldavenyc
Copy link
Author

digitaldavenyc commented May 6, 2016

I highly recommend you to glance over the documentation.

Do you mean I should review uvloop's documention or asyncio's?

You need other libraries built for asyncio to do that for you. For HTTP, right now, there is aiohttp.

In your blog post you mentioned that the performance in aiohttp was pretty bad with uvloop due to aiohttp's HTTP parser. Wouldn't httptools be the prefered library for handing HTTP requests in order to maintain the performance measured in the benchmarks?

@1st1
Copy link
Member

1st1 commented May 6, 2016

Do you mean I should review uvloop's documention or asyncio's?

asyncio documentation to get a better idea of what it's capable of.

In your blog post you mentioned that the performance in aiohttp was pretty bad with uvloop due to aiohttp's HTTP parser. Wouldn't httptools be the prefered library for handing HTTP requests?

Right. The httptools package at this moment doesn't provide an implementation of HTTP, it only has a high-performance parser. So right now, aiohttp is the only option, but I hope its newly discovered performance issues will be fixed soon (by incorporating httptools or somehow else).

@digitaldavenyc
Copy link
Author

digitaldavenyc commented May 6, 2016

There was already an issue open over at aiohttp for swapping out the http parser for httptools. If the performance issues could be solved in the near future both libraries could be thrown into the spotlight. Being able to stay on the same performance level with Go is huge. Thank you so much for contributing this library to the community!

@1st1
Copy link
Member

1st1 commented May 6, 2016

Thanks!
Closing this issue.

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

No branches or pull requests

2 participants