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

ZOOKEEPER-3709: Pre-Size Buffer in Learner Request Method #1267

Closed
wants to merge 1 commit into from

Conversation

jono-morris
Copy link
Contributor

Set the size of the ByteArrayOutputStream since it can be predetermined, to avoid dynamic expansion.

@jono-morris jono-morris changed the title Specify the size of the Output-stream before writing to it. ZOOKEEPER-3709: Specify the size of the Output-stream before writing to it. Feb 27, 2020
@jono-morris
Copy link
Contributor Author

Successfully run by connecting zookeeper client (zkCli.bat) to a Quorum of 3 servers.

@jono-morris jono-morris changed the title ZOOKEEPER-3709: Specify the size of the Output-stream before writing to it. ZOOKEEPER-3709: Pre-Size Buffer in Learner Request Method Feb 28, 2020
@maoling
Copy link
Member

maoling commented Mar 7, 2020

The pre-size seems like an optimization, but the calculation of buffer is a little trivial. If the size is far greater than 32(default value), this will have a significant effect to avoid growing capacity frequently, but in most cases, that size is small.

@jono-morris jono-morris closed this Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants