Leslie Mikesell <[EMAIL PROTECTED]> writes:
> I agree that it is correct to serve images from a lightweight server
> but I don't quite understand how these points relate. A proxy should
> avoid the need to hit the backend server for static content if the
> cache copy is current unless the user hits the reload button and
> the browser sends the request with 'pragma: no-cache'.
I'll try to expand a bit on the details:
> > 1) Netscape/IE won't intermix slow dynamic requests with fast static requests
> > on the same keep-alive connection
>
> I thought they just opened several connections in parallel without regard
> for the type of content.
Right, that's the problem. If the two types of content are coming from the
same proxy server (as far as NS/IE is concerned) then they will intermix the
requests and the slow page could hold up several images queued behind it. I
actually suspect IE5 is cleverer about this, but you still know more than it
does.
By putting them on different hostnames the browser will open a second set of
parallel connections to that server and keep the two types of requests
separate.
> > 2) static images won't be delayed when the proxy gets bogged down waiting on
> > the backend dynamic server.
Picture the following situation: The dynamic server normally generates pages
in about 500ms or about 2/s; the mod_perl server runs 10 processes so it can
handle 20 connections per second. The mod_proxy runs 200 processes and it
handles static requests very quickly, so it can handle some huge number of
static requests, but it can still only handle 20 proxied requests per second.
Now something happens to your mod_perl server and it starts taking 2s to
generate pages. The proxy server continues to get up to 20 requests per second
for proxied pages, for each request it tries to connect to the mod_perl
server. The mod_perl server can now only handle 5 requests per second though.
So the proxy server processes quickly end up waiting in the backlog queue.
Now *all* the mod_proxy processes are in "R" state and handling proxied
requests. The result is that the static images -- which under normal
conditions are handled quicly -- become delayed until a proxy process is
available to handle the request. Eventually the backlog queue will fill up and
the proxy server will hand out errors.
> This is a good idea because it is easy to move to a different machine
> if the load makes it necessary. However, a simple approach is to
> use a non-mod_perl apache as a non-caching proxy front end for the
> dynamic content and let it deliver the static pages directly. A
> short stack of RewriteRules can arrange this if you use the
> [L] or [PT] flags on the matches you want the front end to serve
> and the [P] flag on the matches to proxy.
That's what I thought. I'm trying to help others avoid my mistake :)
Use a separate hostname for your pictures, it's a pain on the html authors but
it's worth it in the long run.
--
greg