Avoid receive timeout type pollution#3332
Open
He-Pin wants to merge 1 commit into
Open
Conversation
e3d0b39 to
3838449
Compare
Motivation: The ActorCell receive timeout path allocates on every message and misclassifies timer messages, causing unnecessary timeout rescheduling and state churn. Modification: - Avoid type pollution in the receive timeout hot path - Guard timer receive timeout classification Result: Reduced allocations and correct timeout behavior for actors using receive timeouts. Tests: - Existing ActorCellReceiveTimeoutSpec References: Refs apache#1668
3838449 to
8ce7dbc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Identifyimplements bothAutoReceivedMessageandNotInfluenceReceiveTimeout. On JVMs affected by JDK-8180450, alternating successful checks against those two secondary supertypes makes the same concreteKlasssecondary-super cache ping-pong between marker types. The checks occur on the Actor receive-timeout path and can contend across actor-dispatcher threads.The receive path also classified the same message against
NotInfluenceReceiveTimeouttwice.Modification
Identifywith a concrete-class guard before theNotInfluenceReceiveTimeoutmarker check.Result
Receive-timeout behavior remains unchanged, while
Identifyno longer alternates the concrete class secondary-super cache between its two marker interfaces. The final path also performs one classification instead of two.JMH throughput (
ops/us, 12 threads, 3 forks, 5 x 1 s warmup and measurement iterations):JDK 21.0.8 and JDK 25 contain the JVM fix, so their remaining gain primarily measures the removed classification/call rather than secondary-super-cache contention. The JDK 25 result was noisier than the other runs.
References
Refs #1668