ops: Add new nginx hot cacher

This commit is contained in:
wiz 2024-01-26 10:40:21 -05:00
parent c7862e19c2
commit 5a7a78cddc
No known key found for this signature in database
GPG Key ID: A394E332255A6173
3 changed files with 23 additions and 3 deletions

View File

@ -24,7 +24,13 @@ done
# start nginx warm cacher # start nginx warm cacher
for site in mainnet;do for site in mainnet;do
echo "starting mempool cache warmer: ${site}" echo "starting mempool cache warmer: ${site}"
screen -dmS "warmer-${site}" $HOME/mainnet/production/nginx-cache-warmer screen -dmS "warmer-${site}" $HOME/mempool/production/nginx-cache-warmer
done
# start nginx hot cacher
for site in mainnet;do
echo "starting mempool cache heater: ${site}"
screen -dmS "heater-${site}" $HOME/mempool/production/nginx-cache-heater
done done
exit 0 exit 0

View File

@ -39,7 +39,6 @@ warmUnfurlURLs=(
) )
warmURLs=( warmURLs=(
'/api/v1/fees/recommended'
'/api/v1/blocks' '/api/v1/blocks'
'/api/v1/statistics/2h' '/api/v1/statistics/2h'
'/api/v1/statistics/24h' '/api/v1/statistics/24h'

View File

@ -23,7 +23,7 @@ location /api/v1/mining {
try_files /dev/null @mempool-api-v1-cache-warm; try_files /dev/null @mempool-api-v1-cache-warm;
} }
location /api/v1/fees/recommended { location /api/v1/fees/recommended {
try_files /dev/null @mempool-api-v1-cache-warm; try_files /dev/null @mempool-api-v1-cache-hot;
} }
# it's ok to cache blockchain data "forever", so we do 30d # it's ok to cache blockchain data "forever", so we do 30d
@ -84,6 +84,21 @@ location @mempool-api-v1-cache-forever {
expires 30d; expires 30d;
} }
location @mempool-api-v1-cache-hot {
proxy_pass $mempoolMainnet;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_background_update on;
proxy_cache_use_stale updating;
proxy_cache api;
proxy_cache_valid 200 1s;
proxy_redirect off;
}
location @mempool-api-v1-cache-warm { location @mempool-api-v1-cache-warm {
proxy_pass $mempoolMainnet; proxy_pass $mempoolMainnet;