Monitoring tornado's IOLoop.

153 views
Skip to first unread message

SECOB271_Ganesh Pawar

unread,
Feb 4, 2021, 9:06:20 AM2/4/21
to Tornado Web Server
Is it possible to monitor how busy a tornado IOLoop has been? Like if the IOLoop has been blocked for some time, it should report.

Earlier I did this using set_blocking_log_threshold in tornado version 4. But now tornado has removed this functionality.

So, is there an effective way to monitor the IOLoop busyness-level in the latest tornado version? Perhaps by turning on some debugging settings?

Without using asyncio?


SECOB271_Ganesh Pawar

unread,
Feb 4, 2021, 9:10:41 AM2/4/21
to Tornado Web Server
I see that nowadays, tornado just uses ayncio's event loop. Asyncio's BaseEventLoop has an attribute slow_callback_duration which reports if the execution of a callback or a step of a task exceed this duration in seconds. Is there any way to do this in tornado natively?

SECOB271_Ganesh Pawar

unread,
Feb 5, 2021, 8:17:09 AM2/5/21
to python-...@googlegroups.com
Can someone please help me with this? I need this for an external project I'm working on. It has been stuck on tornado version 4 for the past year. I really want to upgrade it to the latest version. And I can't use asyncio directly, so I need to do this in tornado. Please help.

--
You received this message because you are subscribed to a topic in the Google Groups "Tornado Web Server" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-tornado/X_TyTsnsJOU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/2c319375-e982-443a-8628-0711e10d8cd4n%40googlegroups.com.

Adrian

unread,
Feb 6, 2021, 6:27:12 AM2/6/21
to Tornado Web Server
I think all you need to do is to set an environment variable before you run your interpreter:

export PYTHONASYNCIODEBUG="1"

For more detail, run python with --log=DEBUG


Ben Darnell

unread,
Feb 6, 2021, 8:55:37 PM2/6/21
to Tornado Mailing List
Correct. There is no longer any way to control this via Tornado; you must enable the event loop's debug mode using one of the methods described in https://docs.python.org/3/library/asyncio-dev.html#debug-mode

Why can't you use asyncio directly? (What do you mean by "using it directly"?)

-Ben

You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/d4908230-d20c-48c4-b7af-3e4c78dbda35n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages