LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-30-2010, 04:39 PM   #1
Hammad101
Member
 
Registered: Dec 2005
Posts: 72

Rep: Reputation: 15
Help Optimizing Apache Server


Hi,

I was hoping someone could help me with optimizing my webserver.

Hardware
- Intel Q8300 2.33 GHz
- 2GB RAM
- 100 Mbit

Code:
Timeout 300
KeepAlive On
MaxKeepAliveRequests 200
KeepAliveTimeout 15

<IfModule mpm_prefork_module>
    StartServers          15
    MinSpareServers       10
    MaxSpareServers      15
    MaxClients           256
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          4
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>
Ok this might get a bit messed up ... but basically..

When someone visits the site, the connection should be terminated in 30 sec and if he wishes to further browse reconnected.

Any more suggestions on how i can maximize output, the more users server can entertain the better.

on peak times i get around 2000 visitors, so any tips on how to compensate the most..

Awaiting your suggestions/replies
Regards
 
Old 10-30-2010, 07:15 PM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
Does this server host any other services as well as apache or is just a web head? Is that 2000 connections simultaneously or over a time period? Are the visits to your site extremely short in nature?

Regards,

Alunduil
 
Old 10-31-2010, 03:10 AM   #3
Hammad101
Member
 
Registered: Dec 2005
Posts: 72

Original Poster
Rep: Reputation: 15
Its a web-server it will have 2 websites that are actually view by people and some dormant domains for future.

1) High Traffic Site
2) Its very low traffic

I'll give you an idea of why i want the 30 sec time.

Visitor comes to find that either my site requires registration or that particular thing isn't Free and leaves.

Now,simultaneously on peak times i get upto 1.5-2 K visitors at once (thats were above statement comes in play) and 50% will leave within 30 sec , and rest will proceed.

So, I hope you get my point.

Regards,
 
Old 10-31-2010, 08:13 AM   #4
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
The first thing I see that you may want to change for that setup is dropping the KeepAliveTimeout to 3 seconds and increasing the MaxRequestsPerChild to at least 2000. The keepalive timeout is for how long to keep a connection alive for subsequent requests (which is what you're worried about with the visit and leave. The max requests per child is how many requests a child process (which are a lot more expensive to create and destroy) will handle before dying.

Beyond that, you'll unfortunately need to run it and watch your usage or benchmark it for the traffic you expect. Do you have PHP running on these websites or mysql? Those are always the things that need to be optimized long before apache on busy sites.

Regards,

Alunduil
 
Old 10-31-2010, 08:47 AM   #5
Hammad101
Member
 
Registered: Dec 2005
Posts: 72

Original Poster
Rep: Reputation: 15
Hi,

Its a vBulletin forum.

PHP & MySQL are neck deep in this.

Code:
# ab -n 1500 -c 15 {URL}

Concurrency Level:      15
Time taken for tests:   209.718 seconds
Complete requests:      1500
Failed requests:        1110
   (Connect: 0, Receive: 0, Length: 1110, Exceptions: 0)
Write errors:           0
Total transferred:      200722142 bytes
HTML transferred:       199888277 bytes
Requests per second:    7.15 [#/sec] (mean)
Time per request:       2097.184 [ms] (mean)
Time per request:       139.812 [ms] (mean, across all concurrent requests)
Transfer rate:          934.67 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1  15.2      0     274
Processing:   970 2092 236.1   2097    3226
Waiting:      957 2033 228.9   2037    3148
Total:        970 2093 236.8   2097    3500

Percentage of the requests served within a certain time (ms)
  50%   2097
  66%   2188
  75%   2247
  80%   2284
  90%   2389
  95%   2459
  98%   2556
  99%   2620
 100%   3500 (longest request)
Peak Load was 20 .. ish
Peak RAM Usage was < 800 MB
Site Seemed to be accessible during benchmark at normal speeds.

Thank you alunduil!

Any tweaks on PHP/Mysql will be appreciated.

Regards

Last edited by Hammad101; 10-31-2010 at 09:00 AM.
 
Old 10-31-2010, 09:10 AM   #6
AsadMoeen
Member
 
Registered: Jun 2010
Posts: 160

Rep: Reputation: 3
Apache actually doesn't matter in most of the cases.

What uses most of your RAM/CPU is the number of SQL queries. Here you can see how to optimize MySQL for performance :

http://www.directadmin.com/forum/sho...p?threadid=132
 
Old 10-31-2010, 09:24 AM   #7
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
The easiest tweak to PHP is installing APC and then playing with the shm size until it's getting you a nice 99% hit rate. MySQL takes a bit more finesse to get running correctly but a good START is mysqltuner.pl (wget mysqltuner.pl).

Regards,

Alunduil
 
Old 10-31-2010, 01:24 PM   #8
Hammad101
Member
 
Registered: Dec 2005
Posts: 72

Original Poster
Rep: Reputation: 15
Thank you both!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
optimizing apache 2 schentor Linux - Software 2 09-08-2006 09:31 AM
Optimizing Apache SiLiCoN Linux - Networking 2 06-15-2005 02:56 AM
Optimizing Apache on a Budget phlyersphan Linux - News 3 04-08-2005 10:40 AM
optimizing apache alaios Linux - Networking 0 10-16-2004 12:08 PM
Apache optimizing Hamma Linux - Software 8 12-08-2003 07:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration