-
Notifications
You must be signed in to change notification settings - Fork 945
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
Improve command encoding of singular commands and command batches #212
Comments
In looking at the code - i think the write block needs to change to:
This eliminates the exception. It would also be useful to have an option to set the start value for the buffer since in general the calling program has a pretty good idea of the basic size of the command plus value. |
Hi @cwolfinger, Btw. there's an issue in your code since you create 2048 connections and you don't close them. |
CommandArgs now does not allocate a byte buffer to write command args as they are added but collects args in a list. Arguments are written to a buffer only when the command encoding is triggered to a buffer that is allocated outside of CommandArgs. This removes the need to know buffer sizes inside of CommandArgs.
Great - just tested and this seems to get rid of the exceptions. The test code was quick and dirty so not unexpected it leaked connections. |
CommandEncoder takes batch size into account when allocating memory for writing commands. Refactoring of SentTimes tracking. Command latency is stored within the command. Added comand wrapper interface to mark decorated commands.
Replace LinkedList by own array to implement a stack behavior optimized for the used operations. Use a ByteBufProcessor to parse long values. Add JMH benchmark.
Refactored command encoding, command args and command decoding. |
Hello with certain sized arguments the code always produces a BufferOverflow exception and triggers a buffer resize. The following program illustrates this behavior
When i hits 17 the overflow occurs.
It seems to me there is a bug in the first line of comparison:
if (buffer.remaining() < arg.remaining()) {
int estimate = buffer.remaining() + arg.remaining() + 10;
realloc(max(buffer.capacity() * 2, estimate));
}
It seems that it should be something like this:
if (buffer.remaining() < arg.remaining()+10)
I am not sure all of the combinations this is hit quite a bit ...
The text was updated successfully, but these errors were encountered: