diff --git a/admin/config/nginx.conf b/admin/config/nginx.conf index 848224e1..2b4828d8 100644 --- a/admin/config/nginx.conf +++ b/admin/config/nginx.conf @@ -21,7 +21,8 @@ http { # cache の設定 proxy_cache_path /var/nginx/cache_1 levels=1:2 keys_zone=political_parties_cache:1m max_size=1g inactive=1m use_temp_path=on; - proxy_cache_path /var/nginx/cache_2 levels=1:2 keys_zone=candidates_cache:1m max_size=1g inactive=1m use_temp_path=on; + proxy_cache_path var/nginx/cache_2 levels=1:2 keys_zone=candidates_cache:1m max_size=1g inactive=1m use_temp_path=on; + proxy_cache_path var/nginx/cache_3 levels=1:2 keys_zone=index_cache:1m max_size=1g inactive=1m use_temp_path=on; server { listen 443; @@ -38,15 +39,24 @@ http { location /political_parties/ { proxy_cache political_parties_cache; - proxy_cache_valid 200 302 1m; + proxy_cache_valid 200 302 30s; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; proxy_set_header Host $host; proxy_pass http://app; } + } location /candidates/ { - proxy_cache candidates_cache; - proxy_cache_valid 200 302 1m; + proxy_cache candidates_parties_cache; + proxy_cache_valid 200 302 30s; + proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; + proxy_set_header Host $host; + proxy_pass http://app; + } + + location = / { + proxy_cache index_cache; + proxy_cache_valid 200 302 30s; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; proxy_set_header Host $host; proxy_pass http://app; diff --git a/docker/app/entrypoint.sh b/docker/app/entrypoint.sh index a23c0bc7..47e774a4 100755 --- a/docker/app/entrypoint.sh +++ b/docker/app/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -eux -sudo mkdir -p /var/nginx/cache_1 /var/nginx/cache_2 +sudo mkdir -p /var/nginx/cache_1 /var/nginx/cache_2 /var/nginx/cache_3 sudo nginx -t sudo service nginx start sudo service mysql start || true diff --git a/note.md b/note.md index 35dd4221..cce862af 100644 --- a/note.md +++ b/note.md @@ -483,3 +483,9 @@ docker exec -i ishocon2-bench-1 sh -c "./benchmark --ip app:443 --workload 6" 2024/01/02 09:12:13 {"score": 18968, "success": 16184, "failure": 0} ``` +- more cache on nginx + +``` + +``` +