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.

I'm looking for ways to optimize our current web server hosted in-house. I'm trying to supply as much relevant information below. Please let me know if you would require additional information in order to assist.

Server is running 1 single website, which is an online pizza ordering platform built on Zend Framework (ver1). On traffic stats from the last month aprox 6.000 pageloads per day, concentrated mainly around dinnertime. Around 1500 loads/hour peaks in that period.

We recently upgraded from a 2/2mbit aDSL-line to 100/100mbit fiber, and we still have performance issues at dinner time. We assumed the 2mbit was the issue. Website is pretty snappy in low-load periods.

Hardware

CPU: Intel(R) Xeon(R) CPU            5160  @ 3.00GHz (3000.13-MHz K8-class CPU)

Mem: 328M Active, 4427M Inact, 891M Wired, 244M Cache, 623M Buf, 33M Free
Swap: 16G Total, 468K Used, 16G Free
(6GB physical, 16GB swap)

Filesystem   Type     Size    Used   Avail Capacity  Mounted on
/dev/ad7s1a  ufs      4.8G    768M    3.7G    17%    /
devfs        devfs    1.0K    1.0K      0B   100%    /dev
/dev/ad7s1g  ufs      176G    5.2G    157G     3%    /home
/dev/ad7s1e  ufs      4.8G    2.8M    4.5G     0%    /tmp
/dev/ad7s1f  ufs       19G    3.5G     14G    19%    /usr
/dev/ad7s1d  ufs      4.8G    550M    3.9G    12%    /var

Server OS

FreeBSD 8.2-RELEASE

Software

apache-2.2.17
php5-5.3.8
mysql-server-5.5

Apache footprint (example, taken from # top)

31140 www              1  45    0   377M 41588K lockf   2   0:00  0.00% httpd
31122 www              1  44    0   375M 35416K lockf   2   0:00  0.00% httpd
31109 www              1  44    0   375M 38188K lockf   2   0:00  0.00% httpd
31113 www              1  44    0   375M 35188K lockf   2   0:00  0.00% httpd

Apache is using the prefork MPM, APC (Alternative PHP Cache). SSL module is loaded, but not utilized (as in don't really work, thus not used). There is a file containing settings for MPM modules, but as i see it's not included in the httpd.conf file, the include line is commented out. Thus i would guess that the prefork MPM is working of default values too.

Here are some other Apache conf values that i found - which are included in https.conf

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

UseCanonicalName Off
HostnameLookups Off

Load when experiencing performance issues

enter image description here

Note: API requests to backend

As for our online platform, it communicates with our backend system through an API (GET/POST). For price-quotes on baskets (cached until new item added), products (cached), prices on products (cached). And the backend-server is actually showing real load when seeing performance issues on the web apear. So i'm more striding to that it's the API requests that is taking forever to complete, thus holding up clients at the web server. So my question is, is the stats given above (traffic/load), and the current config of the software. Compared to the specs of the internetconnection and the hardware, is that signs of a stressed server? And would i be able to increase max number of clients on the web server, based on the available resources and the actual footprint of Apache?

share|improve this question
1  
Have you monitored the server load and ram usage (using 'top' command) during both heavily loaded times and normal times? is the database (i assume there is one) hosted on the same server? –  user16081-JoeT Oct 15 '12 at 22:57
3  
what performance issues are you experiencing? –  Alastair McCormack Oct 15 '12 at 23:09
    
What firewall are you using, if any? –  Toquonce Oct 15 '12 at 23:19
    
@Toquonce What do you think a firewall would be doing to cause this?? –  Chris S Oct 16 '12 at 3:23
    
@Chris S : I don't know what performance issues the user is experiencing, but I know pf has default limits that could potentially be reached under very heavy load, such as the state table being exhausted, which would cause connections to drop. Since FreeBSD was mentioned, pf could be used and possibly interfering. Unlikely, perhaps, but nothing should discounted. –  Toquonce Oct 16 '12 at 3:48

4 Answers 4

Web site performance is a big subject. From what I see the problem is most likely not Apache.

There are a few things that can help you to improve your performance though.

  • Caching! I do not know how much you cache in your PHP code. But as you're not using SSL and I guess you have a lot of read-only data, try Varnish

  • Enable mod_expires

  • Profile your website/backend API with JMeter

share|improve this answer

No, the above are not signs of a stressed server.

While you might be experiencing network I/O saturation (since you provide no actual data on it), this is extremely unlikely with so few actual requests occuring during peak times.

You need to run some tests on the HTTP backend to see if that is running at max capacity. If it is, then you need to fix THAT.

For future reference, you should configure and use the server-status handler to monitor apache, as documented here: http://httpd.apache.org/docs/2.2/mod/mod_status.html

share|improve this answer

Apache performance can be tweaked with Worker MPM and Prefork settings, altering the keepalive and max spare threads could help in increase of performance and consumption of less memory footprint, You can find the optimal setting for Prefork and worker from here

share|improve this answer

You may be running out of processes (defined by MaxSpareServers and StartServers). The default is only 10, so if your response times are high, that may not be enough for one request every 2 seconds (1500 / hour).

Turn on the server-status module to monitor the processes in use. Make sure you set access rules so that this is only accessible internally.

share|improve this answer
1  
-1 That's 10 Spare Servers, not the maximum number of servers, MaxClients defines the maximum number of servers, which defaults to 256. –  Chris S Oct 16 '12 at 3:18
    
Yep, I blew it on this one :( –  AngerClown Oct 20 '12 at 12:37
    
It defaults to 2048 on apache > 2.2.22; regardless, he should be using worker instead. –  adaptr Oct 23 '12 at 12:43

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.