How can I find what is clogging my async server (tokio)?

In my async server tokio event loop is not functioning well:

tokio::time::delay_for(Duration::from_secs(1)).await;

takes sometimes 30 seconds, sometimes over a minute. Clearly, some other part of the program is misbehaving, probably running slow code synchronously.

How can I find what is causing this?

Ideally, I'm looking for some method that doesn't require manually instrumenting code. For example, does tokio have any built-in warnings about long blocking poll() calls?

We don't have this, although it is something I want to make easier in Tokio. For now, you would have to wrap a future around the spawned tasks that performs the check for you.

1 Like