Skip to content

Instantly share code, notes, and snippets.

@dundee
Created January 14, 2013 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dundee/4532848 to your computer and use it in GitHub Desktop.
Save dundee/4532848 to your computer and use it in GitHub Desktop.
Caching reverse proxy - Nginx vs Varnish - basic benchmark
# Varnish config
backend default {
.host = "127.0.0.1";
.port = "80";
}
# Nginx config
http {
proxy_cache_path /var/cache/nginx/workspace levels=1:2 keys_zone=workspace:8m max_size=1000m inactive=600m;
proxy_temp_path /var/cache/nginx/workspace/tmp;
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:80;
proxy_set_header Host $host;
proxy_cache workspace;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
}
}
}
# Benchmark
ab -c 100 -n 10000 http://127.0.0.1:8080/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment