Most web application requests follow a simple path through the application, regardless of whether it is blocking or evented, where the critical path of the request is the only work being done. However, some web applications make use of threads, eventlets, or queues to process work in parallel or out of the critical path.
In order to analyze traces with asynchronous and parallel workflows correctly, small annotations must be added to the
trace’s events. They boil down to adding the key Async
= True on “asynchronous” layers. Here’s how to handle two
common scenarios:
Your application might want to do some work from which the return value is not necessry. Why put it in the critical
path? So you spin off this work to a second thread. The asynchronous thread, or the work within it, should be given
its own layer with the Async
flag:
[ rawview annotated ]
You’re querying 10 sites at once, or maybe 10 databases, and you need the replies from all of them--the app will be
blocking anyway, so why do this work serially? Each separate query or RPC, or a layer containing it, should get the
Async
flag:
[ rawview annotated ]