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

conncheck should be optional #996

Closed
methane opened this issue Sep 5, 2019 · 2 comments · Fixed by #1052
Closed

conncheck should be optional #996

methane opened this issue Sep 5, 2019 · 2 comments · Fixed by #1052
Milestone

Comments

@methane
Copy link
Member

methane commented Sep 5, 2019

Issue description

connCheck added in #934 allocates several objects.

./conncheck.go:22:16: leaking param: c
./conncheck.go:24:3: moved to heap: n
./conncheck.go:25:3: moved to heap: err
./conncheck.go:26:3: moved to heap: buff
./conncheck.go:37:18: func literal escapes to heap

Allocating 5 objects every time connection is checked out from the sql.DB is not good for performance. This can be a big performance regression.

Additionally, users may want to check liveness only after long idle.
Or Aurora users want to check SELECT @@innodb_read_only to detect fail over. ref.

@renthraysk
Copy link

buff could be shifted to inside the closure.

@julienschmidt
Copy link
Member

We can move even a bit more inside the closure: c016c38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants