Just cross-posting this from stackoverflow 
<http://stackoverflow.com/questions/38454970/connection-pooling-with-xorm-and-go-mysql>
 
and github <https://github.com/go-xorm/xorm/issues/422>:-

I am using xorm 0.4.3 with go-mysql <https://github.com/go-sql-driver/mysql>. 
We are on Golang 1.4.

We have specified maxIdleConnetions and maxOpenConnections in xorm as 
below:-

var orm *xorm.Engine
...
orm.SetMaxOpenConns(50)
orm.SetMaxIdleConns(5)

And we are using the same single xorm instance to query Mysql.

But still we are seeing lot of connections in TCP Connection Establised state 
which is way over the numbers I have configured in maxIdleConnetions and 
maxOpenConnections state when we lsof:-

app 8747 10568 sandeshsharma 16u IPv4 691032 0t0 TCP 
127.0.0.1:57337->127.0.0.1:mysql (ESTABLISHED)

We have also observed that even if we stop the MySQL, the connection 
numbers still remain fixed but in the CLOSED_WAIT state. If we shutdown the 
app then all connections go away.

app 8747 10844 sandeshsharma 38u IPv4 505058 0t0 TCP 
127.0.0.1:54160->127.0.0.1:mysql (CLOSE_WAIT)

However in mysql process list it is showing the correct number of 
connections as I have specified in maxIdleConnetions and maxOpenConnections.

Can some one please explain me this behaviour? Why are we observing so much 
TCP connections even though we have specified maxIdleConnetions and 
maxOpenConnections to 5 & 50 respectively?




-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to