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

Default buffer size is too small. #1414

Closed
methane opened this issue Apr 18, 2023 · 1 comment
Closed

Default buffer size is too small. #1414

methane opened this issue Apr 18, 2023 · 1 comment
Milestone

Comments

@methane
Copy link
Member

methane commented Apr 18, 2023

Issue description

Current default buffer size is 4K. It is too small.
This buffer size is grow when receiving large packet. But when receiving huge numbers of rows, this size is not grown.

mysqlclient default buffer size is 16KiB.
https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_net-buffer-length

@methane
Copy link
Member Author

methane commented Apr 18, 2023

I added a benchmark to query 10k rows in #1415.
I can not find significant performance difference between 4k and 16k buffer.
Maybe, it is because I used virtual network in macbook. (I used Rancher Desktop and Docker MySQL)
I need to run this benchmark with real network.

goos: darwin
goarch: arm64
pkg: github.com/go-sql-driver/mysql
                           │  buf4k.txt   │           buf16k.txt            │
                           │    sec/op    │    sec/op     vs base           │
ReceiveMassiveRows/query-8   5.698m ± ∞ ¹   5.719m ± ∞ ¹  ~ (p=1.000 n=1) ²
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

                           │   buf4k.txt   │            buf16k.txt            │
                           │     B/op      │     B/op       vs base           │
ReceiveMassiveRows/query-8   859.8Ki ± ∞ ¹   859.8Ki ± ∞ ¹  ~ (p=1.000 n=1) ²
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

                           │  buf4k.txt   │           buf16k.txt            │
                           │  allocs/op   │  allocs/op    vs base           │
ReceiveMassiveRows/query-8   50.00k ± ∞ ¹   50.00k ± ∞ ¹  ~ (p=1.000 n=1) ²
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal

@methane methane added this to the v1.8.0 milestone May 24, 2023
@methane methane closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
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

No branches or pull requests

1 participant