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

Issue #5108 - improve scalability of WebSocket SessionTrackers #5109

Merged

Conversation

lachlan-roberts
Copy link
Contributor

@lachlan-roberts lachlan-roberts commented Aug 3, 2020

Issue #5108

Use a set based on ConcurrentHashMap instead of CopyOnWriteArraySet for the WebSocket SessionTrackers.


The current data structure for SessionTracker is CopyOnWriteArraySet, which has the following description in the javadoc.

  • It is best suited for applications in which set sizes generally stay small, read-only operations vastly outnumber mutative operations, and you need to prevent interference among threads during traversal.
  • Mutative operations (add, set, remove, etc.) are expensive since they usually entail copying the entire underlying array.
  • Traversal via iterators is fast and cannot encounter interference from other threads.

This seems particularly badly suited to our use case.

  • We probably will not have a small set size.
  • Write operations usually outnumber the read operations. (assuming they don't call getSessions() very often).
  • It may be the case where we never iterate over the open sessions until doStop().

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…zed blocks

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@joakime joakime added this to In progress in Jetty 9.4.32 via automation Aug 3, 2020
@joakime joakime added Enhancement Sponsored This issue affects a user with a commercial support agreement labels Aug 3, 2020
@joakime joakime moved this from In progress to Review in progress in Jetty 9.4.32 Aug 3, 2020
Jetty 9.4.32 automation moved this from Review in progress to Reviewer approved Aug 4, 2020
@lachlan-roberts lachlan-roberts merged commit 8af767f into jetty-9.4.x Aug 4, 2020
Jetty 9.4.32 automation moved this from Reviewer approved to Done Aug 4, 2020
@lachlan-roberts lachlan-roberts deleted the jetty-9.4.x-5108-SessionTrackerScalability branch August 4, 2020 10:28
@sbordet sbordet linked an issue Aug 5, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Sponsored This issue affects a user with a commercial support agreement
Projects
No open projects
Jetty 9.4.32
  
Done
Development

Successfully merging this pull request may close these issues.

Improve SessionTracker scalability
4 participants