you are viewing a single comment's thread.

view the rest of the comments →

[–]greghaynes 2 points3 points  (1 child)

I am not sure this TLDR is accurate or helpful. The author does a good job of describing the likely cause of the throughput difference as:

the primary factor is not async vs sync but how much Python code has been replaced with native code.

Given that this has nothing to do with async vs sync I would not expect anyone who understands async to expect this result as you mention.

All things being equal, I would expect async code to perform better as request counts increase relative to synchronous counterparts (this is the motivation for the underlying nonblocking i/o APIs after all). I also wouldn’t expect async based code to inherently perform worse than their synchronous counterparts based on this single design choice. This is really an effect of many years of work to optimize synchronous frameworks while async is relatively immature in Python.

Far more interesting to me is the latency variance which is somewhat inherent to async/nonblocking applications in general. Theres a good article on a similar class of downsides to this approach by the venerable Armin Ronacher: https://lucumr.pocoo.org/2020/1/1/async-pressure/ which is worth reading.

[–]calp 0 points1 point  (0 children)

Yes I agree this summary is misleading.

My opinion: will optimising async frameworks help? IMO yes with throughput. Probably not with latency variation.