Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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][client] PIP-393: Improve performance of Negative Acknowledgement #23600
base: master
Are you sure you want to change the base?
[improve][client] PIP-393: Improve performance of Negative Acknowledgement #23600
Changes from 10 commits
fa42e8f
e7f9ccb
b06cba6
f711cf1
29fc52c
f04fc84
bd8a230
3fe4e3c
347fbfd
b6431eb
d6b00bb
bc492cf
28251b2
e759912
1cfbb34
24f6c4f
0ab4b42
ed27ff4
0ee1a54
294079c
612e31b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be necessary to update
pulsar-client-shaded
andpulsar-client-all
shading configuration to shade these libraries since they haven't been used on the client by now.Avoiding client jar growth is something that we would need to address when adding new dependencies.
I realized that including the
fastuti
library will increase the client jar file size significantly. One detail about fastutil is that there's a smaller library alternativefastutil-core
which includes a subset of the classes.fastutil
is about 23MB andfastutil-core
is about 6MB.Picking only the classes that are needed from fastutil is possible with
minimizeJar
with maven's shade plugin, but sinceminimizeJar
is a global setting, it would require building a minimized version of fastutil for the client usage to pick only the classes are needed since applyingminimizeJar
to the complete Pulsar client jar would be a very large change which could break things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not familiar with the shade part, hope this commit modify correctly.
28251b2
I have update the dependency to
fastutil-core
.As for
minimizeJar
, it looks like we can minimize the size of jar to the minimum, but i think that we may improve pulsar with fastutil many places else, so some other data structures can be helpful too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment cannot be marked resolved before this is really addressed.
Due to the large size of both fastutil (23MB) and fastutil-core (6MB), It is necessary to add a new module that minimizes fastutil for the use of the shaded Pulsar client (in published pulsar-client and pulsar-client-all modules). The minimized fastutil module shouldn't be published to maven central at all, but it is necessary to make it a separate module since it's not possible to selectively minimize modules with the maven-shade-plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a later step that we minimize the fastutil, right?
Currently, we need to fix the shade problem, is it not enough with following code?
I will appreciate it if you can help to shade the fastutil dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you should use the
fastutil-core
instead offastutil
, and then we can make a new PR to reduce thefastutil-core
size.And then use
<include>it.unimi.dsi:fastutil-core</include>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nodece That's that's a solution that isn't optimal:
fastutil
library and it would result in duplicate librariesfastutil-core
andfastutil
in the same flat classpath.fastutil-core
library is also very large in size, ≅6MB. We only need a few classes from the library.The optimal solution would be to include only the classes from
fastutil
into the shaded pulsar-client and pulsar-client-all which are really used and needed.This could be achieved in many ways. One possible solution is to introduce an intermediate module for shaded pulsar-client and pulsar-client-all that isn't published to maven central at all. It would be used to minimize and include only the classes from fastutil which are required by pulsar-client shading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use nanoseconds? Then you need to use
System.nanoTime()
instead ofSystem.currentTimeMillis()
, theSystem.nanoTime()
is quickly based on JVM.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, with
negativeAckPrecisionBitCnt = 10
, we know that the redelivery time may be earlier at most 2^10=1024ms~=1s. We just trim the lower 8 bit to bucket the time.But with nano(
1ms=1000000ns
). we can't get a suitable conf value easily.ns
unit. As the tick time of the timer is 1ms, and the latency of message delivery is atms
level.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you consider 0 as the default value? Users may wish to submit later, which is consistent with previous behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to configure it as the best the confguration value. Without this enhancement, it is unrealistic to use negative acknowledgement in production. The memory occupation will inflate very fast.
But i will listen to the voice from the community, if more and more people think that disabling this feature by default is better, i will update it.