Proxy in GO vs NGINX vs HAPROXY

8,943 views
Skip to first unread message

Max

unread,
Aug 2, 2012, 4:56:50 AM8/2/12
to golan...@googlegroups.com
HAPROXY and NGNIX are very popular and reliable proxies. There is no reason to avoid them.
But is it possible to create proxy in GO that will have similar performance?
(I do not think it is possible to overcome them)

It looks easy to implement software like proxy in Go.
But does it make sense to do it?

One reason to have proxy in Go is that it is possible to make complex rules in Go rather then in configure files.

Andreas Krennmair

unread,
Aug 2, 2012, 5:31:36 AM8/2/12
to Max, golan...@googlegroups.com
Hi,

Funny you bring up that up, because I recently implemented a proof-of-concept HTTP reverse proxy in Go: https://github.com/akrennmair/drunken-hipster

The reason for me wasn't gained performance, though, but to test out how easy such an implementation would be. I got the first prototype working in less than 40 minutes, so instead of diving into the nitty-gritty details of other software's configuration (and maybe even finding out that my specific requirements aren't met), I decided to roll my own tool. I think that's what makes sense about writing such things in Go, because it's so easy to get something going that does exactly what you want.

I can't argue about efficiency, though, as I haven't done any performance/load tests yet.

Regards,
Andreas Krennmair

Max

unread,
Aug 2, 2012, 5:48:39 AM8/2/12
to golan...@googlegroups.com, Max
Absolutely agree. I read that some HAPROXY document. Creator of HAPROXY describes memory management, pools, etc in that doc.
I felt like HAPROXY is very complex software.
They say it never crashed in production. (may be no seg fault, not sure)

HAPROXY is not able to balance HTTPS properly and in that case NGINX is advised.

I feel like writing proxy in Go is simpler then learning NGINX configure files. 

But if I need 10 times more powerful hardware for Go server then NGINX or GC delay will block server for seconds then NGINX make sense.

Kyle Lemons

unread,
Aug 2, 2012, 1:28:59 PM8/2/12
to Max, golan...@googlegroups.com
I suggest trying it and running a load test.  You probably won't get the same performance as NGINX, but you'll get a conformant HTTP server that does very well under load and is far more flexible :).

DisposaBoy

unread,
Aug 2, 2012, 1:29:54 PM8/2/12
to golan...@googlegroups.com
there is a reverse proxy util in http/httputil IIRC it's lot easier to just reuse it messing with nginx. I doubt you will have such performance requirements that will ever cause these gc pauses. I wrote a proxy server in go which basically just ties the various bits together like reverse http AMD https proxying cgi... one instance of this server runs while I work proxying various tools and websites I visit. just one of these tools get hit approx four times per second and this goes on for the whole day. if you wanted to know it's a db monitor page that just fires off Ajax requests constantly. this is on windows 32 bit. men peaks at about three or four megs depending on what page I go on as it also proxies an image cache as well.

Dave Grijalva

unread,
Aug 17, 2012, 4:56:48 PM8/17/12
to golan...@googlegroups.com
At ngmoco, we used falcore (http://github.com/ngmoco/falcore) to build a smart HTTP proxy.  It's been incredibly stable in production.  I believe Scott is going to talk about it at the next SF Go meet up.  You should try to make it if you're in the area.

-dave
Reply all
Reply to author
Forward
Message has been deleted
0 new messages