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

Change default RecylerPool implementation to newLockFreePool (from threadLocalPool) #1117

Closed
cowtowncoder opened this issue Sep 30, 2023 · 3 comments
Labels
2.17 Issues planned (at earliest) for 2.17
Milestone

Comments

@cowtowncoder
Copy link
Member

With #1089 (and related) completed, Jackson 2.16 both allows for configuring alternate RecyclerPools to use for buffer recycling and provides a set of alternatives, notably ones that do not use ThreadLocal for recycling.

To reduce likelihood of breakage, the default implementation for 2.16 remains ThreadLocal-based pool. This hopefully allows as to gather feedback, experiences by early adopters, on how alternative pools work (for example, Quarkus project is likely to experiment with alternatives). This, in turn, should let us decide on which alternative to use, along with global-vs-per-factory pools.
As the baseline, my icurrent thinking is that per-factory, unbounded/lock-free implementation might work well as the default.

@cowtowncoder cowtowncoder added the 2.17 Issues planned (at earliest) for 2.17 label Sep 30, 2023
@cowtowncoder
Copy link
Member Author

cowtowncoder commented Jan 14, 2024

Ok, to get discussion started, I will propose we will use:

  • JsonRecyclerPool.newLockFreePool()

as the default. This will have following benefits:

  • Per-factory instances to reduce chance of global contention
  • Has low baseline memory usage (for use cases where no recycling occurs)

Potential downside for using non-global/shared pool is that overall memory retention may be higher than with global/shared pools.

As with any choice this will not be the optimal choice for all use cases. I am looking forward to hearing alternative suggestions, comments.

@mariofusco
Copy link
Contributor

Note that this is blocked by FasterXML/jackson-databind#4321

@cowtowncoder
Copy link
Member Author

Note: issue @mariofusco outlined (thanks!) has been resolved now, so the default pool implementation may be changed.

@cowtowncoder cowtowncoder changed the title Change default RecylerPool implementation for Jackson 2.17 (to non-ThreadLocal based one) Change default RecylerPool implementation to newLockFreePool (from threadLocalPool) Jan 27, 2024
@cowtowncoder cowtowncoder added this to the 2.17.0 milestone Jan 28, 2024
cowtowncoder added a commit that referenced this issue Apr 20, 2024
cowtowncoder added a commit that referenced this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.17 Issues planned (at earliest) for 2.17
Projects
None yet
Development

No branches or pull requests

2 participants