Closed noobie-bob closed 1 month ago
It's great to see that Niquests showed interests.
After careful reading of your case, we think that what you saw is perfectly normal.
get
, so they are basically running synchronously.There is some usecase where async+multipex perform better, but clearly not on your presented case. See https://github.com/Ousret/niquests-stats for a viable example.
And yes, sync + multiplex can make asyncio http calls look terrible. Look at https://medium.com/@ahmed.tahri/10-reasons-you-should-quit-your-http-client-98fd4c94bef3 section (II) multiplex.
I am closing this one, as it is not a performance issue.
Regards,
Summary.
I ran a simple http request call's to benchmark various wrappers that Niquests provided, where server supports h2 protocol. The async version with multiplex is almost 5-6 times slower compared to sync version with multiplex. Would request for help if this could be done a better way.
Expected Result - N/A
What you expected. - Usually Async version will be quite faster than sync version, when performing multiple network requests. Atleast, thats what I been observed with async/await calls with http1.1.
Actual Result: Here the Async multiplex was 5-6 times slower when compared to Sync multiplex calls.
What happened instead.
Reproduction Steps
System Information
Results obtained -
Summary - I did requests call in following order and one more requests in reverse order as shared below, just to make sure last wrappers making the requests are not receiving requests from throttling CPU. Turns out its not the case, as the time was quite comparable making irrespective of the order.
Total output obtained
Also want to say I did discover Niquests yesterday, it is a beautiful gift for python. And also would requests for help in integrating this for Fastapi.
Thank you.