Time for another log on the "http proxy" bonfire.

I've been poking at this problem a long time and I think I may have cracked it.

Node should have the fastest HTTP load balancer, and it doesn't currently. The 
fastest open source HTTP balancer I know of is haproxy in TCP mode (does not 
fully parse HTTP). I've taken the same approach, not parsing HTTP, and pushed 
the first release today of hostproxy (https://github.com/mikeal/hostproxy).

hostproxy does not parse HTTP, it doesn't even parse headers other than host. 
It gives you an API to return a stream that the incoming connection will be 
piped to along with an API for inserting new headers (like x-forwarded-for).

var hostproxy = require('hostproxy')
  , net = require('net')
  ;

hostproxy(function (host) {  
  if (host === 'mysite.com') return net.connect(80, 'mysite.com')
  return net.connect(80, 'fallback.com')
}).listen(80)

There is still plenty of optimizing to be done. Lots of return early functions 
that aren't inlined and a few copies buffer copies that could get factored out 
but until I have a good way of benchmarking it I'm not comfortable poking at 
it. If people have some good benchmarking systems setup I'd love to know how it 
performs next to haproxy in TCP mode.

-Mikeal

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to