I have a server with (Apache2 + nginx as reverse proxy, memcached cache and eaccelerator). The application is Magento - it is very heavy, due to high modularity and a lot of php files(5000-10000+).
Software versions:
Server version: Apache/2.2.16 (Debian) Server built: Sep 25 2011 22:18:56 PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) memcached STAT version 1.4.5(not php module) eaccelerator php module 0.9.6.1
CPU:
root@grandpa:~# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Pentium(R) 4 CPU 2.40GHz stepping : 7 cpu MHz : 2399.701 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe up pebs bts cid xtpr bogomips : 4799.40 clflush size : 64 cache_alignment : 128 address sizes : 36 bits physical, 32 bits virtual
RAM
root@grandpa:~# cat /proc/meminfo MemTotal: 1293792 kB MemFree: 77980 kB Buffers: 89776 kB Cached: 423168 kB SwapCached: 160 kB Active: 689012 kB Inactive: 445392 kB Active(anon): 443016 kB Inactive(anon): 182060 kB Active(file): 245996 kB Inactive(file): 263332 kB Unevictable: 0 kB Mlocked: 0 kB HighTotal: 404744 kB HighFree: 24676 kB LowTotal: 889048 kB LowFree: 53304 kB SwapTotal: 2526200 kB SwapFree: 2525556 kB Dirty: 816 kB Writeback: 0 kB AnonPages: 621300 kB Mapped: 57088 kB Shmem: 3616 kB Slab: 47800 kB SReclaimable: 35400 kB SUnreclaim: 12400 kB KernelStack: 2176 kB PageTables: 4508 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 3173096 kB Committed_AS: 1307224 kB VmallocTotal: 122880 kB VmallocUsed: 41768 kB VmallocChunk: 70512 kB HardwareCorrupted: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 4096 kB DirectMap4k: 36856 kB DirectMap4M: 868352 kB
Currently magento's ApacheBench shows following output
Keefir-Samolet-iMac:~ jevgenismirnov$ ab -n 1000 -c 20 -e out.csv http://magento.sv/index.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking magento.sv (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.0.11
Server Hostname: magento.sv
Server Port: 80
Document Path: /index.php
Document Length: 21497 bytes
Concurrency Level: 20
Time taken for tests: 842.750 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 21955000 bytes
HTML transferred: 21497000 bytes
Requests per second: 1.19 [#/sec] (mean)
Time per request: 16854.999 [ms] (mean)
Time per request: 842.750 [ms] (mean, across all concurrent requests)
Transfer rate: 25.44 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 4694 2456.3 5107 21387
Processing: 0 12121 2630.6 11442 19787
Waiting: 0 10798 2575.2 10114 18369
Total: 4985 16815 1367.8 16471 24861
Percentage of the requests served within a certain time (ms)
50% 16471
66% 16728
75% 16931
80% 17226
90% 18477
95% 18763
98% 21116
99% 21388
100% 24861 (longest request)
Is there any way to raise
Requests per second: 1.19 [#/sec] (mean)
and lower
Time per request: 16854.999 [ms] (mean)
Here is bigger test:
Keefir-Samolet-iMac:~ jevgenismirnov$ ab -n 5000 -c 40 -e out.csv http://magento.sv/index.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking magento.sv (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests
Server Software: nginx/1.0.11
Server Hostname: magento.sv
Server Port: 80
Document Path: /index.php
Document Length: 21497 bytes
Concurrency Level: 40
Time taken for tests: 4230.975 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 109795470 bytes
HTML transferred: 107505012 bytes
Requests per second: 1.18 [#/sec] (mean)
Time per request: 33847.804 [ms] (mean)
Time per request: 846.195 [ms] (mean, across all concurrent requests)
Transfer rate: 25.34 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 4786 2006.4 5111 37051
Processing: 0 28979 2955.3 28296 39951
Waiting: 0 27638 2904.5 26962 39950
Total: 13425 33765 2189.4 33309 39953
Percentage of the requests served within a certain time (ms)
50% 33309
66% 33829
75% 34390
80% 34915
90% 36747
95% 37618
98% 37962
99% 38306
100% 39953 (longest request)
apache2.conf(prefork is used,only changed settings):
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_proxied any;
gzip_min_length 1100;
gzip_http_version 1.0;
gzip_buffers 4 8k;
gzip_comp_level 9;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
eAccelerator from php.ini:
; eAccelerator configuration ; Note that eAccelerator may also be installed as a PHP extension or as a zend_extension ; If you are using a thread safe build of PHP you must use ; zend_extension_ts instead of zend_extension extension = "eaccelerator.so" eaccelerator.shm_size = "16" eaccelerator.cache_dir = "/var/cache/eaccelerator" eaccelerator.enable = "1" eaccelerator.optimizer = "1" eaccelerator.check_mtime = "1" eaccelerator.debug = "0" eaccelerator.filter = "" eaccelerator.shm_max = "0" eaccelerator.shm_ttl = "0" eaccelerator.shm_prune_period = "0" eaccelerator.shm_only = "0" eaccelerator.compress = "1" eaccelerator.compress_level = "9" eaccelerator.allowed_admin_path = "/var/www/eaccelerator"