Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm optimizing a site by using lighttpd for the static media. I've found that a recommended solution is to use Apache Proxy to point to the lighttpd server. But, does that use up an Apache thread/process per request?

In my setup, I've noticed that all my processes are used up, even though they aren't doing anything, CPU wise. To free up apache processes, I've configured lighttpd and the amount of processes needed is lowered significantly, Munin shows.

However, I've set it up to connect directly to lighty, to prevent apache workers from being occupied by serving static media. My question is: when using Apache Proxy, does that also use up a process/worker per request?

share|improve this question
up vote 1 down vote accepted

Generally you do this because apache processes take as much memory as the largest script that has run in them. So with lots of connections you have a lot of memory taken up unnecesarily, limiting the number of simultaneous connections that you can deal with. Even if you were to use a seperate apache instance for static files you would see the benefit.

it is not so much about scripts blocking processes but making best use of resources.

share|improve this answer
That's right, I can see that with even higher pageviews/min than normal, fewer apache processes are needed. And every process is 50 MB, so if every image request needs a 50 MB process, it takes up resources. And on a 2GB machine, there was about a max of 40 processes. But, my main question still isn't answered: when you use apache proxy as opposed to connecting directly to lighttpd, does it still use/spawn one of those 50 MB apache processes for every request it forwards to lighttpd? – Halfgaar Jan 15 '11 at 14:23
yes i think the way you suggest would still spawn processes. You would want to use lighttpd as the proxy. You may also want to take a look at nginx as an alternative. – JamesRyan Jan 15 '11 at 15:03

I don't buy it. There would be some advantage in this configuration for serving memory-hungry php scripts, but properly-tuned Apache can serve static files very efficiently. Adding even a lightweight web server is just adding overhead.

The exception might be if you are large enough that the static files are actually coming from a whole different machine — then a proxy frontend delegating requests is sensible. (Although at that point you might want to use Varnish.)

share|improve this answer
I can clearly see that now that static content is served by lighty, there are more apache threads available for the dynamic content. The site is fater as well. Serving the static media, to slow peers for instance, can hog up a process, right? That was the background of my question, because if using proxy would still take a process per file to transfer, it would be useless. – Halfgaar Jan 14 '11 at 13:13

Your Answer


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.