Welcome! Log In Create A New Profile

Advanced

bad performance with nginx cache

Franchoze Eric
August 27, 2010 06:26AM
Hello,

On these week I tried speed up nginx work with turning on cache for graphics files specified by extentions (jpg, png, bmp, etc.) in config file. On system without any load client (web browser) loaded pages for the same time - with cache or without cache. But after installing same configuration on real server I realized the following issue:

1. Nginx can not speed up more then 150Mbit/s is cache is no hard drive. Can speed up to 200Mbit/s if cache is on tmpfs.
2. Load time from client begins to be 2-3 times lager then without cache if traffic is about 150Mbit/s. This happens for all files even if they were not specified in nginx.conf.

Does anybody have successful nginx cache run with throughput 500-600Mbit/s? Does it speed up or lower end client page load speed?

My configuration is SMP machine with nginx worker per cpu.
proxy_cache_path /var/www/cache2 levels=1:2 keys_zone=my-cache:512m max_size=3000m inactive=10m;
proxy_temp_path /var/www/cache2/tmp;
proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";


location ~*(site1.com|site2.com|site3.com|site4.com|site5.com|site6.com)*\.(jpe?g|gif|png|tif|svg|ico|bmp)$ {
proxy_pass http://$host$request_uri;
proxy_buffering on;
proxy_buffers 256 4k;
proxy_buffer_size 4k;
proxy_cache_min_uses 1; #minimal requests to put object to cache
proxy_cache my-cache;
proxy_cache_valid 200 301 302 304 60m; #page ok
proxy_cache_valid 404 10m; #server not found

log_format cache '***$time_local '
'$upstream_cache_status '
'Cache-Control: $upstream_http_cache_control '
'Expires: $upstream_http_expires '
'"$request" ($status) ';

access_log /var/log/nginx/cache_nginx_access_limited.log cache;
}

I would like to hear if there are any weak places in the cache or limitations. So maybe we can speed up it. I'm not yet very familiar with modern cache techniques but maybe we can use libvarnish to increase performance.
I will be also ok if nginx could skip doing caching if time to fetch object from cache is bigger than download it.

Any ideas are welcome.

Thanks,
Eric.



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

bad performance with nginx cache

Franchoze Eric 4474 August 27, 2010 06:26AM

Re: bad performance with nginx cache

Igor Sysoev 1462 August 27, 2010 06:48AM

Re: bad performance with nginx cache

Igor Sysoev 1263 August 27, 2010 06:58AM

Re: bad performance with nginx cache

Franchoze Eric 1670 August 30, 2010 06:16AM

Re: bad performance with nginx cache

Boris Dolgov 1480 August 30, 2010 06:28AM

Re: bad performance with nginx cache

Igor Sysoev 1338 August 30, 2010 11:42AM

Re: Re: bad performance with nginx cache

Franchoze Eric 1186 August 30, 2010 02:58PM

Re: Re: bad performance with nginx cache

Igor Sysoev 1456 August 31, 2010 08:44AM

Re: bad performance with nginx cache

Franchoze Eric 1612 September 02, 2010 03:46PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 283
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