Performance bottleneck with mono threaded Downloader Middleware
See original GitHub issueSummary
There seems to be a performance bottleneck in the case where a Downloader Middleware is I/O heavy: I have a custom cache storage (very similar to FilesystemCacheStorage
) which does some I/O. In the cases where the cache hit ratio is high, this cache becomes the overwhelming bottleneck.
Additional context
I tried playing with both REACTOR_THREADPOOL_MAXSIZE
and CONCURRENT_REQUESTS
but it seems that no multi-threading is taking place to invoke the cache middleware since it’s only ran from the main thread. I am not very familiar with Reactor thread pooling but I cannot find a nob to turn on multithreading at that level.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
ASP.NET Core Performance Best Practices | Microsoft Learn
Tips for increasing performance in ASP.NET Core apps and avoiding common performance problems.
Read more >Downloader Middleware — Scrapy 2.7.1 documentation
The downloader middleware is a framework of hooks into Scrapy's request/response processing. It's a light, low-level system for globally altering Scrapy's ...
Read more >Tuning Performance Guide - Oracle Help Center
that the network is not becoming a bottleneck, or detect packet loss or other network performance issues. About Oracle Fusion Middleware Management Tools....
Read more >Game Dev Guide for 12th Gen Intel Core Processor
Use the most performant cores first for single-thread and multi-thread performance. Ensure spill-over multithreaded work uses lesser ...
Read more >(PDF) Improving Performance in the Network Storage Stack | Terry ...
High performance threaded data streaming for large scale simulations ... tions use single connections to access and utilize net- and work storage.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could always write async code in middlewares, using Deferreds.
There is no such thing as “reactor threads”. Native Python coroutines get wrapped into Twisted Deferreds.
Not necessarily. That’s why I wrote “Assuming your I/O-bound code is synchronous” and “asyncio doesn’t make your code asynchronous by itself”.
You already have
callInThread
/deferToThread
.Perfect, thanks so much for your help @wRAR