Solved

Linux / Apache / PHP Scalability Issues

Posted on 2009-05-19
2
658 Views
Last Modified: 2013-12-16
Hi,

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

 
0
Comment
Question by:Nabilbahr
2 Comments
 

Author Comment

by:Nabilbahr
ID: 24428133
I am inclding snapshot of XCache Admin Page and Server Disk Usage
xcache.jpg
server.jpg
apache.jpg
0
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 500 total points
ID: 24443240
Hi,

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
</IfModule>

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.

Cheers,
K.


0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question