Comments (5)
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).
from uvloop.
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?
from uvloop.
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).
from uvloop.
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!
from uvloop.
Thanks!
Closing this issue.
from uvloop.
Related Issues (20)
- Update performance plot
- Python 3.12 Support for uvloop HOT 22
- uvloop installs generated loop.c file
- Can we update cython and make uvloop compatible with python 3.12 please? HOT 1
- test_cython_coro_is_coroutine: python: Objects/codeobject.c:771: PyCode_Addr2Line: Assertion `addrq >= 0 && addrq < _PyCode_NBYTES(co)' failed. HOT 1
- `__init__.pyi` added on #570 breaks mypy HOT 6
- [ALTLinux] [ppc64le] [0.18.0] `AssertionError: Didn't reach a full buffer` HOT 2
- [0.18.0] Running black causes core dump: src/unix/core.c:633: uv__close: Assertion `fd > 2' failed. HOT 5
- Idea: changing libuv not to install a signal handler
- Incorrect typing for set_task_factory HOT 1
- Please upgrade cython (3.0.x) HOT 8
- Possible to add `_start_tls_compatible` attribute to `TCPTransport`?
- Current version of libuv HOT 1
- Embedded Python interpreter in a C++ application making use of libuv
- UDPTransport returning when data is empty
- pipes from subprocess_exec do not have extra info 'pipe' (incompatible with vanilla asyncio) HOT 1
- libuv 1.48.0: getaddrinfo('', 0): OSError: [Errno 22] Invalid argument HOT 5
- Type annotations
- Server.serve_forever() isn't cancelled when Server.close() is called
- uvloop fails to build with Python 3.13.0a5: error: implicit declaration of function ‘_Py_RestoreSignals’ HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uvloop.