guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: nginx: hydra.gnu.org: Reduce cache validity and size.


From: Ludovic Courtès
Subject: 01/01: nginx: hydra.gnu.org: Reduce cache validity and size.
Date: Wed, 19 Apr 2017 09:45:06 -0400 (EDT)

civodul pushed a commit to branch master
in repository maintenance.

commit c23811e87f100787966c9535dfbcf53f46510e82
Author: Ludovic Courtès <address@hidden>
Date:   Wed Apr 19 15:43:19 2017 +0200

    nginx: hydra.gnu.org: Reduce cache validity and size.
    
    Nginx's caching is now redundant with 'guix publish --cache'.
---
 hydra/nginx/hydra.gnu.org-locations.conf | 19 ++++++++-----------
 hydra/nginx/hydra.gnu.org.conf           |  7 +++++--
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hydra/nginx/hydra.gnu.org-locations.conf 
b/hydra/nginx/hydra.gnu.org-locations.conf
index 3188e38..f8ffe21 100644
--- a/hydra/nginx/hydra.gnu.org-locations.conf
+++ b/hydra/nginx/hydra.gnu.org-locations.conf
@@ -28,7 +28,7 @@ location ~ 
^(/guix)?/nar/.*-(texlive-texmf-|texlive-20150523-texmf) {
 
 location /guix/nar/ {
     # Served by:
-    # guix publish -p 9999 --listen=127.0.0.1 -u nobody -C7 
--nar-path=guix/nar --public-key=/home/hydra/narinfo-key.pub 
--private-key=/home/hydra/narinfo-key.sec
+    # guix publish -p 9999 --listen=127.0.0.1 -u nobody -C8 
--cache=/var/cache/guix/publish --ttl=14d --workers=2 --nar-path=guix/nar 
--public-key=/home/hydra/narinfo-key.pub 
--private-key=/home/hydra/narinfo-key.sec
     proxy_pass http://127.0.0.1:9999;
 
     client_body_buffer_size 256k;
@@ -91,10 +91,6 @@ location /nar/ {
     # to enable caching.
     proxy_hide_header    Set-Cookie;
     proxy_ignore_headers Set-Cookie;
-
-    # Provide a 'content-length' header so that 'guix substitute-binary'
-    # knows upfront how much it is downloading.
-    #add_header Content-Length $body_bytes_sent;
 }
 
 location ~ /(nix-cache-info|static|logo|favicon\.ico) {
@@ -117,7 +113,9 @@ location ~ /(nix-cache-info|static|logo|favicon\.ico) {
 
 location ~ \.narinfo$ {
     # Narinfos served by 'guix publish' (see above).  If we change the
-    # port to 3000, then they are served by Hydra.
+    # port to 3000, then they are served by Hydra.  We assume that
+    # 'guix publish --ttl' produces a 'Cache-Control' header for use
+    # by 'guix substitute', so no need for nginx's 'expire' directive.
     proxy_pass http://127.0.0.1:9999;
 
     # For HTTP pipelining.  This has a dramatic impact on performance.
@@ -132,15 +130,14 @@ location ~ \.narinfo$ {
     proxy_send_timeout 6s;
 
     # Enable caching for narinfo files, to avoid recomputing nar signatures.
+    # 'guix publish' has its own cache and uses the narinfo atime to
+    # determine whether a narinfo can be removed from the cache; thus
+    # choose a validity that is shorter than 'guix publish --ttl'.
     proxy_cache narinfo;
-    proxy_cache_valid 200 14d;  # cache hits for 14 days.
+    proxy_cache_valid 200 5d;   # cache hits for 5 days
     proxy_cache_valid 504 2m;  # timeout, when hydra.gnu.org is overloaded
     proxy_cache_valid any 1m;   # cache misses/others for 1 min.
 
-    # Add 'Expires' and 'Cache-Control' response headers so clients
-    # such as 'guix substitute' know how long they can cache it.
-    expires 5d;
-
     proxy_ignore_client_abort on;
 
     # We need to hide and ignore the Set-Cookie header
diff --git a/hydra/nginx/hydra.gnu.org.conf b/hydra/nginx/hydra.gnu.org.conf
index 796de6c..07408b3 100644
--- a/hydra/nginx/hydra.gnu.org.conf
+++ b/hydra/nginx/hydra.gnu.org.conf
@@ -43,19 +43,22 @@ http {
     # case: all that matters is that LRU sweeping happens when
     # 'max_size' is hit.
 
+    # Since 'guix publish' has its own cache, allocate little room for
+    # nginx's own cache.
+
     # cache for narinfo files
     proxy_cache_path /var/cache/nginx/narinfo
                     levels=2
                     inactive=7d           # inactive keys removed after 7d
                     keys_zone=narinfo:4m  # narinfo meta data: ~32K keys
-                    max_size=20g;         # total cache data size max
+                    max_size=5g;          # total cache data size max
 
     # cache for nar files
     proxy_cache_path /var/cache/nginx/nar
                     levels=2
                     inactive=8d           # inactive keys removed after 8d
                     keys_zone=nar:4m      # nar cache meta data: ~32K keys
-                    max_size=200g;        # total cache data size max
+                    max_size=50g;         # total cache data size max
 
     # cache for static data
     proxy_cache_path /var/cache/nginx/static



reply via email to

[Prev in Thread] Current Thread [Next in Thread]