Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database/sql: Too many TIME_WAIT sockets using Golang Connection Pool !!! #17476

Closed
duyanghao opened this issue Oct 17, 2016 · 1 comment
Closed

Comments

@duyanghao
Copy link

duyanghao commented Oct 17, 2016

What version of Go are you using (go version)?

go version go1.5.1 linux/amd64

What operating system and processor architecture are you using (go env)?

CentOS release 6.7 (Final)
3.10.5-3.el6.x86_64

What did you do?

i write a log server using Golang,it's main work is to insert each log from client request into remote mysql.
i use Golang sql as below:

 "database/sql"
  _ "github.com/go-sql-driver/mysql" 

And i use db as Golang document described below:

The returned DB is safe for concurrent use by multiple goroutines and maintains its own pool of idle connections. Thus, the Open function should be called just once. It is rarely necessary to close a DB.
https://golang.org/pkg/database/sql/#Open

What did you expect to see?

I expect to see many ESTABLISHED sockets under the circumstances of large concurrency.

What did you see instead?

There are many TIME_WAIT and few ESTABLISHED sockets in the http process!

@bradfitz
Copy link
Contributor

For questions on using Go, see https://golang.org/wiki/Questions

@mikioh mikioh changed the title Too many TIME_WAIT sockets using Golang Connection Pool !!! database/sql: Too many TIME_WAIT sockets using Golang Connection Pool !!! Oct 17, 2016
@golang golang locked and limited conversation to collaborators Oct 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants