Hi,

I have not withnessed this on uWSGI itself, but with other virtual servers
and Google App Engine. Basically the host reclaims all the resources from
VPN (memory, CPU). Your virtual machine is effectively swapped out.

When the first request hits your VPS everything must be swapped back to
memory in order to processe the request.

You can check if this is a VPS problem to see if you can repeat the issue
on non-VPS server (or on a different hosting provider).

-Mikko


On 7 August 2014 00:08, Desktop Ready <[email protected]> wrote:

> 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
>



-- 
Mikko Ohtamaa
http://opensourcehacker.com
http://twitter.com/moo9000
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to