You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Philippe M. Chiasson" <go...@hbesoftware.com> on 2000/03/13 07:34:20 UTC

[module porting] mod_proxy

HAving heard about people complaining about mod_proxy implementation, I
was wondering if there is already work being done on porting to 2.0.

The reason is because I would be interested in trying to port it, as well
as add some features taken from mod_backhand, including:

+Shared Connection pools
+Potentially find a way to proxy outside of the apache children somehow.
(I think it's not necessary to tie up an httpd children to proxy content)
+More control over the actual proxying
+Including optionnaly a Proxied-For: header
+Other suggestions...

Just let me know.

+-----------------------------------------------+
| Philippe M. Chiasson  <go...@hbesoftware.com> |
| SmartWorker http://www.smartworker.org        |
|     IM : gozerhbe  ICQ : gozer/18279998       |
+-----------------------------------------------+
Recycle bits please.
#!/usr/bin/perl
$a='#!/usr/bin/perl%c$a=%c%s%c;printf($a,10,39,$a,39,10);%c';printf($a,10,39,$a,39,10);



Re: [module porting] mod_proxy

Posted by Ask Bjoern Hansen <as...@valueclick.com>.
On Mon, 13 Mar 2000, Graham Leggett wrote:

> > +Including optionnaly a Proxied-For: header
> 
> What does Proxied-For do? Is it similar to the Via header?

I would guess that's what Squid calls X-Forwarded-For. It's useful for
letting the "backend" in a apache/mod_proxy frontend apache/something-fat
backend setup know who did the request. 

my out of this world simple module
ftp://ftp.netcetera.dk/pub/apache/mod_proxy_add_forward.c that just adds
that header seems to be quite popular at least among mod_perl people. :-)

I'm glad to hear that you had a good conference. I got work overload and
couldn't afford the time on it. Dang. :-(

I would be interested in testing your HTTP/1.1 patches by the way. I have
+70 million request per day to test with. :-)


 - ask

-- 
ask bjoern hansen - <http://www.netcetera.dk/~ask/>
more than 70M impressions per day, <http://valueclick.com>


Re: [module porting] mod_proxy

Posted by Graham Leggett <mi...@sharp.fm>.
Tony Finch wrote:

> Of more concern is that if you (or your uncontrollable customers) are
> doing IP-based access control then your accelerator has to do what
> mod_backhand does with frobbing the remote IP address based on headers
> from the request. (This fixes the IP addresses in the logs as a side
> effect.)

Just let your front end do access control - let the back end concentrate
on just serving content.

Regards,
Graham
--

Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Wed, 15 Mar 2000, Tony Finch wrote:

> James Sutherland <ja...@cam.ac.uk> wrote:
> >
> >Really, an ultra-lightweight HTTP accelerator front-end to Apache would be
> >very nice. OK, you can use Squid to get a similar effect - but then Apache
> >doesn't log the user's true IP address, it will miss some files, etc.
> 
> If you want accurate logs you have to get them from the accelerator.

Yes - which is a pain, since it means either using a fullsize Apache
installation as a front-end, or using Squid and changing log formats :-(

> Of more concern is that if you (or your uncontrollable customers) are
> doing IP-based access control then your accelerator has to do what
> mod_backhand does with frobbing the remote IP address based on headers
> from the request. (This fixes the IP addresses in the logs as a side
> effect.)

This is the key feature I had in mind. Really, I want a massively cut down
Squid - but passing the connection info over to the backend Apache. That
way, Apache can perform all the logging as before, but with the buffering
and load-balancing layer.


James.


Re: [module porting] mod_proxy

Posted by Tony Finch <do...@dotat.at>.
James Sutherland <ja...@cam.ac.uk> wrote:
>
>Really, an ultra-lightweight HTTP accelerator front-end to Apache would be
>very nice. OK, you can use Squid to get a similar effect - but then Apache
>doesn't log the user's true IP address, it will miss some files, etc.

If you want accurate logs you have to get them from the accelerator.

Of more concern is that if you (or your uncontrollable customers) are
doing IP-based access control then your accelerator has to do what
mod_backhand does with frobbing the remote IP address based on headers
from the request. (This fixes the IP addresses in the logs as a side
effect.)

Tony.
-- 
f.a.n.finch    fanf@demon.net    dot@dotat.at
208 it's a wonderful meat

Re: [module porting] mod_proxy

Posted by "Jeffrey W. Baker" <jw...@acm.org>.
On Mon, 13 Mar 2000, Dean Gaudet wrote:

> 
> 
> On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:
> 
> > Well, suppose request /x is going to be proxied, the apache children that
> > got the request will be the one doing the proxying of the content.  In the
> > case of a mod_perl server, this is a potential problem, having a mod_perl
> > stuck proxying a 6MB file to a 28.8kps user. 
> 
> i think you have it backwards... the proxy shouldn't be running mod_perl
> -- a separate server should run mod_perl.
> 
> then what you add to the proxy is support for buffering, say, 64Kb of the
> response and closing the server connection before finishing up with the
> client side.  that wins you lots on mod_perl servers 'cause the heavy
> processes get to be reused within a few ms of calculating their responses.

If you are only going to buffer 64Kb, it would be much easier to just
increase the kernel's socket buffers.  That way your apache processes
unload everything they have into the kernel, and get on with answering
more requests.

On Linux, look at /proc/sys/net/core/*mem*, and the corresponding sysctls
on BSDs.

-jwb


Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Tue, 21 Mar 2000 17:54:49 -0800 (PST), you wrote:
>On Tue, 14 Mar 2000, James Sutherland wrote:
>
>> I like the idea. Rather than having the async engine part of the main
>> process, though, I'd like it to be external. This way, you could (for
>> example) replace it with an SSL one. For high traffic sites (Netscape now
>> offer their 128-bit browser for download via HTTPS - were Cray holding a
>> spring sale or something?!) the SSL encryption/decryption is pretty heavy
>> work. 
>
>hunh.  it's not my experience that ssl encrypt/decrypt is that heavy --
>when considered against the sheer CPU cost of supporting thousands of
>modem clients as you would at any single "choke point" like the
>architecture i proposed.  although maybe my viewpoint is skewed because
>our systems at CP deal with pop, smtp, and imap traffic in addition to
>http traffic... and pop in particular has far more tiny packets than http
>in general (LIST, response, RETR 1, response, DELE 1, response, ...)

A major part of the workload in POP etc. will be handling the huge
numbers of tiny packets.

My main aim was to offload the long-duration sessions from the big
heavy Apache processes onto a single lightweight accelerator. Every
second the modem is dribbling data at 3K/sec, it's tying up one of
your processes; much better to have Apache blasting the data across
the wire very quickly, and buffered by a front-end.

>i admit to only having modelled numbers at the moment, but it appears that
>simply doubling my CPU speed i'll handle the same load as i have now fully
>encrypted.  and given that our currently deployed proxies were spec'd a
>couple years ago we've already had Moore's law bring us to within the
>realm of "should work on paper".

My main aim is not so much that one machine can't handle the load -
but if I have a 20 machine farm, I'd rather have 10 machines doing
crypto and 10 doing the HTTP and dynamic stuff than 20 machines doing
a bit of everything. Not much cost in terms of latency etc, and it
simplifies running things. Half the number of Apache boxes, etc.

>i'll report back in a few months when i've got production data.

Should be very interesting. As I say, it's not so much the CPU load
per se - I'd just prefer to have fewer Apache processes running at
once, shifting data more rapidly.


James.

Re: [module porting] mod_proxy

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 14 Mar 2000, James Sutherland wrote:

> I like the idea. Rather than having the async engine part of the main
> process, though, I'd like it to be external. This way, you could (for
> example) replace it with an SSL one. For high traffic sites (Netscape now
> offer their 128-bit browser for download via HTTPS - were Cray holding a
> spring sale or something?!) the SSL encryption/decryption is pretty heavy
> work. 

hunh.  it's not my experience that ssl encrypt/decrypt is that heavy --
when considered against the sheer CPU cost of supporting thousands of
modem clients as you would at any single "choke point" like the
architecture i proposed.  although maybe my viewpoint is skewed because
our systems at CP deal with pop, smtp, and imap traffic in addition to
http traffic... and pop in particular has far more tiny packets than http
in general (LIST, response, RETR 1, response, DELE 1, response, ...)

i admit to only having modelled numbers at the moment, but it appears that
simply doubling my CPU speed i'll handle the same load as i have now fully
encrypted.  and given that our currently deployed proxies were spec'd a
couple years ago we've already had Moore's law bring us to within the
realm of "should work on paper".

i'll report back in a few months when i've got production data.

Dean


Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Tue, 14 Mar 2000, Dean Gaudet wrote:

> On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:
> 
> > That's true, but the problem is still there, even if it's a lightweight
> > httpd (non-mod_perl) serving the request, it's gonna be stuck for a while
> > with slow users anyway.  I know it's always been like that anyway, but
> > it's just something I was thinking about.
> 
> you should go back in the new-httpd archives to around jun 1999 and search
> for everything with MPM in the subject or "async" in the body.  and
> there's also some notes about async mpms in the 2.0 src/doc directory.
> 
> the general idea is that there would be an asynchronous engine
> specifically for returning responses, and a pool of threads would do the
> protocol processing.  you can pretty much break up all protocols into a
> series of steps like this:
> 
> 1. accept new connection
> 2. wait for data from client
> 3. parse client request, determine which static object to respond with,
>    or generate a dynamic object to respond with
> 4. send the object back to the client
> 5. goto 2
> 
> steps 1, 2, 4, and 5 can be handled easily with async i/o, which is as
> fast as you'll get them.  (for a proxy, step 4 might be copy from TCP to
> TCP).
> 
> step 3 is where all the "hard" coding goes, and it generally sucks to do
> async i/o programming for this stuff.  so step 3 is handled by a pool of
> threads.
> 
> that's the idea... i lost steam though, so i never implemented it.  now
> i'm essentially hoping to evangelise it enough so that someone else will
> jump in and do it :)

I like the idea. Rather than having the async engine part of the main
process, though, I'd like it to be external. This way, you could (for
example) replace it with an SSL one. For high traffic sites (Netscape now
offer their 128-bit browser for download via HTTPS - were Cray holding a
spring sale or something?!) the SSL encryption/decryption is pretty heavy
work. In this example, you might need several biggish servers handling
SSL, with a single backend WWW server - much easier than having many
Apache-SSL servers, all handling connections AND content.

So: 1. Nice, simple, select() based front-end. Just accept()s incoming
connections, makes corresponding connections to the back-end, and passes
data (including out-of-band stuff like the remote IP) to the back-end.

2. As above, but using threads/pre-forking to handle SSL. Needs to pass
certificate information etc. to the backend as well.


(1) should be fairly straightforward, although it will require a change to
the backend server to log the remote IP, rather than that of the front-end
box. (2) can wait until later :-)


James.


Re: [module porting] mod_proxy

Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:

> That's true, but the problem is still there, even if it's a lightweight
> httpd (non-mod_perl) serving the request, it's gonna be stuck for a while
> with slow users anyway.  I know it's always been like that anyway, but
> it's just something I was thinking about.

you should go back in the new-httpd archives to around jun 1999 and search
for everything with MPM in the subject or "async" in the body.  and
there's also some notes about async mpms in the 2.0 src/doc directory.

the general idea is that there would be an asynchronous engine
specifically for returning responses, and a pool of threads would do the
protocol processing.  you can pretty much break up all protocols into a
series of steps like this:

1. accept new connection
2. wait for data from client
3. parse client request, determine which static object to respond with,
   or generate a dynamic object to respond with
4. send the object back to the client
5. goto 2

steps 1, 2, 4, and 5 can be handled easily with async i/o, which is as
fast as you'll get them.  (for a proxy, step 4 might be copy from TCP to
TCP).

step 3 is where all the "hard" coding goes, and it generally sucks to do
async i/o programming for this stuff.  so step 3 is handled by a pool of
threads.

that's the idea... i lost steam though, so i never implemented it.  now
i'm essentially hoping to evangelise it enough so that someone else will
jump in and do it :)

Dean


Re: [module porting] mod_proxy

Posted by "Philippe M. Chiasson" <go...@hbesoftware.com>.
On Mon, 13 Mar 2000, Dean Gaudet wrote:

> 
> 
> On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:
> 
> > Well, suppose request /x is going to be proxied, the apache children that
> > got the request will be the one doing the proxying of the content.  In the
> > case of a mod_perl server, this is a potential problem, having a mod_perl
> > stuck proxying a 6MB file to a 28.8kps user. 
> 
> i think you have it backwards... the proxy shouldn't be running mod_perl
> -- a separate server should run mod_perl.
> 
> then what you add to the proxy is support for buffering, say, 64Kb of the
> response and closing the server connection before finishing up with the
> client side.  that wins you lots on mod_perl servers 'cause the heavy
> processes get to be reused within a few ms of calculating their responses.

Yes, know that, just didn't think enough when I wrote my e-mail.  I should
read them over before sending them to mailing-lists :-).

That's true, but the problem is still there, even if it's a lightweight
httpd (non-mod_perl) serving the request, it's gonna be stuck for a while
with slow users anyway.  I know it's always been like that anyway, but
it's just something I was thinking about.
 
> Dean
> 

+-----------------------------------------------+
| Philippe M. Chiasson  <go...@hbesoftware.com> |
| SmartWorker http://www.smartworker.org        |
|     IM : gozerhbe  ICQ : gozer/18279998       |
+-----------------------------------------------+
Recycle bits please.
#!/usr/bin/perl
$a='#!/usr/bin/perl%c$a=%c%s%c;printf($a,10,39,$a,39,10);%c';printf($a,10,39,$a,39,10);



Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Wed, 15 Mar 2000, Graham Leggett wrote:

> James Sutherland wrote:
> 
> > Yes, Apache is good here - compensating for partially braindead backend
> > servers, where you DO need some "intelligence" in the front-end.
> 
> In all the systems I've come across, there has always been some niggling
> back end box that forced us to have intelligence on the front end. Using
> Apache on the frontend means the capability is there if I need it. The
> last thing I want to do in a design is to sacrifice flexibility to save
> a few cpu cycles that don't represent a saving anyway.

The saved cycles may well represent a saving if you have heavy enough
traffic to warrant offloading it onto a seperate box. In the example
someone quoted earlier in this thread, you could have a user on a 28.8K
modem downloading a large dynamically generated file. This will force
whatever process is sending the data to linger for (literally) hours,
pumping out another 4K of data every second.

I once had an Apache WWW server I was running flattened by one user. The
user opened a large number of connections, each downloading something very
large very slowly. Each connection tied up another Apache process, and
more kernel resources, and more memory...

> > I don't want a proxy server. If I did, I'd use Squid or Apache. I want
> > load-balancing, possibly with *transparent* encryption support. (i.e. the
> > backend server "thinks" it's handling a normal SSL request - but
> > offloading the encryption number crunching to another box.)
> 
> SSL doesn't work like that - you cannot get a backend box to think it's
> doing encryption, it either does or it doesn't.

I mean, have the frontend perform the encryption/decryption, and pass
information on what it is doing to the backend. The backend box then sees
a normal SSL connection, even though the number crunching is being done on
another machine.

> > Interesting. How do you pass the information on certificates, protocol
> > used, remote IP etc. to the back end?
> 
> We haven't needed to, but this could easily be achieved by adding
> certificate info into headers to be sent to the backend. This is an
> example of "intelligence" on the front end needed for the back end.

This is also the sort of simple bulk preprocessing I want to handle before
Apache "sees" the request. It doesn't take a complete WWW server process
to encrypt and decrypt a stream of data. You already get systems to
implement the SSL work in a dedicated hardware system - I want to do the
same with (a) dedicated machine(s). Yes, I COULD do something similar with
Apache-SSL and mod_proxy - but that's not what I'm after.


James.


Re: [module porting] mod_proxy

Posted by Graham Leggett <mi...@sharp.fm>.
James Sutherland wrote:

> Yes, Apache is good here - compensating for partially braindead backend
> servers, where you DO need some "intelligence" in the front-end.

In all the systems I've come across, there has always been some niggling
back end box that forced us to have intelligence on the front end. Using
Apache on the frontend means the capability is there if I need it. The
last thing I want to do in a design is to sacrifice flexibility to save
a few cpu cycles that don't represent a saving anyway.

> I don't want a proxy server. If I did, I'd use Squid or Apache. I want
> load-balancing, possibly with *transparent* encryption support. (i.e. the
> backend server "thinks" it's handling a normal SSL request - but
> offloading the encryption number crunching to another box.)

SSL doesn't work like that - you cannot get a backend box to think it's
doing encryption, it either does or it doesn't.

> Interesting. How do you pass the information on certificates, protocol
> used, remote IP etc. to the back end?

We haven't needed to, but this could easily be achieved by adding
certificate info into headers to be sent to the backend. This is an
example of "intelligence" on the front end needed for the back end.

Regards,
Graham
--

Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Wed, 15 Mar 2000, Graham Leggett wrote:

> James Sutherland wrote:
> 
> > If the front-end is doing caching, then yes. You then also have to do any
> > IP based access control on the front-end, along with logging, parsing
> > requests...
> 
> Exactly - on two front end Apache boxes, rather than a whole host of
> backend machines, many of whom don't support proper access control
> natively anyway.

Yes, Apache is good here - compensating for partially braindead backend
servers, where you DO need some "intelligence" in the front-end.

I, OTOH, do NOT want the front-end boxes doing anything more than
buffering/encryption. I want it to act as a dedicated front-end to Apache.

> > Yes, this sounds like a good arrangement - but Apache isn't ideally suited
> > to this, IMO...
> 
> Apache is ideally suited to this, something we have proved practically
> over the last year of running it like this.
> 
> I like the idea that Apache is a webserver first, and a proxy second -
> it means I get to do webserver things like many websites on one IP
> address, logging, access control using __one__ access control system,
> serving of simple static files, proxying URLs to different machines
> based on URL rather than website name, etc etc.

Not the environment I'm aiming at at all.

> I went through the pain of trying to get Netscape Proxy Server to act as
> a frontend for a website, and wasted 3 weeks of time in the process. As
> a really simple server it worked, but as soon as you tried to do
> anything that resembled URL or website management, it was a nightmare.

I don't want a proxy server. If I did, I'd use Squid or Apache. I want
load-balancing, possibly with *transparent* encryption support. (i.e. the
backend server "thinks" it's handling a normal SSL request - but
offloading the encryption number crunching to another box.)

> > Trying to add encryption support to this, for example, could be quite
> > difficult.
> 
> A trivial exersize achieved with mod_ssl. We already did it, works
> great.

Interesting. How do you pass the information on certificates, protocol
used, remote IP etc. to the back end?


James.


Re: [module porting] mod_proxy

Posted by Graham Leggett <mi...@sharp.fm>.
James Sutherland wrote:

> If the front-end is doing caching, then yes. You then also have to do any
> IP based access control on the front-end, along with logging, parsing
> requests...

Exactly - on two front end Apache boxes, rather than a whole host of
backend machines, many of whom don't support proper access control
natively anyway.

> Yes, this sounds like a good arrangement - but Apache isn't ideally suited
> to this, IMO...

Apache is ideally suited to this, something we have proved practically
over the last year of running it like this.

I like the idea that Apache is a webserver first, and a proxy second -
it means I get to do webserver things like many websites on one IP
address, logging, access control using __one__ access control system,
serving of simple static files, proxying URLs to different machines
based on URL rather than website name, etc etc.

I went through the pain of trying to get Netscape Proxy Server to act as
a frontend for a website, and wasted 3 weeks of time in the process. As
a really simple server it worked, but as soon as you tried to do
anything that resembled URL or website management, it was a nightmare.

> Trying to add encryption support to this, for example, could be quite
> difficult.

A trivial exersize achieved with mod_ssl. We already did it, works
great.

Regards,
Graham
--

Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Wed, 15 Mar 2000, Graham Leggett wrote:

> James Sutherland wrote:
> 
> > Sorry - I wasn't meaning a full-blown proxy. Rather, I was thinking in
> > terms of the setup many big Apache installations use - a reverse proxy
> > front-end, with "full size" Apache backend servers. This proxy doesn't
> > handle FTP, or indeed connections to anything other than the backend
> > Apache daemons.
> 
> I have this exact setup running here.

Except that you are using Apache, and using it to do caching and logging
as well.

> > Neither case calls for a full Apache server for the front end - the
> > latter, in particular, is nothing more than a buffered relay, but for the
> > ability to pass information like the remote IP address etc. to the backend
> > machines. Squid comes fairly close, but can't handle the encryption for
> > the first case, and isn't transparent - the backend boxes see and log
> > incoming connections from the front-end, not from the client.
> 
> The back end boxes need not see the client IP addresses, they shouldn't
> be doing the logging in the first place, as the caching effect of the
> frontend proxy would make the logs inaccurate.

If the front-end is doing caching, then yes. You then also have to do any
IP based access control on the front-end, along with logging, parsing
requests...

> We use a front end Apache setup to hide an whole assortment of NT
> machines, Unix machines, NSES webservers, Infoseek, etc. None of these
> backend boxes do any logging at all - it's all done on the front end.
> Suddenly what was a huge problem collating log files in different
> formats and on different machines became a simple one - we log in one
> place, and in one format.
> 
> Multi-tier webserver architectures are normally suggested for load
> balancing and failover, but their best use is website management.

Yes, this sounds like a good arrangement - but Apache isn't ideally suited
to this, IMO...

Trying to add encryption support to this, for example, could be quite
difficult.


James.


Re: [module porting] mod_proxy

Posted by Graham Leggett <mi...@sharp.fm>.
James Sutherland wrote:

> Sorry - I wasn't meaning a full-blown proxy. Rather, I was thinking in
> terms of the setup many big Apache installations use - a reverse proxy
> front-end, with "full size" Apache backend servers. This proxy doesn't
> handle FTP, or indeed connections to anything other than the backend
> Apache daemons.

I have this exact setup running here.

> Neither case calls for a full Apache server for the front end - the
> latter, in particular, is nothing more than a buffered relay, but for the
> ability to pass information like the remote IP address etc. to the backend
> machines. Squid comes fairly close, but can't handle the encryption for
> the first case, and isn't transparent - the backend boxes see and log
> incoming connections from the front-end, not from the client.

The back end boxes need not see the client IP addresses, they shouldn't
be doing the logging in the first place, as the caching effect of the
frontend proxy would make the logs inaccurate.

We use a front end Apache setup to hide an whole assortment of NT
machines, Unix machines, NSES webservers, Infoseek, etc. None of these
backend boxes do any logging at all - it's all done on the front end.
Suddenly what was a huge problem collating log files in different
formats and on different machines became a simple one - we log in one
place, and in one format.

Multi-tier webserver architectures are normally suggested for load
balancing and failover, but their best use is website management.

Regards,
Graham
--

Re: [module porting] mod_proxy

Posted by "Philippe M. Chiasson" <go...@hbesoftware.com>.
On Tue, 14 Mar 2000, James Sutherland wrote:

> On Tue, 14 Mar 2000, Blue Lang wrote:
> 
> > 
> > > ability to pass information like the remote IP address etc. to the backend
> > > machines. Squid comes fairly close, but can't handle the encryption for
> > > the first case, and isn't transparent - the backend boxes see and log
> > > incoming connections from the front-end, not from the client.
> > 
> > Does mod_proxy allow the back end boxes to somehow map the real client ip?
> > If so, could you not easily port that functionality into squid? I'm not
> > sure why you would use squid over apache, or vice-versa, in that
> > situation, I'm just curious about it.
> 
> In short, performance. I would like to have a nice, slimline (non-forking
> - either multithreaded or select() based) front-end. Basically, Squid, but
> with a LOT of functionality removed, and encryption support (SSL) and some
> way to communicate the out-of-band info (remote IP address etc) to Apache.

Yes, I think this is the whole point of this.  A very small multi-threaded
process that you basically handle a STDOUT(client) and a STDIN(proxyed
server)  and that handles the passing around of data.  mod_proxy would
just open the connection to the proxied host (potentially keeping a pool
of open connections in conjunction with KeepAlive On on the proxied
servers).
 
> I could use Apache-SSL and mod_proxy to achieve something similar with
> HTTPS, or Squid for HTTP - but neither is quite what I am looking for. Any
> ideas? 
> James.
> 

+-----------------------------------------------+
| Philippe M. Chiasson  <go...@hbesoftware.com> |
| SmartWorker http://www.smartworker.org        |
|     IM : gozerhbe  ICQ : gozer/18279998       |
+-----------------------------------------------+
Recycle bits please.
#!/usr/bin/perl
$a='#!/usr/bin/perl%c$a=%c%s%c;printf($a,10,39,$a,39,10);%c';printf($a,10,39,$a,39,10);



Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Tue, 14 Mar 2000, Blue Lang wrote:

> 
> > ability to pass information like the remote IP address etc. to the backend
> > machines. Squid comes fairly close, but can't handle the encryption for
> > the first case, and isn't transparent - the backend boxes see and log
> > incoming connections from the front-end, not from the client.
> 
> Does mod_proxy allow the back end boxes to somehow map the real client ip?
> If so, could you not easily port that functionality into squid? I'm not
> sure why you would use squid over apache, or vice-versa, in that
> situation, I'm just curious about it.

In short, performance. I would like to have a nice, slimline (non-forking
- either multithreaded or select() based) front-end. Basically, Squid, but
with a LOT of functionality removed, and encryption support (SSL) and some
way to communicate the out-of-band info (remote IP address etc) to Apache.

I could use Apache-SSL and mod_proxy to achieve something similar with
HTTPS, or Squid for HTTP - but neither is quite what I am looking for. Any
ideas?


James.


Re: [module porting] mod_proxy

Posted by Blue Lang <bl...@calico.gator.net>.
> ability to pass information like the remote IP address etc. to the backend
> machines. Squid comes fairly close, but can't handle the encryption for
> the first case, and isn't transparent - the backend boxes see and log
> incoming connections from the front-end, not from the client.

Does mod_proxy allow the back end boxes to somehow map the real client ip?
If so, could you not easily port that functionality into squid? I'm not
sure why you would use squid over apache, or vice-versa, in that
situation, I'm just curious about it.

Thanks,

-- 
        Blue Lang                              Unix Systems Admin
        QSP, Inc., 3200 Atlantic Ave, Ste 100, Raleigh, NC, 27604
        Home: 919 835 1540  Work: 919 875 6994  Fax: 919 872 4015



Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Tue, 14 Mar 2000, Dean Gaudet wrote:

> On Tue, 14 Mar 2000, James Sutherland wrote:
> 
> > Sorry - I wasn't meaning a full-blown proxy. Rather, I was thinking in
> > terms of the setup many big Apache installations use - a reverse proxy
> > front-end, with "full size" Apache backend servers. This proxy doesn't
> > handle FTP, or indeed connections to anything other than the backend
> > Apache daemons.
> 
> heh.  see the new-httpd archives for the first two weeks of february.  
> i've included a relevant message from the threads below.

With the exception of SSL support, Squid does all of what is described in
that post. This isn't quite what I had in mind - I wasn't thinking in
terms of a cache, or any protocol handling, just simple load-balancing and
buffering. Mainly aimed at off-loading the encryption work to a seperate
box, as well as simplifying the load-balancing requirements.

> it's nice to see this theme has gone from repeating every 6 months to
> repeating every month.  :)
> 
> i think a lot of us agree that these ideas are good.  we just need folks
> to code it.  i'm going to be really honest and say that i can't code this
> project -- too many other things competing for my attention.  but i'm
> totally here to help with the design and debugging after the first
> prototypes exist.

OK... I'll make a start on the front-end bit, see how that goes. (Hint to
anyone from Sun: a nice Starfire so I can test /dev/poll support would
help :)

> Dean
> 
> On Thu, 10 Feb 2000, Dean Gaudet wrote:
> > 
> > Date: Thu, 10 Feb 2000 16:03:23 -0800 (PST)
> > From: Dean Gaudet <dg...@arctic.org>
> > To: new-httpd@apache.org
> > Cc: tomcat-dev@tomcat.apache.org, jserv-dev@list.working-dogs.com, Simon Spero <se...@tipper.oit.unc.edu>
> > Subject: HTTP + XML + SCP = HTTP/ng
> > X-comment: visit http://www.arctic.org/~dean/legal for information regarding copyright and disclaimer.
> > Reply-To: new-httpd@apache.org
> > 
> > On Mon, 7 Feb 2000, Martin Pool wrote:
> > 
> > > Given the state of Java and HTTP today I wonder whether it would be
> > > better to build a toolkit of Java classes for building HTTP servers,
> > > rather than using AJP to plug into Apache.
> > 
> > that's what i was advocating.
> > 
> > > Where's Apache going to go in the future?  Is it going to be a single
> > > big do-everything program, or a cluster of complementary projects?  
> > 
> > i hope not, but unfortunately there's a little bit of momentum... i've
> > made a couple attempts to suggest ways we could split it up.  but i don't
> > have the energy to evangelise the topic.
> > 
> > so one of the points i brought up earlier in the thread hasn't been
> > addressed:  what problems are people trying to solve?
> > 
> > the web applications of which i'm aware are essentially composed of:
> > 
> > - static content
> > - dynamic content which is cacheable (i.e. almost static)
> > - dynamic content which is uncacheable
> > 
> > the best url design includes all these components under the same hostname.  
> > so either all the services end up on one box, or some sort of front-end is
> > required.
> > 
> > both apache and squid perform as front-ends today.
> > 
> > if we had a front-end server with the following feature set:
> > 
> > - full HTTP/1.1 proxy cache
> > - HTTP/1.1 server capable of serving static files
> > - uses async i/o at least for serving static files (which includes
> >   files in the proxy cache)
> > - capable of dividing the urlspace amongst different pools of
> >   backend servers
> > - capable of load balancing amongst several backends within a pool
> > - handles persistant/pipelined connections with clients and with
> >   backends
> > - SSL
> > 
> > in this scenario i would expect the back-ends to talk http.  the front-end
> > would parse the incoming request and either handle it from disk/cache, or
> > pass it through to a back-end.
> > 
> > then i'd really like to know what applications can't be solved?  real
> > world examples please, you know how much of a pain i am :)
> > 
> > i mean i can think of some.  consider authentication.  you might want your
> > entire urlspace to live behind an auth method which you want to implement
> > in java to talk to your databases in some way.  but you've got portions of
> > your urlspace served by static files, some served by perl, and some served
> > by java.
> > 
> > well, the front-end could make a SOAP request (XML over HTTP) to your java
> > back-end, and presumably your java back-end can return a response which is
> > temporarily cacheable.  the front-end keeps that in its proxy cache...  
> > (or heck it could just proxy a HEAD request... my point is that it can
> > just pass the entire client request to the backend.)
> > 
> > anyhow we could go through each phase of the current module API and come
> > up with an application... but when i sit down and think about these things
> > i frequently find myself showing that a particular api phase just isn't
> > needed.
> > 
> > aren't the php and java back-ends just content handlers today?  they don't
> > even touch other API phases right?
> > 
> > i honestly don't see the point of CORBA, or any of the other binary
> > protocols.
> > 
> > - they require more code, which clobbers L1 cache efficiency (which i'm
> > willing to bet will eliminate any perceived benefit you're hoping for by
> > making things binary)
> > 
> > - they require us to document the interfaces and be careful about defining
> > semantics... whereas HTTP/1.1 proxying is well defined by rfc2616, that
> > work is done for us already.
> > 
> > - some of us haven't had the patience to keep up with the object protocol
> > acronym soup of the day ;)
> > 
> > - most of us will end up using XML anyhow, and we've already got XML
> > libraries in our codebases (this is if we even need SOAP)
> > 
> > - code reuse #1
> > 
> > about the only extension to HTTP which i think we might want to consider
> > is Simon Spero's SCP -- session control protocol.  (you can find a version
> > of it named TMP used without credit in rfc2371).  SCP allows you to
> > optimise front-end/back-end communications by multiplexing multiple
> > streams into one tcp session... big performance boost from this.
> > 
> > HTTP + XML + SCP = HTTP/ng :)
> > 
> > other than C and java libraries implementing SCP, what's missing?
> > 
> > Dean
> > 
> > 
> 
> 


Re: [module porting] mod_proxy

Posted by Dean Gaudet <dg...@arctic.org>.
On Tue, 14 Mar 2000, James Sutherland wrote:

> Sorry - I wasn't meaning a full-blown proxy. Rather, I was thinking in
> terms of the setup many big Apache installations use - a reverse proxy
> front-end, with "full size" Apache backend servers. This proxy doesn't
> handle FTP, or indeed connections to anything other than the backend
> Apache daemons.

heh.  see the new-httpd archives for the first two weeks of february.  
i've included a relevant message from the threads below.

it's nice to see this theme has gone from repeating every 6 months to
repeating every month.  :)

i think a lot of us agree that these ideas are good.  we just need folks
to code it.  i'm going to be really honest and say that i can't code this
project -- too many other things competing for my attention.  but i'm
totally here to help with the design and debugging after the first
prototypes exist.

Dean

On Thu, 10 Feb 2000, Dean Gaudet wrote:
> 
> Date: Thu, 10 Feb 2000 16:03:23 -0800 (PST)
> From: Dean Gaudet <dg...@arctic.org>
> To: new-httpd@apache.org
> Cc: tomcat-dev@tomcat.apache.org, jserv-dev@list.working-dogs.com, Simon Spero <se...@tipper.oit.unc.edu>
> Subject: HTTP + XML + SCP = HTTP/ng
> X-comment: visit http://www.arctic.org/~dean/legal for information regarding copyright and disclaimer.
> Reply-To: new-httpd@apache.org
> 
> On Mon, 7 Feb 2000, Martin Pool wrote:
> 
> > Given the state of Java and HTTP today I wonder whether it would be
> > better to build a toolkit of Java classes for building HTTP servers,
> > rather than using AJP to plug into Apache.
> 
> that's what i was advocating.
> 
> > Where's Apache going to go in the future?  Is it going to be a single
> > big do-everything program, or a cluster of complementary projects?  
> 
> i hope not, but unfortunately there's a little bit of momentum... i've
> made a couple attempts to suggest ways we could split it up.  but i don't
> have the energy to evangelise the topic.
> 
> so one of the points i brought up earlier in the thread hasn't been
> addressed:  what problems are people trying to solve?
> 
> the web applications of which i'm aware are essentially composed of:
> 
> - static content
> - dynamic content which is cacheable (i.e. almost static)
> - dynamic content which is uncacheable
> 
> the best url design includes all these components under the same hostname.  
> so either all the services end up on one box, or some sort of front-end is
> required.
> 
> both apache and squid perform as front-ends today.
> 
> if we had a front-end server with the following feature set:
> 
> - full HTTP/1.1 proxy cache
> - HTTP/1.1 server capable of serving static files
> - uses async i/o at least for serving static files (which includes
>   files in the proxy cache)
> - capable of dividing the urlspace amongst different pools of
>   backend servers
> - capable of load balancing amongst several backends within a pool
> - handles persistant/pipelined connections with clients and with
>   backends
> - SSL
> 
> in this scenario i would expect the back-ends to talk http.  the front-end
> would parse the incoming request and either handle it from disk/cache, or
> pass it through to a back-end.
> 
> then i'd really like to know what applications can't be solved?  real
> world examples please, you know how much of a pain i am :)
> 
> i mean i can think of some.  consider authentication.  you might want your
> entire urlspace to live behind an auth method which you want to implement
> in java to talk to your databases in some way.  but you've got portions of
> your urlspace served by static files, some served by perl, and some served
> by java.
> 
> well, the front-end could make a SOAP request (XML over HTTP) to your java
> back-end, and presumably your java back-end can return a response which is
> temporarily cacheable.  the front-end keeps that in its proxy cache...  
> (or heck it could just proxy a HEAD request... my point is that it can
> just pass the entire client request to the backend.)
> 
> anyhow we could go through each phase of the current module API and come
> up with an application... but when i sit down and think about these things
> i frequently find myself showing that a particular api phase just isn't
> needed.
> 
> aren't the php and java back-ends just content handlers today?  they don't
> even touch other API phases right?
> 
> i honestly don't see the point of CORBA, or any of the other binary
> protocols.
> 
> - they require more code, which clobbers L1 cache efficiency (which i'm
> willing to bet will eliminate any perceived benefit you're hoping for by
> making things binary)
> 
> - they require us to document the interfaces and be careful about defining
> semantics... whereas HTTP/1.1 proxying is well defined by rfc2616, that
> work is done for us already.
> 
> - some of us haven't had the patience to keep up with the object protocol
> acronym soup of the day ;)
> 
> - most of us will end up using XML anyhow, and we've already got XML
> libraries in our codebases (this is if we even need SOAP)
> 
> - code reuse #1
> 
> about the only extension to HTTP which i think we might want to consider
> is Simon Spero's SCP -- session control protocol.  (you can find a version
> of it named TMP used without credit in rfc2371).  SCP allows you to
> optimise front-end/back-end communications by multiplexing multiple
> streams into one tcp session... big performance boost from this.
> 
> HTTP + XML + SCP = HTTP/ng :)
> 
> other than C and java libraries implementing SCP, what's missing?
> 
> Dean
> 
> 



Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Tue, 14 Mar 2000, Chuck Murcko wrote:

> James Sutherland wrote:
> > 
> > Is a full-blown Apache setup the right solution here, though, if it is
> > really just buffering the network data? Would a better approach not be to
> > have a very simple, lightweight front-end reverse proxy (more or less just
> > accepting connections, then passing data back and forth)?
> > 
> > (As I said earlier, an SSL version would be nice too, allowing a more
> > effective division of labour between multiple machines.)
> > 
> Minimally, a useful proxy will support https and ftp as well as http. It
> should (and I believe this is an enhancement) also support free
> translation between client and server protocols where possible. Proxying
> https is usually transparent by definition.
> 
> The nontransparency of a proxy using an apache thread/process is IMHO an
> advantage in that protocol handlers defined for the proxy can be used
> elsewhere, and vice versa. Not to mention other APR functions already
> available.
> 
> Consider the case of an SSL encrypting/decrypting proxy. Why rewrite the
> wheel when mod_ssl or Apache SSL will already have provided many of the
> necessary functions?

Sorry - I wasn't meaning a full-blown proxy. Rather, I was thinking in
terms of the setup many big Apache installations use - a reverse proxy
front-end, with "full size" Apache backend servers. This proxy doesn't
handle FTP, or indeed connections to anything other than the backend
Apache daemons.

Let's imagine an HTTPS based webmail service:

Encrypted connections are made to the front end boxes, which just do
encryption and buffering, passing the (plaintext) data back to the
mod_perl servers which generate the dynamic content, etc. This way, you
have lots of powerful front-end servers doing the heavy number crunching,
but with very simple software (just an SSL encryption/decryption and
buffering daemon.) Then you have some mod_perl boxes generating actual
content. Much "heavier" processes, but (due to the buffering and
encryption being handled externally) requests are completed very quickly.


Alternatively, simple load balancing:

A few front-end boxes reverse proxy a large number of mod_perl systems,
generating dynamic content. This time, the front end boxes just handle a
large amount of traffic, doing simple buffering for the backend machines.


Neither case calls for a full Apache server for the front end - the
latter, in particular, is nothing more than a buffered relay, but for the
ability to pass information like the remote IP address etc. to the backend
machines. Squid comes fairly close, but can't handle the encryption for
the first case, and isn't transparent - the backend boxes see and log
incoming connections from the front-end, not from the client.


James.


Re: [module porting] mod_proxy

Posted by Chuck Murcko <ch...@topsail.org>.
James Sutherland wrote:
> 
> Is a full-blown Apache setup the right solution here, though, if it is
> really just buffering the network data? Would a better approach not be to
> have a very simple, lightweight front-end reverse proxy (more or less just
> accepting connections, then passing data back and forth)?
> 
> (As I said earlier, an SSL version would be nice too, allowing a more
> effective division of labour between multiple machines.)
> 
Minimally, a useful proxy will support https and ftp as well as http. It
should (and I believe this is an enhancement) also support free
translation between client and server protocols where possible. Proxying
https is usually transparent by definition.

The nontransparency of a proxy using an apache thread/process is IMHO an
advantage in that protocol handlers defined for the proxy can be used
elsewhere, and vice versa. Not to mention other APR functions already
available.

Consider the case of an SSL encrypting/decrypting proxy. Why rewrite the
wheel when mod_ssl or Apache SSL will already have provided many of the
necessary functions?
-- 
Chuck
Chuck Murcko
Here: chuck.murcko@trintech.com
There: chuck@topsail.org

Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Mon, 13 Mar 2000, Dean Gaudet wrote:
> On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:
> 
> > Well, suppose request /x is going to be proxied, the apache children that
> > got the request will be the one doing the proxying of the content.  In the
> > case of a mod_perl server, this is a potential problem, having a mod_perl
> > stuck proxying a 6MB file to a 28.8kps user. 
> 
> i think you have it backwards... the proxy shouldn't be running mod_perl
> -- a separate server should run mod_perl.
> 
> then what you add to the proxy is support for buffering, say, 64Kb of the
> response and closing the server connection before finishing up with the
> client side.  that wins you lots on mod_perl servers 'cause the heavy
> processes get to be reused within a few ms of calculating their responses.

Is a full-blown Apache setup the right solution here, though, if it is
really just buffering the network data? Would a better approach not be to
have a very simple, lightweight front-end reverse proxy (more or less just
accepting connections, then passing data back and forth)?

(As I said earlier, an SSL version would be nice too, allowing a more
effective division of labour between multiple machines.)


James.


Re: [module porting] mod_proxy

Posted by Dean Gaudet <dg...@arctic.org>.

On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:

> Well, suppose request /x is going to be proxied, the apache children that
> got the request will be the one doing the proxying of the content.  In the
> case of a mod_perl server, this is a potential problem, having a mod_perl
> stuck proxying a 6MB file to a 28.8kps user. 

i think you have it backwards... the proxy shouldn't be running mod_perl
-- a separate server should run mod_perl.

then what you add to the proxy is support for buffering, say, 64Kb of the
response and closing the server connection before finishing up with the
client side.  that wins you lots on mod_perl servers 'cause the heavy
processes get to be reused within a few ms of calculating their responses.

Dean


Re: [module porting] mod_proxy

Posted by James Sutherland <ja...@cam.ac.uk>.
On Mon, 13 Mar 2000, Philippe M. Chiasson wrote:

> On Mon, 13 Mar 2000, Graham Leggett wrote:
> 
> > "Philippe M. Chiasson" wrote:
> > 
> > > HAving heard about people complaining about mod_proxy implementation, I
> > > was wondering if there is already work being done on porting to 2.0.
> > 
> > I've just finished a patch to fix most of the proxy problems and upgrade
> > it to HTTP/1.1. It's in testing right now, and the next step is to port
> > it to v2.0.
> 
> Do you have time to do it yourself?
>  
> > > The reason is because I would be interested in trying to port it, as well
> > > as add some features taken from mod_backhand, including:
> > > 
> > > +Shared Connection pools
> > > +Potentially find a way to proxy outside of the apache children somehow.
> > > (I think it's not necessary to tie up an httpd children to proxy content)
> 
> Well, suppose request /x is going to be proxied, the apache children that
> got the request will be the one doing the proxying of the content.  In the
> case of a mod_perl server, this is a potential problem, having a mod_perl
> stuck proxying a 6MB file to a 28.8kps user. 
> 
> What I mean by handled outside apache, is another process/thread that
> would be passed the request, freeing the apache children ready to answer a
> new query, and use this super lightweight process to do the actual
> proxying.  It was just something I discussed with Theo (mod_backhand),
> looking for ways to make proxying a lot more efficient

This sounds to me a lot like an httpd accelerator; this way, your mod_perl
server could fire the 6Mb file straight into the accelerator, which then
does the long, slow transfer to the modem user.

> > I'm not sure what you mean by proxy outside apache children?
> 
> Do I make any sense ?

Yes. Could be useful...

Really, an ultra-lightweight HTTP accelerator front-end to Apache would be
very nice. OK, you can use Squid to get a similar effect - but then Apache
doesn't log the user's true IP address, it will miss some files, etc.
Someone here was looking for an encrypting version - this could also be
very nice, IMO...

OK... Nice, lightweight (select()-based?) front-end for reverse proxying,
with a way to pass all the connection info (remote IP etc.) to the back
end Apache.

SSL version of above, to handle the heavy number crunching independently
of the WWW server itself.

Definite possibilities, IMO - thoughts??


James.


Re: [module porting] mod_proxy

Posted by "Philippe M. Chiasson" <go...@hbesoftware.com>.
On Mon, 13 Mar 2000, Graham Leggett wrote:

> "Philippe M. Chiasson" wrote:
> 
> > HAving heard about people complaining about mod_proxy implementation, I
> > was wondering if there is already work being done on porting to 2.0.
> 
> I've just finished a patch to fix most of the proxy problems and upgrade
> it to HTTP/1.1. It's in testing right now, and the next step is to port
> it to v2.0.

Do you have time to do it yourself?
 
> > The reason is because I would be interested in trying to port it, as well
> > as add some features taken from mod_backhand, including:
> > 
> > +Shared Connection pools
> > +Potentially find a way to proxy outside of the apache children somehow.
> > (I think it's not necessary to tie up an httpd children to proxy content)

Well, suppose request /x is going to be proxied, the apache children that
got the request will be the one doing the proxying of the content.  In the
case of a mod_perl server, this is a potential problem, having a mod_perl
stuck proxying a 6MB file to a 28.8kps user. 

What I mean by handled outside apache, is another process/thread that
would be passed the request, freeing the apache children ready to answer a
new query, and use this super lightweight process to do the actual
proxying.  It was just something I discussed with Theo (mod_backhand),
looking for ways to make proxying a lot more efficient

> I'm not sure what you mean by proxy outside apache children?

Do I make any sense ?

> > +More control over the actual proxying
> > +Including optionnaly a Proxied-For: header
> 
> What does Proxied-For do? Is it similar to the Via header?

Kinda.  I know there a small module mod_proxy_forwarded_for or something.
Yeah, it's just adding a special Proxied-For: 192.168.1.1 header,
identifying who was the origial client (usefull to log the right address,
access based control, etc...)

> Regards,
> Graham
> --
> 

+-----------------------------------------------+
| Philippe M. Chiasson  <go...@hbesoftware.com> |
| SmartWorker http://www.smartworker.org        |
|     IM : gozerhbe  ICQ : gozer/18279998       |
+-----------------------------------------------+
Recycle bits please.
#!/usr/bin/perl
$a='#!/usr/bin/perl%c$a=%c%s%c;printf($a,10,39,$a,39,10);%c';printf($a,10,39,$a,39,10);



Re: [module porting] mod_proxy

Posted by Graham Leggett <mi...@sharp.fm>.
"Philippe M. Chiasson" wrote:

> HAving heard about people complaining about mod_proxy implementation, I
> was wondering if there is already work being done on porting to 2.0.

I've just finished a patch to fix most of the proxy problems and upgrade
it to HTTP/1.1. It's in testing right now, and the next step is to port
it to v2.0.

> The reason is because I would be interested in trying to port it, as well
> as add some features taken from mod_backhand, including:
> 
> +Shared Connection pools
> +Potentially find a way to proxy outside of the apache children somehow.
> (I think it's not necessary to tie up an httpd children to proxy content)

I'm not sure what you mean by proxy outside apache children?

> +More control over the actual proxying
> +Including optionnaly a Proxied-For: header

What does Proxied-For do? Is it similar to the Via header?

Regards,
Graham
--