-4

I have a LAMP server with following configuration -

  • 32 Bit OS Debian Etch
  • Apache 2.2
  • PHP 5.2
  • MySQL 5.0.32

Hardware

  • 3 GB memory
  • 2 Intel(R) Xeon(R) 1.86GHz CPUs

Each Apache process taking around 10mb mememory. Apache access log is disabled. Apache, MySQL and PHP is installed using apt-get.

Peak of numbers of hits per second of Apache is 415 hits / seconds

Need to know if its too much for the as my Apache needs a restart every half hour due to memory used up and swapping.

What can be possible wrong with it, please help ....

Adding Apache configuration :

Timeout 300
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild 100
</IfModule>
<IfModule mpm_worker_module>
    StartServers          4
    MaxClients          600
    MinSpareThreads      50
    MaxSpareThreads      150
    ThreadsPerChild      25
    MaxRequestsPerChild  0
</IfModule>
Pawan
  • 123
  • 1
  • 5
  • 2
    First of all, I suggest you upgrade to a more recent version of Debian. Security updates for etch have been discontinued since February 2010. – Oliver May 07 '12 at 05:26

3 Answers3

1

ps/top sort of lie about memory usuage. You are seeing each process use 10megs of memory idle but apache loads a ton of shared libraries up and each process might be using 9meg of shared libraries. So your real usage might be the 9megs of shared libraries (assuming none are already loaded) + like 1-1.5meg for each process running.

But to answer your question.. how can we help tune anything if you don't show configs and what you are seeing as wrong.. Also memory/cpu is really taken up on run time of the application.. If your app is a memory hog.. nothing apache configs can do to fix that.

Here's what I'd do with knowing nothing about your system. Increase the number of clients it can accept. Make sure keepalive is off or if you need it on set the timeout very small.. 2-3 seconds.

Mike
  • 22,310
  • 7
  • 56
  • 79
0

At least post your phpinfo(). Or httpd.conf/php.ini. You can use jsfiddle to dump the phpinfo() (i recommend removing anything like domains or names of servers before you post it to the world) and pastebin for your httpd.conf / php.ini.

With the information given there is little we can do to try and help out. You can try and remove unused modules and reduce the amount of memory required for each instance of PHP inside the php.ini file as a first step.....

httpd.conf can usually be found in /etc/apache2/conf/httpd.conf

php.ini can usually be found in /etc/php/php5/php.ini

Or something similar to that, depending on how you compiled sources.

And if your having to restart your apache every half an hour to get things working again, there may be something wrong with the application your trying to run, it may be using to much memory, or you have to many shared lib's installed.

Mattisdada
  • 57
  • 1
  • 2
  • 16
  • What your asking is akin to this: "Hey i got this sound recording of my car on my dumb phone, whats wrong with my car?". Its very hard to diagnose :) – Mattisdada May 07 '12 at 04:09
0
  1. Upgrade to Debian Squeeze. Etch has been unsupported for some time, and won't be getting security updates. Security updates which are particularly important if you're running PHP.
  2. Upgrade/replace the 32bit OS with a 64 bit OS if possible.
  3. Put in more RAM. RAM is cheap. (8-16GB is a more realistic number)
  4. Install APC Opcode Cache for PHP.
  5. Edit your question to show us your php.ini file. Seriously.
Tom O'Connor
  • 27,480
  • 10
  • 73
  • 148