3

Using golang's net/http server to handle connections, is there a pattern to better handle 10,000 keep alive connections with relatively low requests per second each?

my benchmark performance with something like Wrk is 50,000 requests per second, and with real traffic (from realtime bidding exchanges) I have a hard time beating 8,000 requests per second.

I know connection multiplexing from a hardware loadbalancer is possible, but it seems like the same type of pattern can be achieved in Go.

4

1 回答 1

1

You can distribute load on local and remote servers using an IPC protocol like JSON RPC through e.g. UNIX and TCP sockets.

Related: Go Inter-Process Communication

As to the performance bottleneck; it has been discussed extensively on the go-nuts mailing list. At the time of writing it is the runtime's goroutine scheduler and world-stopping garbage collector.

The core team has recently made major improvements to the runtime to alleviate this problem yet there still is room for improvement. To quote one example:

Due to tighter coupling of the run-time and network libraries, fewer context switches are required on network operations.

于 2013-09-06T14:54:12.923 回答