django and nginx reverse proxy cache
Post on 07-Jul-2015
359 Views
Preview:
DESCRIPTION
TRANSCRIPT
Boosting Django Performance with the Nginx Reverse Proxy
Cache(I need to find better titles…)
Your site is lame!
Why?
Nginx
NginxGunicorn
NginxGunicorn
DB
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
NginxGunicorn
DB FS
“The key to making programs fast is to make them
do practically nothing”
-- Mike Haertel (Author of GNU grep)
The Solution:
NginxGunicorn
DB FS
proxy_cache nginx_cache;
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
proxy_temp_path /data/nginx-cache-temp 1 2;
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
proxy_temp_path /data/nginx-cache-temp 1 2;
proxy_cache_key "$scheme://$host$request_uri";
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
proxy_temp_path /data/nginx-cache-temp 1 2;
proxy_cache_key "$scheme://$host$request_uri";
proxy_cache_valid 200 6M;
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
proxy_temp_path /data/nginx-cache-temp 1 2;
proxy_cache_key "$scheme://$host$request_uri";
proxy_cache_valid 200 6M;
proxy_ignore_headers Cache-Control;proxy_ignore_headers Set-Cookie;proxy_hide_header Set-Cookie;
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
proxy_temp_path /data/nginx-cache-temp 1 2;
proxy_cache_key "$scheme://$host$request_uri";
proxy_cache_valid 200 6M;
proxy_ignore_headers Cache-Control;proxy_ignore_headers Set-Cookie;proxy_hide_header Set-Cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Real-IP $remote_addr;proxy_set_header Host $http_host;
Nginx Reverse Proxy Cache Config
proxy_cache nginx_cache;
proxy_cache_path /data/nginx-cache levels=1:2 max_size=10g inactive=1y keys_zone=nginx_cache:40m;
proxy_temp_path /data/nginx-cache-temp 1 2;
proxy_cache_key "$scheme://$host$request_uri";
proxy_cache_valid 200 6M;
proxy_ignore_headers Cache-Control;proxy_ignore_headers Set-Cookie;proxy_hide_header Set-Cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Real-IP $remote_addr;proxy_set_header Host $http_host;
add_header X-Cached $upstream_cache_status;
Nginx Reverse Proxy Cache Config
The result:
-62%Response time
Your site is fast!
Anton Pirkeranton@ignaz.at@antonpirker
Slideshttp://goo.gl/pGXlkD
Blog posthttp://anton-pirker.at/boosting-djangos-performance-
with-nginx-reverse-proxy-cache/
Thank you for listening!
top related