LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 01-07-2010, 10:40 AM   #1
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
Question Working with Tuning Apache


Hi All,

I'm looking at tuning our apache set-up. I see people have given ideas into how you might work out the maxclients your webserver can handle. To do such a thing they say you need to know the amount of memory required per apache process. I'm wondering if people work this out by simply looking at the top output for currently running http processes and looking at the RES column to see amount of MEM the process is using? Or what method is correct to become as accurate as possible?

I'm also reading and thinking i should be changing the maxkeepalivetimeout from default 15s to about 2-3? Perhaps above that with webservers that provide shopping results which on occasions might take longer than 5 seconds to process, i'm wondering how playing with this setting might effect the shopping type environment. IE
User clicks and starts waiting for there shopping result to be processed and return to them, all the user see's is a page saying loading (just a graphic thingy), thus if 5 seconds was the setting of this timeout and the shopping results hadn't returned within that time, is there the possibility that then the connection is closed and thus the results couldn't be returned at all??

Thanks,
M

EDIT:-
maxkeepaliverequests - Can someone provide a better explanation of exactly what this relates to other than what the CORE apache doc directive says... I assume a persistent connection is classed as a single client connection which runs for the length of time it take until keepalivetimeout has been reached

Last edited by helptonewbie; 01-07-2010 at 11:23 AM.
 
Old 01-09-2010, 02:25 AM   #2
janoszen
Member
 
Registered: Oct 2009
Location: Budapest
Distribution: Mostly Gentoo, sometimes Debian/(K)Ubuntu
Posts: 143

Rep: Reputation: 22
Keepalive

You misunderstand keepalives. The timeout starts after the request has finished. If you experience sitting in front of a blank screen, you might turn it off completely. Otherwise, you need to analyse what the bottleneck is.
 
Old 01-10-2010, 02:03 PM   #3
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
Ahh cool, yes i knew it was to do with that. I wanted to make sure it wasn't on just communications going through the persistent connection or if it was at the point the request had been completed if that makes sense. Thats cool so it doesn't matter if the request took over 20secs because the timeout will only begin once the entiraty of the page has completed loading... I'm not sure that is absoulutely true... or it leaves and interesting insight, if a web page contains javascript that is continually polling the web server this could mean the connection never ends and thus could quickly reach the maxclients. (Interesting.. something i just thought of as a possibility in my case i think!)

A webserver doesn't know what is going to be asked for by the client, but during a normal loading of a page anything thats requested will be requested pretty quick, and the server doesn't satrt counting down until the request is fulfilled?!?, i think that can't be correct, if the client disappears before the request was complete this could leave a never ending connection and client used?!? thats why i beleive it to be transmission over a persistent connection basis rather than completed handshake as i believe is stated in the keepalive docs on apache with regard to the whole reason this timeout is in place.

Sod all this, I ask whats a great book on apache to teach performance tuning and clustered performance environments etc, even great it it give details on big company set-ups like google and facebook, although i've read up a little on these already...? I'll buy and read, i've looked about on amazon but not seen anything to meet my particular needs.

I'd be particularly interested in it being up-to date book and in depth!
Cheers all,
M

Last edited by helptonewbie; 01-11-2010 at 05:00 AM. Reason: Edited my writting "java" instead of "javascript"
 
Old 01-10-2010, 03:22 PM   #4
janoszen
Member
 
Registered: Oct 2009
Location: Budapest
Distribution: Mostly Gentoo, sometimes Debian/(K)Ubuntu
Posts: 143

Rep: Reputation: 22
Quote:
Ahh cool, yes i knew it was to do with that. I wanted to make sure it wasn't on just communications going through the persistent connection or if it was at the point the request had been completed if that makes sense. Thats cool so it doesn't matter if the request took over 20secs because the timeout will only begin once the entiraty of the page has completed loading... I'm not sure that is absoulutely true... or it leaves and interesting insight, if a web page contains java that is continually polling the web server this could mean the connection never ends and thus could quickly reach the maxclients. (Interesting.. something i just thought of as a possibility in my case i think!)
I believe you are talking about JavaScript. And yes, if you have a keepalive timeout of 5 secs and your JS polls the server every 2 seconds, it blocks the server as long as the maximum number of keepalive requests are reached. Remember, Apache doesn't think instead of you, it's your job to configure it so it suits your environment.

Quote:
A webserver doesn't know what is going to be asked for by the client, but during a normal loading of a page anything thats requested will be requested pretty quick, and the server doesn't satrt counting down until the request is fulfilled?!?, i think that can't be correct, if the client disappears before the request was complete this could leave a never ending connection and client used?!? thats why i beleive it to be transmission over a persistent connection basis rather than completed handshake as i believe is stated in the keepalive docs on apache with regard to the whole reason this timeout is in place.
If the client disappears, the TCP connection is closed by a TCP RST packet, which immediately terminates the connection.

Quote:
Sod all this, I ask whats a great book on apache to teach performance tuning and clustered performance environments etc, even great it it give details on big company set-ups like google and facebook, although i've read up a little on these already...? I'll buy and read, i've looked about on amazon but not seen anything to meet my particular needs.
There is no need to buy a book, there is a lot of information to dig up in the Internet but with guesswork and without knowing about the underlying protocols you won't get far anyway. There are no golden rules of Apache tuning, you need to know what you're working with down to the operating system level if you are working as a sysadmin. You might want to read up the official docs first.

Last edited by janoszen; 01-10-2010 at 03:24 PM.
 
Old 01-11-2010, 06:22 AM   #5
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
Quote:
Originally Posted by janoszen View Post
I believe you are talking about JavaScript.
Yes my bad, thanks!

Quote:
Originally Posted by janoszen View Post
if you have a keepalive timeout of 5 secs and your JS polls the server every 2 seconds, it blocks the server as long as the maximum number of keepalive requests are reached.
Apache Doc - MaxReqPerChild - suggests that:
Note
For KeepAlive requests, only the first request is counted towards this limit. In effect, it changes the behavior to limit the number of connections per child.
Also I understand that the timeout begins to count down when the last request was received which does make good sense.

Quote:
Originally Posted by janoszen View Post
There is no need to buy a book - no golden rules of Apache tuning
Thanks for the link i've already read through that performance doc previously and am taking on board its points and has been partly the reason i've looked into keepalives a little as well. I'll admit there are other areas of the doc I do still need to read!

Is there no book you can suggest, i think they can be really useful sometimes and certainly create other angles to look into? Absolutely agree with you on the golden rule front, that's why i'm going through this slow and steady process. Similar process that needs to happen with most things... MySQL/PHP included!
 
  


Reply



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
apache tuning question: prefork.c vs worker.c BrianK Linux - Networking 10 02-09-2012 01:42 PM
Linux-Apache Fine Tuning for Mod_Perl Full Time Staff Needed-Telecommute mkevitt LQ Job Marketplace [Archive] 5 07-12-2009 04:13 AM
Tuning Apache with Reverse Proxy Betzie Linux - Newbie 0 02-22-2009 03:46 PM
apache performance tuning sachin1361 Linux - Enterprise 1 03-05-2007 06:19 AM
Apache & MySQL keep becoming unresponsive, tuning? chotgor1 Linux - Software 2 11-03-2004 12:37 PM

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

All times are GMT -5. The time now is 12:37 AM.

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
Open Source Consulting | Domain Registration