This is very arguable - you are just trading the complexity of needing to know when to await/yeild for the complexity that comes with managing locks/multithreading hell
How exactly does a python program scale? If you're at the point of receiving 10s of thousands of requests/minute, do you basically have a ton of python containers or vm's all running that a load balancer evenly divides work to?
There's no one answer to how to scale an application. You look at what's the worst part, and focus on that. You look at code changes, architecture changes, whatever moves the bottleneck somewhere else.
If all your Python containers need to talk to a single database/storage backend instance, adding more containers will only make your problem worse.
This is what differentiates good architects vs bad architects - you HAVE to ARCHITECT for your workload on the extremes of performance - when you’re not at the edge case all of the problematic characteristics of your workload are hidden by the fact that you’re only making ten requests a minute.
There’s two ways to scale, you either make what you have faster (vertical scale) so you can handle the load, or you add more machines and load balance them (horizontal scale).
Vertical scale is acceptable as the MUCH cheaper option.
Async adds capacity to the machine (vertical scale) so you can either continue to run everything on one server for longer, or reduce the the number of machines you need to run your high traffic service in the long run.
57
u/runew0lf Sep 09 '22
Nobody said it was, the important thing is its non blocking..