Skip to content

Let ObjectMappers callers select the Jackson buffer recycler pool#3511

Open
parker89 wants to merge 1 commit into
developfrom
pw/jackson-vthread-recycler-pool
Open

Let ObjectMappers callers select the Jackson buffer recycler pool#3511
parker89 wants to merge 1 commit into
developfrom
pw/jackson-vthread-recycler-pool

Conversation

@parker89

@parker89 parker89 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Adds ObjectMappers.RecyclerPoolType { THREAD_LOCAL, SHARED } and RecyclerPoolType-accepting overloads on the factory/mapper methods. Default is unchanged (THREAD_LOCAL = Jackson's default), so this is a pure, opt-in API addition.

Motivation: Jackson's default BufferRecycler pool is thread-local, which virtual threads defeat — each short-lived vthread reallocates its parse/generate buffers instead of recycling them (observed as ~900 MB/s of extra byte[]/char[] churn via BufferRecycler.balloc/calloc in a vthread service). Callers that run on virtual threads can now pass SHARED to get a thread-identity-independent pool.

The selection is an explicit caller decision rather than runtime thread detection: a caller that knows its execution model (e.g. witchcraft, which knows whether the request pool is virtual) picks the pool. Wiring it through the server (conjure-undertow Encodings) and, if desired, clients (dialogue-serde) is left to follow-up PRs in those repos.

@changelog-app

changelog-app Bot commented Jun 16, 2026

Copy link
Copy Markdown

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Route Jackson buffer recyclers to a shared pool on virtual threads

Check the box to generate changelog(s)

  • Generate changelog entry

@parker89 parker89 force-pushed the pw/jackson-vthread-recycler-pool branch from 70d91fb to 0d0bef0 Compare June 16, 2026 18:32
@parker89 parker89 changed the title Route Jackson buffer recyclers to a shared pool on virtual threads Let ObjectMappers callers select the Jackson buffer recycler pool Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant