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

Offer means to deliver a connection on its own event loop #247

Open
chemicL opened this issue Oct 14, 2024 · 0 comments
Open

Offer means to deliver a connection on its own event loop #247

chemicL opened this issue Oct 14, 2024 · 0 comments
Assignees
Labels
status/need-design This needs more in depth design work type/enhancement A general enhancement

Comments

@chemicL
Copy link
Member

chemicL commented Oct 14, 2024

Currently, the SimpleDequePool#drainLoop calls AbstractPool.Borrower#deliver for all the pending acquisitions on behalf of one thread that wins the race to increment the WIP flag.

There are two issues with this approach:

  • The deliver method calls actual.onNext(poolSlot) on the current Thread and whatever happens next is executed on behalf of the Thread that either requested a connection or a Thread that obtained a connection. That means that instead of using the event loop associated with the connection to evenly distribute the load, potentially a requestor's Thread is used and can lead to bottlenecks.
  • In highly concurrent scenarios when multiple Threads attempt to obtain an established connection from the pool, only one of them wins the WIP CAS comparison to gain exclusive access to deliver all the connections. And that happens on a single core.

The solution to both problems in reactor-netty is to instantly offload the following work with the connection onto its associated event loop. However, in case of r2dbc's drivers, they don't necessarily have the means to offload the work and instead fall into both problematic cases described above. In consequence limiting their scalability significantly.

The aim of this report is to research means to offload the delivery to different execution runtime that can be associated with the POOLABLE resource. Therefore, abstracting the strategy reactor-netty is performing in order to make it a recognized solution that other implementations can leverage.

@chemicL chemicL added type/enhancement A general enhancement status/need-design This needs more in depth design work labels Oct 14, 2024
@chemicL chemicL self-assigned this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-design This needs more in depth design work type/enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant