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 apologize in advance if this is a basic question, but I am quite confused after reading the Apache documentation and other tutorials.

Does a single Apache prefork process serve all HTTP requests for a given client? That's what I thought, but when I reduce maxclients down to a low number, my page load times go to a crawl. This despite the fact I'm the only client on the server in question. This would suggest each process serves a single HTTP request at a time, rather than serving all requests within the TimeOut window.

So if a single webpage requires 15 HTTP requests to load fully, do I require 15 prefork Apache processes to optimally serve it?

share|improve this question

2 Answers 2

The way that we typically think about the HTTP protocol, this shouldn't be an issue.

Modern browsers use keep-alive connections, which can only carry one request at a time; in that sense, using MaxClients 1 ought not have an impact, since each request in those connections is completed before the next starts.

However, that's another thing about modern browsers; they use multiple connections. These days, you might get an html page that requires the loading of 40 other resources; images, javascript, css. It doesn't make much sense from an efficiency perspective to pile them all up single-file to send via one connection; instead, they're split up into a handful connections (each of which is still single-file) to fetch concurrently.

I can't find a good authoritative source of information on each browser's behavior, but what I can find suggests that 6 connections is about normal. This is where the concurrency of your server comes into play; each of those 6 connections can concurrently request a resource, acting as 6 different clients from the server's perspective.

share|improve this answer
    
Thank you Shane. So if I understand you correctly, then a modern browser may appear as more than one client to the server because it opens more than one connection at a time. As a hypothetical, a browser that opens 6 persistent concurrent connections to Apache could occupy 6 distinct Apache processes. Each Apache process would fulfill requests from its respective connection and be occupied until the server timeout settings tell the process to stop waiting on the connection. –  user101570 Nov 25 '11 at 18:06
    
This would also imply that #clients doesn't necessarily equal # of distinct visitors, as each visitor may have open multiple clients. If so, is there a way to limit how many concurrent connections any one visitor is allowed to open? Thanks. –  user101570 Nov 25 '11 at 18:10

mpm_prefork will answer to one connection only. If you want apache to serve more than one connection per process you will need to use a multi-thread MPM like mpm_worker.

Modern browser use pipelineing (multiple simultaneous connections) and keep-alive (serialized requests on the same connection) to increase the throughput and network efficiency and to lower the latency. For example Mozilla Firefox can be configured by changing network.http.pipelining and network.http.pipelining.maxrequests in about:config

share|improve this answer

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.