Hi there,
We are trying to build a TLS termination reverse proxy and load balancer in Go, while simultaneously
benchmarking it against Nginx 1.6.1.
Our first test was to configure both Nginx and our reverse proxy to be a plain simple HTTP reverse
proxy (no load balancing yet), with the Go version being a 3-lines source file which used
httputil.NewSingleHostReverseProxy(). Both Nginx and the Go version performed equally the same, as
expected.
Then, we tried to add SSL/TLS to the mix and we observed a significant drop in performance. We
configured both proxies to accept connections only over TLS 1.0, with different cipher suites
including RC4-SHA, using sslyze [1] to ensure that both servers were configured the same way.
Nginx always ran with a single worker process while we changed GOMAXPROCS between 1 and 8 and
whatever the default value is.
The test server has a 24-core (real + hyper-threading) Intel Xeon CPU with plenty of RAM. The test
"backend server" that sits behind Nginx and the Go proxy is a 5-line application which simply
replies with '42'.
We ran test with both 'ab' and
blitz.io which consistently reported between 1.8x and ~3.0x
performance drop of the Go version compared to Nginx. We think this result is probably due to Go's
TLS stack, since with plain HTTP both Nginx and Go performed nearly the same, but we'd like to have
confirmation from the Go development team.
We tried both Go 1.3 and the current development version from Hg (revision b18ebcb9f236) with little
to no difference (the development tip gives slightly worse, and insignificant, results compared to
1.3).
Any idea on how we could improve the situation?
Thanks in advance
[1]:
https://github.com/iSECPartners/sslyze