Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Mauricio Vergara -
Number of replies: 8

I have a moodle site. Currently we have aprox. 6000-7000 visitors/day. Normally 150-200 request per second arrive to our server. At the begining we divide the load distributing into two servers, the fisrst one (3.2 GHz box with 2 GB) for application and another (4x3.2 GHz and 16 GB Box) for database and moodledata. In addition we have almost 800 virtual classrooms and 700 teachers each one per classroom. We have registered almost 17000 students that we consider potential users for our site. Under this configuration the first box arrive to 95% of cpu usage nd the second one (db server) remains in 40% cpu load. Performance became so bad because there are many http server threads so  we decided to run all (application and database) our stuff into our strong machine (4x3.2 cpus and 16 GB). Actually the box arrives to 90% of cpu load and even it attends request we have so many claims that response time is very bad, especially at peak times (10:00 - 12:00 A.m  | 2:00 - 4:00 P.M) and saturdays when all ours students seem to agree for use intensively moddle platform.

Our httpd conf file have the following parameters

*******************************************************************************

MaxKeepAliveRequests 250
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 10

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 16
MinSpareServers 16
MaxSpareServers 17

********************************************************************************

We are redesigning some of our contents because this is another factor that is affecting our performance. Like system administrator I have probed some configurations until arrive the above that seems to be the best, but I am not glad with the performance of our machine. I have also noted that even proccesor load is fixed in 90% all the time memory is under 5.0 GB's used and the rest is free. This lead me to think that something in my configuration goes bad.

If someone could help us and bring some ideas for improving performance it will be well recognized. Now we consider to upgrade our machine and create a topology that wil include a 2-3 web farm for application and a database cluster.

I expect and thanks your help

 

 

 

Average of ratings: -
In reply to Mauricio Vergara

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Eugene Yap -
For starters maybe you want to check if you are installing any php accelerators as that could help you reduce the processor load significantly for my case it was about 30 to 50% or even more as some others might have experienced. Give the accelerator a try and it might just solve your problem.

And after that you might need to look into upgrading the ram to what best you can afford at the time being as each thread consumes quite some ram which can be quickly drained with large user base.

This is my 2 cents worth
In reply to Eugene Yap

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Mauricio Vergara -

Éugene

I do really appreciate your help. It seems that things are getting better. We improve performace near 60-70%. Average cpu load goes down and now it remains at 40-50%.

 

In reply to Mauricio Vergara

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Eugene Yap -
HI Mauricio

    Care to share how is your load now on the DB server? cos using a php accelerator, it is supposed to reduce the recompile of the php files. Does using the PHP accelerator also reduce your DB load and request?

The other thing, how is the ram usage on your app server? cos although using the accelerator it reduces the processor load, I think your ram might be your next bottleneck as you would be handling more request per min in such a case.

There is also a post in the forum which is very interesting. I think it would be useful for your implementation, http://moodle.org/mod/forum/discuss.php?d=54757


In reply to Mauricio Vergara

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Samuli Karevaara -
You could try setting KeepAliveTimeout  to 2 as mentioned here: http://moodle.org/mod/forum/discuss.php?d=53699. Martin Langhoff has posted other tips on these settings also, you could try searching for his posts on performance tuning for more pointers.

Ps. Nice primary server by the way smile It might be able to handle the traffic you have, but it sounds like a borderline case. In my understanding the ratio between the app/db server specs was too steep in your case, the app server might need more processor power than the db one, but maybe less memory.
In reply to Samuli Karevaara

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Mauricio Vergara -

Thanks for your suggestion. It helps us to solve our problems. Now moodle plattform is going better.

 

In reply to Mauricio Vergara

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Ralph Patterson -
I am likewise (per my host) hitting 100% cpu useage.  I have a mere 50 students attempting to access the database.  I have to make some configuration changes or my host is going to suspend my account permanently.  Any and all suggestions appreciated.

Thanks.
In reply to Ralph Patterson

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Rodrigo Velazquez -

 Maybe this script help you

 $contsleeps=0;
$maxConSleep=50;


 $myrsdbg = get_records_sql("SHOW FULL PROCESSLIST");
 if($myrsdbg){
   foreach($myrsdbg as $rsdbg){
    if($rsdbg->Command == "Sleep" And $rsdbg->db == 'moodleDB' And $rsdbg->Host == 'localhost' And $rsdbg->Time >= 10 ){
     $contsleeps++;
    }
   }
   unset($rsgbd);
   if($contsleeps > $maxConSleep){
     foreach($myrsdbg as $rsdbg){
       if($rsdbg->Command == "Sleep" And $rsdbg->db == 'moodleDB' And $rsdbg->Host == 'localhost' And $rsdbg->Time >= 15 ){
          $sql = "KILL ".$rsdbg->Id;
          execute_sql($sql, false);
       }
     }
     unset($rsgbd);
   }
   unset($myrsdgb);
 }

Kill sleping process if there is $maxConSleep in that moment

In reply to Mauricio Vergara

Re: Tuning a fedora 4.0 under a 4 proccesor & 16 GB RAM

by Richie Foreman -
Additionally (at least in my experience), your startservers/max/min seems to be somewhat of a low number for the amount of volume you say that you have. You could be getting alot of overhead from forking apache processes (something that happens when a moodle site is hit pretty heavy.