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

[go/mysql] use sync.Pool for reusing bufio writers #4188

Closed
wants to merge 1 commit into from
Closed

[go/mysql] use sync.Pool for reusing bufio writers #4188

wants to merge 1 commit into from

Conversation

LK4D4
Copy link
Contributor

@LK4D4 LK4D4 commented Sep 7, 2018

I decided to split writers from #4186 because writers easier and not much to discuss about them.
Random queries benchmark after 60s run:

benchmark                            old ns/op     new ns/op     delta
BenchmarkParallelRandomQueries-8     12224441      12122521      -0.83%

/cc @sougou @danieltahara

"testing"
)

func TestWriter(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test where you have multiple writers. give them each an identifying string to write, and make sure that we don't have corrupt or unclean pooling behavior.

Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
writeCount := 10000

writeStrings := func(w bufioWriter, testWriter io.Writer) error {
for i := 0; i < writeCount; i++ {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a unique bit to the testString for each writer?

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 11, 2018

Closed by #4190

@LK4D4 LK4D4 closed this Sep 11, 2018
@LK4D4 LK4D4 deleted the recycle_writers branch September 11, 2018 14:25
systay pushed a commit that referenced this pull request Jul 22, 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

Successfully merging this pull request may close these issues.

2 participants