Hello,

I am building my website with the following approach:
Nginx -> uWSGI -> Django -> PostgreSQL

Everything works well but I have one odd problem: it seems that the
first request after a long idle time (>10-20 mn) is always very slow
(page load in 30 seconds instead of 1 second).

Strangely it doesn't happen if I make a request, restart uWSGI and make
another request. So it is not because of Django lazy loading/import.

After some debug it is not because of Nginx or because of PostgreSQL.
So somewhere between them is the problem.

Perhaps some too aggressive memory freeing ? I'm on Debian stable with
uWSGI 1.2.3, running on a VPS (OpenVZ).

Can someone propose a way to identify the problem and solve this ?

Here is my uWSGI params:

uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;


And here is uWSGI configuration:

[uwsgi]

chdir = /home/user/website
module = website.wsgi
home = /home/user/.virtualenvs/website
plugin          = python
master          = true
processes       = 4
cpu-affinity    = 1
socket          = /var/uwsgi/website.sock
chmod-socket    = 664
vacuum          = true
env = HTTPS=on
post-buffering  = 4096

Any hints is welcomed !

Thanks
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to