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

Too many alloc/memcpy in V2Batch #338

Open
fbacchella opened this issue Jun 27, 2018 · 1 comment
Open

Too many alloc/memcpy in V2Batch #338

fbacchella opened this issue Jun 27, 2018 · 1 comment
Assignees

Comments

@fbacchella
Copy link
Contributor

See

internalBuffer.capacity(internalBuffer.capacity() + size + (2 * SIZE_OF_INT));

It calls internalBuffer.capacity(...) for each message append in the batch. Internally, it probably uses an allocation and a memcopy. It should try to anticipate more events to come.

For example, ArrayList uses:
int newCapacity = oldCapacity + (oldCapacity >> 1);

Or it could be smarter and try to guess a possible maximum size.

@robbavey robbavey self-assigned this Jul 2, 2018
@PriestTomb
Copy link

I also encountered this problem, I used Filebeat to collect log data, and then sent to Logstash, each time sending 2048 messages, a total of 100MB size, logstash-input-beats will reallocated 2048 times, which will lead to more and more time-consuming.

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

3 participants