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

Inspecting events queued on loop? #135

Closed
codywilbourn opened this issue Apr 3, 2018 · 2 comments
Closed

Inspecting events queued on loop? #135

codywilbourn opened this issue Apr 3, 2018 · 2 comments

Comments

@codywilbourn
Copy link

  • uvloop version: 0.8.1
  • Python version: 3.6
  • Platform: Linux
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: N/A

We're using uvloop in Tornado, and believe we may have an issue with too many pending tasks. Is it possible to monitor the number of tasks scheduled on uvloop and/or extract timing data for the tasks?

Further details: We discovered during a database slowdown that requests to unrelated parts of our application saw significantly increased latency (p50 approaching p99), which seems to indicate our async tasks were spending more of their time waiting to be scheduled rather than running. We'd like to validate this idea by recording any potential backup of tasks to be performed.

uvloop.Loop has a member _queued_streams which could be the sort of data we're looking for, but since that's in the Cython code we can't access it from Python.

@1st1
Copy link
Member

1st1 commented Apr 3, 2018

You can use asyncio.Task.all_tasks() API to get a number of all asyncio tasks for a particular event loop.

You can also build a debug build of uvloop that exposes a Loop.print_debug_info() method.

I'm also looking into adding deeper introspection/tracing APIs to the next uvloop release. cc/ @pfreixes

@1st1
Copy link
Member

1st1 commented Jun 4, 2018

This issue is superseded with this #163, feel free to join the discussion!

@1st1 1st1 closed this as completed Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants