[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/04: nginx: mirror: Reduce the proxy timeouts.
From: |
Ludovic Court�s |
Subject: |
02/04: nginx: mirror: Reduce the proxy timeouts. |
Date: |
Thu, 17 Mar 2016 14:21:19 +0000 |
civodul pushed a commit to branch master
in repository maintenance.
commit dd4b1a5e71df6f5466df62a97acc586e1e43c35c
Author: Ludovic Courtès <address@hidden>
Date: Thu Mar 17 15:15:01 2016 +0100
nginx: mirror: Reduce the proxy timeouts.
---
hydra/nginx/mirror-locations.conf | 11 +++++++++++
hydra/nginx/mirror.conf | 5 +++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hydra/nginx/mirror-locations.conf
b/hydra/nginx/mirror-locations.conf
index 41695e3..c32789a 100644
--- a/hydra/nginx/mirror-locations.conf
+++ b/hydra/nginx/mirror-locations.conf
@@ -30,6 +30,10 @@ location /nar/ {
client_body_buffer_size 256k;
+ # Be a little more tolerant of delays when fetching a nar.
+ proxy_read_timeout 20s;
+ proxy_send_timeout 20s;
+
# Enable caching for nar files, to avoid reconstructing and recompressing
# archives.
proxy_cache nar;
@@ -57,9 +61,16 @@ location ~ \.narinfo$ {
# For HTTP pipelining. This has a dramatic impact on performance.
client_body_buffer_size 128k;
+ # Do not tolerate slowness of hydra.gnu.org when fetching
+ # narinfos: better return 504 quickly than wait forever.
+ proxy_connect_timeout 2s;
+ proxy_read_timeout 2s;
+ proxy_send_timeout 2s;
+
# Enable caching for narinfo files, to avoid recomputing nar signatures.
proxy_cache narinfo;
proxy_cache_valid 200 90d; # cache hits for 3 months.
+ proxy_cache_valid 504 5m; # timeout, when hydra.gnu.org is overloaded
proxy_cache_valid any 1h; # cache misses/others for 1h.
# Use the above TTLs, not those advertised by hydra.gnu.org.
diff --git a/hydra/nginx/mirror.conf b/hydra/nginx/mirror.conf
index fe9680e..d9ad4fb 100644
--- a/hydra/nginx/mirror.conf
+++ b/hydra/nginx/mirror.conf
@@ -58,6 +58,11 @@ http {
keys_zone=static:1m # nar cache meta data: ~8K keys
max_size=2m; # total cache data size max
+ # We'd rather fail early than wait forever for hydra.gnu.org.
+ proxy_connect_timeout 5s;
+ proxy_read_timeout 10s;
+ proxy_send_timeout 10s;
+
server {
listen 80;
server_name hydra.gnunet.org;