Nginx错误ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"解决方法

例行检查服务器运行状态时在nginx错误日中发现了很多下面的错误:

2015/02/03 22:17:12 [crit] 31394#0: ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"
2015/02/03 22:17:17 [crit] 31394#0: ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"
2015/02/03 22:17:24 [crit] 31392#0: ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"
2015/02/03 22:17:44 [crit] 31393#0: ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"
2015/02/03 22:17:55 [crit] 31392#0: ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"

我的nginx中配置了wsgi_cache(这个和nginx的fastcgi_cache和proxy_cache是类似的东东), 配置缓存相关的部分代码如下所示:

  #cache def
  uwsgi_cache_path  /xxx/nginx-cache/uwsgi levels=1:2 keys_zone=nginx_uwsgi_cache:170m max_size=50g inactive=20d;
  uwsgi_temp_path /xxx/nginx-cache/uwsgi/temp;
  uwsgi_cache_key "$scheme$request_method$host/$device_type$request_uri$is_args$args";
  #end

我将keys_zone设置为170m内存,出现 ngx_slab_alloc() failed: no memory in cache keys zone "nginx_uwsgi_cache"错误是由于此处的内存配置太低了,将此内存调大一些,就可以解决此问题。

你可能感兴趣的:(Nginx)