i wrote a tls program which acts like a https reverse proxy, receiving
https requests and transfer them to http backend.
but it's performance is so bad, benchmark is as follows:
Transactions: 95 hits
Availability: 100.00 %
Elapsed time: 9.09 secs
Data transferred: 0.06 MB
Response time: 6.60 secs
Transaction rate: 10.45 trans/sec
Elapsed time: 9.09 secs
Data transferred: 0.06 MB
Response time: 6.60 secs
Transaction rate: 10.45 trans/sec
i configured nginx as a reverse proxy, and the benchmark is:
Transaction rate: 340.48 trans/sec
both test ares under the same environment, length of public rsa key is
2048 bits, so the ssl handshake is very cpu intensive. but i can't believe
go's performance is so bad. what's the problem?
the code is as follows:
package main
import (
"flag"
"net/http"
"net/http/httputil"
"net/url"
"time"
"log"
)
func main() {
var src, dst string
flag.Parse()
args := flag.Args()
if len(args) >= 1 {
dst = args[0]
} else {
dst = "127.0.0.1:8080"
}
if len(args) == 2 {
src = args[1]
} else {
src = ":80"
}
u, e := url.Parse(dst)
if e != nil {
log.Fatal("Bad destination.")
}
h := httputil.NewSingleHostReverseProxy(u)
s := &http.Server{
Addr: src,
Handler: h,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Fatal(s.ListenAndServeTLS("/home/work/nginx/conf/server.crt",
"/home/work/nginx/conf/server.key.unsecure"))
}--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.