Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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"
share|improve this question
    
The short answer is "yes. make the application run faster". Try giving some details about your setup, like what version of x the config of x etc. –  AD7six Feb 23 '12 at 8:52
    
Please check updates –  Jevgeni Smirnov Feb 23 '12 at 9:30
    
Your updates do not even include the version of php you are using –  AD7six Feb 23 '12 at 9:36
    
Versions added. –  Jevgeni Smirnov Feb 23 '12 at 10:36

1 Answer 1

up vote 0 down vote accepted

With that CPU, the best figure you'll get for TPS/RPS is about 5. You've got old hardware, so high concurrency isn't something you'll ever have. But you can lower page load times by working on template performance instead (spriting, combining css/js etc.)

For your testing, drop Nginx for the time being. As you are purely testing PHP throughput, Nginx (and its configuration) is getting in your way.

Focus on the Apache and PHP configuration itself.

A few starter tips:

  1. Increase the SHM size for PHP (be sure to increase the ulimit first)
  2. Disable Apache keepalives (Apache is not serving anything other than 1 dynamic request when using Nginx, so keepalives are slowing things down).
  3. Lower the compresion level to about 7 with Eaccelerator, its adding CPU overhead (which you don't have)

But if I'm honest, on a P4 with 1.2GB RAM - you're never going to get great results :(

share|improve this answer
    
Ok. I'v took your notes to consideration. Yes Hardware is old :), but it is just test ground with ca 500 visits/week, lol :) –  Jevgeni Smirnov Mar 12 '12 at 9:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.