www-modproxy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: modproxy load balancer
Date Thu, 26 Jun 2003 09:10:25 GMT
Bill Stoddard wrote:

> I'll start implementing some of the hook calls in mod_proxy. Once I get 
> the hooks in place, you should be able to write a backhand load balancer 
> module that declares interest in these hooks. Hope to start working on 
> the mod_proxy mods within the next few days.

In line 433 of mod_proxy.c, there is the code that (IMHO) needs to be 
changed.

First, if we are configured to connect to one or more further downstream 
proxies, we try to connect to each one in the order they are specified 
in the config file. If we are configured to connect direct (the usual 
case), then we try that direct connection. The result is a connection to 
some remote server.

In order to complete the request, a function:

proxy_run_scheme_handler(r, conf, url, ents[i].hostname, ents[i].port);

is run. This either connects to hostname and port, and asks for URL 
(forward proxy), or if hostname and port are NULL, it connects to the 
host in URL (reverse proxy).

I think the hook should go inside the proxy_run_scheme_handler() 
function, and the hooked code should accept an URL (or a hostname and 
port) and convert it into a connection, which is passed back to the rest 
of the code path.

The hooked module can then do what it likes with connection failure: 
retry with a round robin connection, etc until it is happy (or unhappy).

The existing code can be pulled out of what's there now, and moved into 
a simple module called "proxy_dns" (or something).

One other thing that must be looked at is module ordering:

Take for example the case where you want to support "sticky" 
connections. You would probably want to watch either a cookie or a 
request variable called JSESSIONID, and make sure that all requests with 
that session id go to that server.

But what happens if the sticky server is down? The module would say 
DECLINED and hand it on to the next module, which might be proxy_dns, 
whatever.

We need some way though of telling proxy that proxy_sticky comes before 
proxy_dns.

Perhaps we can have a directive the same as in mod_cache, which 
specifies the order in which the backend modules are tried.

Thoughts?

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."


Mime
View raw message