Welcome! Log In Create A New Profile

Advanced

Re: Nginx cache is slow

Maxim Dounin
August 19, 2011 04:34AM
Hello!

On Fri, Aug 19, 2011 at 03:58:09AM -0400, ddarko wrote:

> Nginx 1.1.0
>
> location / {
> uwsgi_cache tna;
> uwsgi_cache_use_stale error timeout http_500;
> uwsgi_cache_valid any 10m;
> uwsgi_cache_key $request_uri;
>
> include /etc/nginx/params_uwsgi;
> uwsgi_intercept_errors off;
> uwsgi_pass unix:/tmp/uwsgi-tna.sock;
> }
>
> I made a simple test: $ ab -c 10 -n 10000 http://.... on localhost.
> I am sure that the request is sent to uWSGI only once and is then
> cached.
> result: Requests per second: 3712.93 [#/sec] (mean)
>
> Meanwhile, on the same machine and the same nginx for static file
> reaches the result:
> Requests per second: 4826.62 [#/sec] (mean)
>
> How is that static files are faster to 30%! from the cache based on
> static files ?

Cached response require additional reading of original response
headers, as well as calculating cache key and parsing the headers
in question (which may be an issue on cpu-bound servers). So I
would expect it to be somewhat slower than plain static files.

While 30% looks a bit too many, it certainly depens havily on
response sizes involved as well as type of a limiting factor (i.e.
cpu or disk bound). In worst case I would expect cache to be 2x
slower compared to static files (though it's unlikely to happen in
real life).

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx cache is slow

ddarko August 19, 2011 03:58AM

Re: Nginx cache is slow

Maxim Dounin August 19, 2011 04:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 250
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready