Repository navigation
Configurable recycler for pooled sessions - #1383
Open
sideeffffect wants to merge 2 commits into
Open
sideeffffect wants to merge 2 commits into
sideeffffect wants to merge 2 commits into
Conversation
Add `Session.Builder#withRecycler` to choose the recycler run on each session returned to the pool. The default stays `Recyclers.full`. Add `Recyclers.idle`, which only checks that the session is healthy and idle (no open or failed transaction) and closes evicted prepared statements. It does not run `UNLISTEN *` and `RESET ALL`, so it saves two statements per checkout. Closes typelevel#877 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JMH benchmark of a pooled session (pool of 1) with the full and the idle recycler: checkout+checkin alone, and checkout + one warm parameterized query + checkin. Needs the docker-compose Postgres. Results, `bench/Jmh/run -i 10 PoolRecyclerBench` (1 fork, 5x5s warmup, 10x5s measurement), local Postgres 11 in Docker, JDK 21, load average 3 to 4, ops/s: | Benchmark | full | idle | change | |----------------------|---------------|-----------------|--------| | checkoutCheckin | 10108 +- 162 | 109446 +- 6865 | 10.8x | | checkoutQueryCheckin | 5283 +- 116 | 10479 +- 293 | 2.0x | An earlier 5-iteration run gave the same picture for the query case (5259 vs 10487). Its full checkoutCheckin result was noisy (5721 +- 3444), with load average 23 at the start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sideeffffect
marked this pull request as ready for review
October 30, 2026 16:29
This branch has not been deployed
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.
Makes recycler configurable. Allows for avoiding
UNLISTEN *andRESET ALLto make it more performant.