From ee949071d88592f9ade92a39862f68920217f115 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 1 Jun 2016 22:53:35 +0100 Subject: [PATCH 1/1] imagery: increase nginx cache size --- .../default/nginx_imagery_layer_fragment.conf.erb | 1 + cookbooks/nginx/attributes/default.rb | 12 ++++++------ roles/imagery.rb | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb b/cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb index 50b3070c9..fc0b9e394 100644 --- a/cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb +++ b/cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb @@ -10,6 +10,7 @@ location ~* "^/layer/<%= @layer %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" { # Caching fastcgi_cache "fastcgi_cache_zone"; fastcgi_cache_key "<%= @layer %><%= @revision %> $request_method $1 $2 $3"; + fastcgi_keep_conn on; fastcgi_cache_lock on; fastcgi_cache_lock_timeout 30s; fastcgi_cache_valid 200 21d; diff --git a/cookbooks/nginx/attributes/default.rb b/cookbooks/nginx/attributes/default.rb index 4e22759bf..fc2573314 100644 --- a/cookbooks/nginx/attributes/default.rb +++ b/cookbooks/nginx/attributes/default.rb @@ -1,11 +1,11 @@ # Tuning for nginx fastcgi cache zone default[:nginx][:cache][:fastcgi][:enable] = false -default[:nginx][:cache][:fastcgi][:keys_zone] = "fastcgi_cache_zone:32m" -default[:nginx][:cache][:fastcgi][:inactive] = "30d" -default[:nginx][:cache][:fastcgi][:max_size] = "2048m" +default[:nginx][:cache][:fastcgi][:keys_zone] = "fastcgi_cache_zone:32M" +default[:nginx][:cache][:fastcgi][:inactive] = "45d" +default[:nginx][:cache][:fastcgi][:max_size] = "2048M" # Tuning for nginx proxy cache zone default[:nginx][:cache][:proxy][:enable] = false -default[:nginx][:cache][:proxy][:keys_zone] = "proxy_cache_zone:32m" -default[:nginx][:cache][:proxy][:inactive] = "30d" -default[:nginx][:cache][:proxy][:max_size] = "2048m" +default[:nginx][:cache][:proxy][:keys_zone] = "proxy_cache_zone:32M" +default[:nginx][:cache][:proxy][:inactive] = "45d" +default[:nginx][:cache][:proxy][:max_size] = "2048M" diff --git a/roles/imagery.rb b/roles/imagery.rb index 9106f9329..ba3009852 100644 --- a/roles/imagery.rb +++ b/roles/imagery.rb @@ -32,7 +32,10 @@ default_attributes( :nginx => { :cache => { :fastcgi => { - :enable => true + :enable => true, + :keys_zone => "fastcgi_cache_zone:256M", + :inactive => "45d", + :max_size => "51200M" } } } -- 2.39.5