Async Techniques and Examples in Python Transcripts
Chapter: asyncio-based web frameworks
Lecture: Review: Request latency again

Login or purchase this course to watch this video and the rest of the course contents.
0:00 It may have been awhile since you're seen the opening async chapter where we talked about synchronous execution and response time
0:07 and why that is versus asynchronous execution. As I've said before this is how we opened the course but just to remind you
0:14 we'll go through this super, super quick we have three requests that come in. They each take the time that the green box with their name on them takes
0:21 so request one and request two take awhile request three not so long. We want to know how long does it take from the outside
0:29 how long does it appear for this processing take to the client. If we have a single threaded synchronous set of executions in our web app.
0:37 Well, response one looks pretty good about the same time we, I guess, expect it to take. Response two however, is pretty shabby.
0:44 And if you look how short request three is it turned out to be like five times as long as it should have taken because it didn't get a run for so long
0:51 it's all queued up. If we can take the places where our web app is mostly waiting on a database waiting on a web service waiting on a file system
1:00 all those things and wrap it up in asyncio we can take this graphic and make it way better. Looks more like this. We can start processing request one
1:09 as soon as it starts waiting and request two comes in we immediately can pick it up. Similarly, when we get to three the first two are waiting again
1:16 on something like a database we just hand out that response right away. So it looks more like this. Yeah, you can't actually make them go faster
1:23 but in terms of latency well, things look a whole lot better. This is the type of system we're going to build right in this chapter using a Flask.


Talk Python's Mastodon Michael Kennedy's Mastodon