Forum Moderators: phranque
But what exactly is a connection? Is it one page hit, or one page hit plus a few seconds, or one connection for the page hit and one for each image hit?
What I'm trying to determine is if it's a fluke event that I can prevent in the future by reworking my content or if it means my traffic is reaching a level where I need to consider upgrading my hosting package.
An analogy is that you dial a client's phone number and he answers and says "Hello." this establishes a connection (TCP/IP). You then discuss a business contract, bartering back and forth (HTTP). If you then conclude your business dealings and begin to talk about playing golf next weekend, then the "TCP/IP connection" is a keep-alive connection, and you have used it to conduct two HTTP transactions (contract discussion and golf discussion). The alternative, if your phone system did not support keepalive, would be to hang up after discussing the business contract, and then call him right back to discuss golf.
OK, that analogy is a bit of a stretch, but I hope it illustrates the basic idea.
My first guess, based on your statement about having to have the host "clear" your connections is that you have set the timeout on persistent connections (keepalive) to a value that is too high/too long.
See the Apache core directives KeepAlive, KeepAliveTimeout, and MaxKeepAliveRequests. Shorten the timeout to half its current value and/or reduce MaxKeepAliveRequests slightly, and see if that helps.
Basically, a non-keepalive connection contains one HTTP request - One request for a page or an image, etc. If keepalive is enabled, then the connection persists and can be used for another page/image request once the initial request is satisfied. This eliminates the overhead of having to set up a new TCP/IP connection for each HTTP request, but leaves the connections active even after the entire page has finished loading. These persistent connections are then closed only after the timeout period. In some cases, they're left active for several minutes, which can be a real waste if your pages load fast and most of your visitors are using DSL, cable, or fast optical connections.
I'd suggest setting the keepalive timeout to no more than four times your average page load time, just to account for occasional internet slow-downs. However, there is no single "correct setting" and finding the right setting is largely a matter of experimentation and testing.
Jim
Apache httpd.conf can "include" other configuration files, such as conf.d, etc. You'll have to take a look around and see if you can find any such includes and the files that they refer to .
Jim
This server is Apachi only, SQL is on another server which is cross connected.
I am looking for a way to maximise my hardware (2 dual core 3.2 xeons and 4GB Ram), as I am locking up Apachi when I max out connection.
Any suggestion here?
this is our current settings:
KeepAlive On
Timeout 15
MaxKeepAliveRequests 64
KeepAliveTimeout 15
StartServers 14
ServerLimit 650
MaxClients 600
MinSpareThreads 10
MaxSpareThreads 20
ThreadsPerChild 64
MaxRequestsPerChild 1000
Thanks
[edited by: kamikaze_Optimizer at 7:35 pm (utc) on June 24, 2008]