cache: move open to thread pool

Eran Kornblau eran.kornblau at
Tue Aug 28 09:15:32 UTC 2018


> Hi Eran,
> Happy to see that we are not the only place where we find open to be a problem. I took a look at your module and while the approach is sound, I decided the complexity doesn't seem to be worth it. Hope to see some numbers of how your module works at scale.
> - Ka-Hing
I don't have numbers that show the improvement we got from moving open to a thread pool, 
but what I can say is that on our environment, open can sometimes take an unreasonable 
time to complete - several seconds.
I noticed it several years ago, after I added a feature of 'performance counters' to my module 
(posted it here -,255847,258854#msg-258854).
This is the reason I decided to implement the async open - in order to avoid having all 
worker active requests hang for so long.
In my case, I was already using open file cache, and while I got a fairly good hit ratio, 
these extreme cases of worker hanging for few seconds wasn't something I wanted to accept.
Also, in my setup, I'm not using proxy_cache - my servers serve as origin servers behind a CDN, 
so a solution that is limited to file cache is not something I could use.


More information about the nginx-devel mailing list