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

Make releasing objects back to Recycler faster #13174

Merged
merged 2 commits into from
Feb 2, 2023

Commits on Jan 31, 2023

  1. Make releasing objects back to Recycler faster

    Motivation:
    The Recycler implementation was changed in netty#11858 to rely on an MPSC queue implementation for delivering released objects back to their originating thread local pool.
    Typically, the release will often happen from the same thread that claimed the object, so the overhead of having a thread-safe release goes to waste.
    
    Modification:
    We add an unsynchronized ArrayDeque for batching claims out of the `pooledHandles`.
    This amortises `claim` calls.
    
    We then also re-introduce the concept of an owner thread (but by default only if said thread is a FastThreadLocalThread), and release directly into the claim `batch` if the release is from the owner thread.
    
    Result:
    The `RecyclerBenchmark.recyclerGetAndRecycle` benchmark sees a 27.4% improvement, and the `RecyclerBenchmark.producerConsumer` benchmark sees a 22.5% improvement.
    
    Fixes netty#13153
    chrisvest committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    90de5ce View commit details
    Browse the repository at this point in the history
  2. Apply suggestions from code review

    Co-authored-by: Norman Maurer <norman_maurer@apple.com>
    chrisvest and normanmaurer committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    f1f1597 View commit details
    Browse the repository at this point in the history