Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a server with 8Cores, 16GB of RAM and RAID 0 SAS 10K drives. Our goal is to use this to serve a fairly simple php application quickly. We have tested all other components and we think we have narrowed it down to apache is our bottleneck.

I am no apache guru I have done some research and tested a couple things but when i test with JMeter launching 100 concurrent connections against the server the first 10 - 20 come back quickly 30 - 100ms but the rest take between 1000ms to 3000ms. Anyone have any ideas on what to change in our apache config to make this faster right now its a vanilla install of apache.

share|improve this question
8  
Unless you place zero value on the data on this server, the RAID 0 should be the first thing you get rid of. –  EEAA Jul 20 '11 at 4:23
    
Can't really help you without your Apache config. –  womble Jul 20 '11 at 4:56
2  
this is not the answer to your question, but a general tip: Use an opcode cacher. Switch to nginx + php-fpm. Use fastcgi_cache, or possibly Varnish to cache, depending on how complex rules you need to determine what to cache, and what not to. –  3molo Jul 20 '11 at 6:52
1  
As ErikA said, get rid of that RAID0 (and if you've got just one disk, for christ's sake get at least one more). They say that RAID 0 means if the disk dies, 0 is the % you'll be able to recover. –  tombull89 Jul 20 '11 at 10:15
    
couple of thoughts - a) use an http accelerator like varnish in front of apache b) unless you need apache's power use nginx or the like c) switch from linux to a BSD or something decent d) post your httpd.conf file in order to help figure out what needs to change e) make sure hat apache is the bottleneck, are your SQL queries slow? your application? You have no idea. f) post what kind of tests jmeter does? does it slam you with lots of small queries? make legit requests? etc. –  Good Person Dec 14 '12 at 15:47
add comment

3 Answers 3

Are you absolutely sure Apache is the real bottleneck for you? You didn't tell anything about your "fairly simple PHP application", but for me it sounds like it's using some database and that starts to slow things down quite soon during your benchmark.

The traditional Apache values you should consider tuning are MaxClients, ServerLimit, MinSpareServers, MaxSpareServers and TimeOut. But most of the time tuning those values is most helpful for static content; PHP and other dynamic stuff is more unpredictable from Apache's point of view. If a PHP script takes five seconds to run and eats 100% CPU, then it takes five seconds to run and eats 100% CPU, no amount of Apache tuning can help that.

What Linux distribution you have in use?

With the powerhouse server like you have Apache should easily serve thousands and thousands of HTTP requests per second with static content; with PHP the number can be much less.

share|improve this answer
add comment

first we should try to determine where is the problem, you said you want to use this server to serve a "fairly simple php application"!?

What do you main by fairly simple, do you use any database ? If yes you should check if your queries are optimized (by example in mysql you can enable the slow_query logger, look at this page : http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html)

You can also check how many time does your php interpreter spend to generate your webpage (depending of what your php scripts do), a good idea to improve the average time to "execute" a php script without a lot of effort is to use apc (enter link description here), check if it has been installed by your package manager (if you use one).

What about your test, did you make them on static content or on your php pages? So could you give more information about your architecture?! There is a lot of way to improve php/apache applications but we need more information :-) about your case

share|improve this answer
add comment

Install a caching Reverse proxy between the web-server and the users, this has the added benefit of also improving security (provided its setup correctly)

Squid

Very good but a little hard to understand but if you want to milk every single ms of time the the investment of time is well worth it

http://www.squid-cache.org/

share|improve this answer
    
Squid is not helping him serve php faster. –  3molo Jul 20 '11 at 6:51
    
@3molo Squid could be used as HTTP accelerator in the same way as Varnish which you recommend using. –  AlexD Jul 20 '11 at 7:09
    
My bad, didnt know squid would cache anything but static content. Upvote coming up as soon as I can –  3molo Jul 20 '11 at 8:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.