Welcome! Log In Create A New Profile

Advanced

Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

October 03, 2013 12:34PM
Hello guys,

First of all, thanks for nginx. It is very good and easy to setup. And it is kind of a joy to learn about it.

Two warnings: this performance thing is addictive. Every bit you squeeze, you want more. And English is my second language so pardon me for any mistakes.

Anyways I am comparing nginx performance for wordpress websites in different scenarios and something seems weird. So I am here to share with you guys and maybe adjust my expectations.

Software
# NGINX 1.4.2-1~dotdeb.1
# PHP5-CGI 5.4.20-1~dotdeb.1
# PHP-FPM 5.4.20-1~dotdeb.1
# MYSQL Server 5.5.31+dfsg-0+wheezy1
# MYSQL Tuner 1.2.0-1
# APC opcode 3.1.13-1

This is a ec2 small instance. All tests done using SIEGE 40 concurrent requests for 2 minutes. All tests done from localhost > localhost.

Scenario one - A url cached via fastcgi_cache to TMPFS (MEMORY)
SIEGE -c 40 -b -t120s 'http://www.joaodedeus.com.br/quero-visitar/abadiania-go'

Transactions: 1403 hits
Availability: 100.00 %
Elapsed time: 119.46 secs
Data transferred: 14.80 MB
Response time: 3.36 secs
Transaction rate: 11.74 trans/sec
Throughput: 0.12 MB/sec
Concurrency: 39.42
Successful transactions: 1403
Failed transactions: 0
Longest transaction: 4.43
Shortest transaction: 1.38


Scenario two - Same url cached via fastcgi_cache to disk (ec2 oninstance storage - ephemeral)

Transactions: 1407 hits
Availability: 100.00 %
Elapsed time: 119.13 secs
Data transferred: 14.84 MB
Response time: 3.33 secs
Transaction rate: 11.81 trans/sec
Throughput: 0.12 MB/sec
Concurrency: 39.34
Successful transactions: 1407
Failed transactions: 0
Longest transaction: 4.40
Shortest transaction: 0.88


Here is where the first question pops in. I dont see a huge difference on ram to disk. Is that normal? I mean, no huge benefit on using ram cache.

Scenario three - The same page, saved as .html and server by nginx

Transactions: 1799 hits
Availability: 100.00 %
Elapsed time: 120.00 secs
Data transferred: 25.33 MB
Response time: 2.65 secs
Transaction rate: 14.99 trans/sec
Throughput: 0.21 MB/sec
Concurrency: 39.66
Successful transactions: 1799
Failed transactions: 0
Longest transaction: 5.21
Shortest transaction: 1.30


Here is the main question. This is a huge difference. I mean, AFAIK serving from cache is supposed to be as fast as serving a static .html file, right? I mean - nginx sees that there is a cache rule for location and sees that there is a cached version, serves it. Why so much difference?

Cache is working fine
35449 -
10835 HIT
1156 MISS
1074 BYPASS
100 EXPIRED

Any help is welcome.
Best regards.
SubjectAuthorPosted

Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutraOctober 03, 2013 12:34PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim DouninOctober 03, 2013 01:14PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutraOctober 03, 2013 03:00PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim DouninOctober 04, 2013 08:06AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutraOctober 04, 2013 09:43AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutraOctober 04, 2013 09:52AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim DouninOctober 04, 2013 11:12AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutraOctober 04, 2013 12:52PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim DouninOctober 04, 2013 01:46PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutraOctober 04, 2013 01:43PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 92
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 165 on April 21, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready