Re: memory comsumption in Apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/29/06, Xuekun Hu <xuekun.hu@xxxxxxxxx> wrote:
hi,

I'm trying to predict how many memory should be used with Apache2.2.3
(worker) + Linux2.6.x. This setup is only serving static content, and
trying to serve 10000 simultaneous users (about 10000 connections,500
simultaneous requests at the same time).

I have several questions below.
1. How many memory is used for holding one connection across software
layers (including kernel TCP/IP stack and apache)?
2. How many memory is used for holding one request across software
layers (including kernel TCP/IP stack and apache)?

The best way to answer these questions is by experimentation, because
they will vary so much depending on your individual setup.  Measure
total memory usage (using top or equivalent) without apache running.
Then measure it again under simulated load and take the difference.

I doubt you'll find any difference between the memory needed for a
connection and the memory needed for a request.  Apache holds one
thread for each connection, so there is no memory benefit to idle
connections (unless you are using the event mpm).

3. If memory is exhausted and total connections are not exceeded the
MaxClients limit (that means Apache will return no mem), what happens
if a new connection coming? Apache send "503" or "500" error? And also
what happens if a new request coming in a keepalived connection?
Apache send "503" or "500"? Does Apache have a pending handling
mechanism (I mean holding the connection or request till memory is
available, and not sending error message to clients) when out of
memory?

In reality, you should never let that happen.  If apache exhausts
physical memory, the kernel will start to use swap space, which will
cause disk thrashing that will completely kill your server.  You need
to restrict MaxClients so apache never exceeds physical memory.

Apache does not send 503s in any default config.  This is because, in
order to send a 503, you need to have a process/thread available to
answer the request and send the error message.  But if this
process/thread is available, you might as well use it to send the
requested content rather than the error message.

Apache uses the OS listen queue to handle requests above MaxClients.
See the ListenBacklog directive.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux