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

Use uvloop instead of asyncio #276

Open
johanhenriksson opened this issue Feb 28, 2021 · 1 comment
Open

Use uvloop instead of asyncio #276

johanhenriksson opened this issue Feb 28, 2021 · 1 comment
Assignees
Labels
discussion Looking for opinions enhancement Improve existing features

Comments

@johanhenriksson
Copy link
Collaborator

Investigate potential benefits of replacing the default asyncio event loop with uvloop

@johanhenriksson johanhenriksson added the enhancement Improve existing features label Feb 28, 2021
@OskarHandmark OskarHandmark added the discussion Looking for opinions label Apr 24, 2021
@OskarHandmark
Copy link
Contributor

For creating tasks within Cowait this probably isn't noticeable compared to the overhead of actually creating the containers. Since we use asyncio for pretty much everything (websocket communication between tasks, async RPC calls and whatever user defined async operations are executed within tasks (ie scraping or other high IO operations), I think this is a good idea.

  • uvloop only works with asyncio. It cannot work with Tornado, gevent, curio or similar.
  • uvloop requires Python 3.7.
  • If we decide to use uvloop, we could still have python 3.6 support by simply not installing uvloop. If you're using Python 3.7 or greater, we can add the library and "install" the event loop using uvloop.install() or asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()).

A good performance test (that applies to Cowait) is just to benchmark a few tasks that spams lots of logs.

@OskarHandmark OskarHandmark self-assigned this Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Looking for opinions enhancement Improve existing features
Projects
None yet
Development

No branches or pull requests

2 participants