Well, we have long been interested in how fast will Magento work on NginX server, finally we've got a chance to test this. One of the clients has moved his Magento-based store from Litespeed server onto NginX one.
How we tested it:
We used AB (Apache benchmark) utility. We have checked how many pages each web-server generated within one minute, with 15 concurrent connections to the server.
Servers configuration:
Old Server:
- Litespeed (version 4.0.12)
- Dual CPU Quadcore Intel Xeon;
- 6GB RAM,
- 4xHDD 15000 rpm RAID 1+0 |
New server:
- NginX (version 0.7.65)
- Single CPU DualCore Intel Xeon;
- 2 GB RAM,
- 1xHDD 7200 rpm |
Software Configuration:
There was identical copies of the same store on both servers, store is based on Magento version 1.4.0.1.
Results:
Litespeed
Benchmarking ***.com:
Finished 672 requests |
NginX
Benchmarking ***.com:
Finished 2761 requests |
The results are really impressing. NginX performance is overhelming, even if the Litespeed server has much better hardware than NginX one.
No surprise why Varien moved Magento site and demo store to NginX.
P.S. our client is really happy, because now he can use cheaper server hardware without the speed affecting.
Detailed Results
Results for LiteSpeed:
Benchmarking ***.com (be patient)
Finished 672 requests
Server Software: LiteSpeed
Server Hostname: ***.com
Server Port: 80
Document Path: /magento/
Document Length: 23391 bytes
Concurrency Level: 15
Time taken for tests: 60.155 seconds
Complete requests: 672
Failed requests: 668
(Connect: 0, Length: 668, Exceptions: 0)
Write errors: 0
Keep-Alive requests: 0
Total transferred: 16052994 bytes
HTML transferred: 15770426 bytes
Requests per second: 11.20 [#/sec] (mean)
Time per request: 1339.289 [ms] (mean)
Time per request: 89.286 [ms] (mean, across all concurrent requests)
Transfer rate: 261.27 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 66 68 12.9 67 255
Processing: 587 1251 412.8 1137 5233
Waiting: 439 1092 401.4 986 5079
Total: 825 1320 411.7 1204 5300
Percentage of the requests served within a certain time (ms)
50% 1204
66% 1327
75% 1429
80% 1482
90% 1781
95% 2095
98% 2465
99% 2904
100% 5300 (longest request)
|
Results for NginX (Engine-X):
Benchmarking ***.com (be patient)
Finished 2761 requests
Server Software: nginx/0.7.65
Server Hostname: ***.com
Server Port: 80
Document Path: /magento/
Document Length: 24471 bytes
Concurrency Level: 15
Time taken for tests: 60.1140 seconds
Complete requests: 2761
Failed requests: 0
Write errors: 0
Keep-Alive requests: 0
Total transferred: 68512771 bytes
HTML transferred: 67680271 bytes
Requests per second: 46.02 [#/sec] (mean)
Time per request: 325.975 [ms] (mean)
Time per request: 21.732 [ms] (mean, across all concurrent requests)
Transfer rate: 1115.10 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 30 74 30.2 69 153
Processing: 183 250 30.4 255 347
Waiting: 30 75 9.7 77 91
Total: 225 324 10.1 324 378
Percentage of the requests served within a certain time (ms)
50% 324
66% 327
75% 335
80% 335
90% 335
95% 336
98% 338
99% 346
100% 378 (longest request)
|
There are a couple recommendations that can speed up your store:
- Try to replace spawn-fcgi script with the PHP-FPM, i.e. re-compile PHP with PHP-FPM patch
- try to install PHP extensions: eaccelerator OR APC
- Try to re-configure your PHP, so it will require more resources but will work faster. For instance try to configure memory limit, zlib compression, output buffering, etc. Magento requires many PHP resources, so PHP may be a bottleneck of your configuration.
And of course, our qualified Nginx administrators can configure your server for your needs, if you have interested just let us know:)
PHP - v
PHP 5.3.2 (cli) (built: Apr 30 2010 05:43:36)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Oh yes, and I disabled logging as well to see if that was the outcome, and increased mysql cache and connection limit. Just a hunch but I think the bottlenect might be spawn-fcgi its receiving to many requests and its not cloding the threads properly thus explaining the high cpu load but im not sure how to test that properly. Again thanx a lot :-)
There are 2 points which you should pay attention to:
1. We need to know what file you request because it is not clear by your description:
_____________________
ab -c 15 t- 60 http://www.***.com
_____________________
We need to know if it is a static *.html file or *.PHP one.
2. If you request a dynamic PHP page, we need to know what is the version of PHP and the way it configured.
If you request a static HTML page, please ensure that you have the following directives in the config file:
___________________________
sendfile on;
keepalive_timeout 15;
gzip on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/xml text/css text/js application/x-javascript image/png image/gif image/jpeg image/jpg;
proxy_buffers 8 64k;
proxy_intercept_errors on;
proxy_connect_timeout 1s;
proxy_read_timeout 3s;
proxy_send_timeout 3s;
___________________________
P.S. Also we noticed you use RAID1 drives, it may be a bottleneck of your system because the writing process in such configurations is raver slow. You might try 1+0, it can give you a good speed up, however it will require 4 drives (and more money).
You can try to speed up your current configuration by disabling the logging of the server requests for images, it can be done by following directives:
____________________________________
location ~* \.(gif|jpg|png) {
access_log off;
}
____________________________________
My Hardware
Dell poweredge 1850
2 xeons dual core
3 gig ram
10k drives RAID1
Running Fedora 13
used string: ab -c 15 t- 60 http://www.***.com
Server Software: nginx/0.7.65
Server Hostname: www.***.com
Server Port: 80
Document Path: /
Document Length: 21591 bytes
Concurrency Level: 15
Time taken for tests: 60.017 seconds
Complete requests: 578
Failed requests: 0
Write errors: 0
Total transferred: 12729872 bytes
HTML transferred: 12479598 bytes
Requests per second: 9.63 [#/sec] (mean)
Time per request: 1557.543 [ms] (mean)
Time per request: 103.836 [ms] (mean, across all concurrent requests)
Transfer rate: 207.13 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 880 1538 247.7 1547 2859
Waiting: 842 1492 231.5 1508 2155
Total: 881 1538 247.7 1547 2859
Percentage of the requests served within a certain time (ms)
50% 1547
66% 1628
75% 1677
80% 1719
90% 1837
95% 1928
98% 2082
99% 2159
100% 2859 (longest request)
your sharing, it's very useful
I've been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian, iwspo.net
NginX vs LiteSpeed: Magento Benchmark #nginx #magento #hosting #ecommerce...
They're right, it's possible even with Apache with the right config. My little box has far less power than yours (Single Quad Xeon, 4 GB, 1x HDD 7200rpm), but it handles easily C100 (I didn't test more, it's useless).
So I doubt about your Lightspeed config.
And with Magento, there're also PHP/MySQL. Webserver shouldn't be the bottleneck.