Link to home
Start Free TrialLog in
Avatar of amsouza
amsouza

asked on

Apache22

Hello,

I'm using apache 2.2 with freeBSD. The problem is that the load of the servers are always above 3. I wonder if I can reduce this load, or at least know if my problem is hardware.

Thanks,

Armando
ASKER CERTIFIED SOLUTION
Avatar of Pieter Jordaan
Pieter Jordaan
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of frankcheong
frankcheong

Before you can reduce the load, you have to have an idea on which program is generating the load and what kind of loading are you facing.

For you can use the top program to monitor which program consume most CPU and memory resources.
Avatar of madunix
Root cause of high usage could be looping process, application performing cpu intensive operation(s), paging due to process size exceeding resident memory (RAM), excessive logging..etc.
On unix system run the commands "vmstat, top, iostat, free, sar"  to give you a top like display of memory totals, paging amount, swap numbers, interrupts per second and much more. they are useful to determine where the performance bottleneck is on a machine.
mad unix is correct about the commands , as freebsd is damn good out of the box , the following command would probably give you the best chance to find out whats causing it "top" will tell you current memory/swap usage, also whcih processes are using the most resources, "netstat -na" tell you all current running processes, also a great one for bandwidth usage is "iftop" even get back to us with output of the above commands.
i will assume apache is the cause of the load

- a load of 3 is not that high on machines with 4 CPUs or more
unless the site is really slow, and the top shows 0% idle time processor, you may not need to bother

- if the idle is not 0, the load is probably liked to weird connectivity or io shortage. use gstat to determine wether your disk is limiting or not. if it is, adding some ram to help the cache might be an idea, switching to a raid array might be as well (forget raid5, use zfs if you have 4G of RAM or more and your system is amd64, otherwise, stick to geom)

- if you have connectivity problems, i guess you already saw symptoms

- if you run modphp modperl modruby or whatever server-side scripting as an apache module, your script is probably the cause of the load. you probably want to check the site offline in order to findout which page is provoking the load.

- apache will perform better using both prefork and threading mixed together. the number of running processes should be about 2.5 the number of CPUs, but they may have many threads. obviously, if you do not need apache-specific features, try one of the fast webservers out there such as lighttpd

can't help more if you do not tell us more
i just forgot to point out as this is obvious, but if your system swaps, forget about any of my or others comment and tune your soft or add ram to correct the problem. you should probably still have about 20 or 25% of the ram free during high loads