Django Nginx Configuration - Elapsed time is more How to reduce

I am using nginx + gunicorn + django 1.7,

Resource usage Resource Value

User CPU time 7372.013 msec

System CPU time 1530.070 msec

Total CPU time 8902.083 msec

Elapsed time 14970.586 msec

Context switches 93801 voluntary, 19 involuntary

Totally it takes 18seconds to load a page.

My nginx setup is

user root; worker_processes 4; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; gzip on; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css; gzip_vary on; server_tokens off; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }

In the sites-enabled/mysite.com

which has

upstream test { server 127.0.0.1:8000; keepalive 500; } server { listen 80; server_name www.mysitee.com; client_max_body_size 4G; error_page 502 =200 @maintenance; location @maintenance { root /path/to/static/offline/files; try_files $uri /index.html =503; } location /static/ { alias /home/dev/live/staticfiles/; expires 30d; } location /media/ { alias /home/dev/live/myproject/myproject/site_media/media/; expires 30d; } location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; if (!-f $request_filename) { proxy_pass http://test; break; } } }

Even I have used developer tool.

It say's,

Stalled 0.813 ms

DNS Lookup 0.031 ms

Initial connection 5.731 ms

Request/Response 0.088 ms

Waiting (TTFB) 12.81 s

Content Download 9.065 ms

How to reduce the waiting Time.

Thanks In advance

Category:django Views:8 Time:2017-06-24

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.211 (s). 11 q(s)