-
Notifications
You must be signed in to change notification settings - Fork 356
General performance improvements #598
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
Conversation
Signed-off-by: Oleh Dokuka <[email protected]>
Signed-off-by: Oleh Dokuka <[email protected]>
@@ -490,8 +493,7 @@ private void handleFrame(int streamId, FrameType type, ByteBuf frame) { | |||
LimitableRequestPublisher sender = senders.get(streamId); | |||
if (sender != null) { | |||
int n = RequestNFrameFlyweight.requestN(frame); | |||
sender.increaseRequestLimit(n); | |||
sendProcessor.drain(); | |||
sender.request(n >= Integer.MAX_VALUE ? Long.MAX_VALUE : n); |
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.
tangential: I'm trying to remember where we specify this rule? Integer.MAX_VALUE == Inifinite? Reactor? Reactive Streams? RSocket?
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.
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 guess what I'm asking is whether this rule needs to migrate into the spec
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.
If it is not clarify that Int. Max Value should be considered as unbounded stream, then we have to mention that
rsocket-core/src/test/java/io/rsocket/fragmentation/FragmentationDuplexConnectionTest.java
Outdated
Show resolved
Hide resolved
Nice perf win! |
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.
LGTM - passing tests. One question about a release.
Signed-off-by: Oleh Dokuka <[email protected]>
Signed-off-by: Oleh Dokuka <[email protected]>
Signed-off-by: Oleh Dokuka <[email protected]>
f282b76
to
12669c7
Compare
Signed-off-by: Oleh Dokuka <[email protected]>
This reverts commit f55cf8f
This reverts commit f55cf8f Signed-off-by: Maksym Ostroverkhov <[email protected]>
* channel load test * Revert "General performance improvements (#598)" This reverts commit f55cf8f * use byte-count for frame positions Signed-off-by: Maksym Ostroverkhov <[email protected]> * resume token is ByteBuf Signed-off-by: Maksym Ostroverkhov <[email protected]> * Keep-alive connection, receiving remote implied position: replace Flux with simple onRemoteImpliedPosition(long) callback Signed-off-by: Maksym Ostroverkhov <[email protected]> * better performance with resume on Signed-off-by: Maksym Ostroverkhov <[email protected]> * keep alive handler: less allocations Signed-off-by: Maksym Ostroverkhov <[email protected]> * remove ResumptionState to reduce allocations Signed-off-by: Maksym Ostroverkhov <[email protected]> * remove ResumedFramesCalculator Signed-off-by: Maksym Ostroverkhov <[email protected]> * rename ResumeAwareConnection to ResumePositionsConnection Signed-off-by: Maksym Ostroverkhov <[email protected]> * ResumableDuplexConnection: use drain-queue for actions Signed-off-by: Maksym Ostroverkhov <[email protected]> * tests Signed-off-by: Maksym Ostroverkhov <[email protected]> * formatter Signed-off-by: Maksym Ostroverkhov <[email protected]> * cleanup: resume token is released in ClientRSocketSession instead of RSocketFactory KeepAliveConnection: dispose KeepAliveHandler in onClose() Signed-off-by: Maksym Ostroverkhov <[email protected]> * reduce allocations Signed-off-by: Maksym Ostroverkhov <[email protected]> * resume: fix race between send / release of frames on received implied position from keepalives replace state enum with constants remove unnecessary allocation make cleanup of store on keep-alive optional formatter Signed-off-by: Maksym Ostroverkhov <[email protected]> * remove unintended changes Signed-off-by: Maksym Ostroverkhov <[email protected]> * optimize KeepAliveConnection optimize ResumableDuplexConnection Signed-off-by: Maksym Ostroverkhov <[email protected]>
This reverts commit f55cf8f
This reverts commit f55cf8f Signed-off-by: Maksym Ostroverkhov <[email protected]>
This PR provides a list of dramatical performance improvements:
first
elements strategy. In all of those cases, usage of atomic was redundant since Reactive-Streams spec and Reactors implementation guarantees happens-before and serialized access to the object (Subscriber / Subscription) so having an additional object with volatile access is redundant and give more overheadBaseSubscriber
. Thus, this PR eliminates redundant transformations and minimize function flow. Also, dynamic invocations give its overhead, so there are upcoming changes in Reactor 3 (Macro-fusion in primitive operators reactor/reactor-core#1556) that improves performance as well.General bugfixes and improvements
Along with performance improvements, this PR introduces Jmh tests so you can run benchmarks locally and observe 10-20% perf improvements comparing to the previous implementation.
Finally, this PR provides a couple of bugfixes found during development and testing
Signed-off-by: Oleh Dokuka [email protected]