Linux / Apache / PHP Scalability Issues


We are having speed and scalability issues with our website hosted in LAMP environment. As i am new to Linux / Apache i am copying server related data here. Please let me know what i can do to imrove the scalability and speed of PHP scripts:

Current Memory Usage
                total           used           free         shared    buffers     cached
Mem:       3369064    3155716     213348          0     239616    2358752
-/+ buffers/cache:     557348    2811716
Swap:      4192956         68    4192888
Total:     7562020    3155784    4406236

Current Disk Usage
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             222G   15G  196G   7% /
/dev/sda1             251M   21M  217M   9% /boot
tmpfs                 1.7G     0  1.7G   0% /dev/shm
/usr/tmpDSK           485M  460M     0 100% /tmp

Following is statstics from XCache
Caches: - Slots Size Avail % Clear Compiling Hits Misses Clogs OOMs Protected Cached Deleted GC
php#0 8.00 K 64.00 M 36.81 M        no 83,690 985 10 0 no 976 0  
php#1 8.00 K 64.00 M 38.20 M        no 111,389 1,005 10 0 no 999 0  
var#0 8.00 K 8.00 M 7.97 M        - 0 0 0 0 no 0 0 29

Who is Participating?
Kerem ERSOYPresidentCommented:

From what you've posted here I can not see any problem. It seems that your memory is OK. IT is normal that buffers take up so much space and levave very little free memory. But then again they are usable.

Data from your caches are also OK they say that you get 112556 hits but 1046 misses and 1040 of thm placed in the cache while your cache still runs at 60%.

Also your SWAP is empty if it was full it would indicate that you had semoe memory issues but my view on memory is also supprted by this also.

When it comes to your Web Statistics. IT indicates taht more than 18 hours of runtime and CPU is sitting idle 91 % with all the activity happens in apache (60 %) with 1,5 % System activity.

It also shows that there are 40 instances with stiell one request needs andother instance so that there's a new creation request.

I'll suggest you to install the package called systat. anc check sar and iostat activity. I wonder how much oh the 60% activity is consumed by HTTP and how much of it requesting file I/O. When you launch iostat the first row will give you the cumulated average actvity like sar.

In fact I guess that you must have your bottlenecks on server instances. You might like to reduce the numbers in your apache configuration. The initial server instances and minimum available sparse servers.

<IfModule prefork.c>
StartServers            100
MinSpareServers    40
MaxSpareServers   80
ServerLimit      1024
MaxClients       2048
MaxRequestsPerChild  4000

Also your keepalive settings. It seems that al your instances are at the keepalive. (waiting for additional requests for each instance) Shorten them:

MaxKeepAliveRequests 20
KeepAliveTimeout 15

After you've installed the systat package check iostat also and if you feel there's a bottleneck in I/O then install additional hard disks with disk striping so that it would speed up the I/O.

yum install sysstat

iostat 5 5

sar -q 5 5

Please note the runq-sz column in sar it should be aorund 0 - 2 in an mildly loaded system but greater on busy systems.


NabilbahrAuthor Commented:
I am inclding snapshot of XCache Admin Page and Server Disk Usage
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.