TechEmpower/FrameworkBenchmarks — pull request #194 by chrisfarms (2013-04-23 12:44:22+00:00)
Title: Potential improvement for Go (RE: Issue #149)

RE: Issue #149

The major problem with the Go test appears to be that it opens far too many concurrent database connections then struggles to decide which ones to use to run the statement.

Go's database/sql package does not let you put an upper limit on the number of connections that are opened, so it is up to you to rate-limit there usage.

Unfortunately even this is tricky as there is no direct access to individual connections. However by abusing database transactions we can sort-of work around this.

This patch, shows a way to open `MAX_CON` connections, and only use those connections for making queries. This should drastically improve the performance of the db test. As a rule of thumb I've found about 25 connections per core to be quite enough, after that it seems the scheduler starts getting a bit fed up with all the switching.

There are [improvements](https://code.google.com/p/go/issues/detail?id=4805&q=sql.db&colspec=ID%20Status%20Stars%20Priority%20Owner%20Reporter%20Summary) in upcoming Go versions that should also be relevant.