new config option for ngx_expire_old_cached_file

Franchoze Eric franchoze at
Thu Oct 14 14:14:12 MSD 2010


I did a lot of various experiments with nginx cache. And found that cache has performance problems when number of cache objects much bigger than available place in the cache.
As I understand increasing value in ngx_expire_old_cached_file() makes cache freeing more aggressive.  When loads ups more them 200Mb/sec  I saw a lot of cache stalls before increasing 
this number, from the other side with low load 50 M/s (about 50 requests per second) everything worked fine . Can you please take a look if it makes sense to move this value  to config. 

--- nginx-0.8.52_orig/src/core/ngx_open_file_cache.c	2010-04-21 08:59:36.000000000 -0700
+++ nginx-0.8.52/src/core/ngx_open_file_cache.c	2010-10-12 08:47:45.000000000 -0700
@@ -735,7 +735,7 @@ ngx_expire_old_cached_files(ngx_open_fil
      *        and one or two inactive files
-    while (n < 3) {
+    while (n < 30) {
         if (ngx_queue_empty(&cache->expire_queue)) {


More information about the nginx-devel mailing list