Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Linux / Apache / PHP Scalability Issues

Posted on 2009-05-19
2
661 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

860 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