Quick revision
The short answer
Over ten years, the JDK's concurrent collections win by default: they are maintained with the JDK, tested on every supported platform, and survive upgrades without any work from us. Specialised libraries such as JCTools, Agrona and the LMAX Disruptor can deliver lower latency and far less allocation for specific patterns like single-producer queues, but they are extra dependencies, and some have historically relied on internal JDK APIs such as sun.misc.Unsafe, which adds upgrade risk. My policy would be JDK collections by default, specialised libraries allowed only in measured hot paths with a named owner and an upgrade plan, and a re-evaluation at each LTS upgrade of whether the gain still holds.
What to remember
In this answer, we weighed JDK concurrent collections against specialised libraries such as JCTools, Agrona and the LMAX Disruptor over a ten-year horizon. The JDK structures are maintained with the JDK, tested on every platform and survive upgrades for free; the specialised libraries can deliver lower latency and less allocation for specific patterns, but they are dependencies we must own, and some have relied on internal JDK APIs that are being closed. The policy is JDK collections by default, specialised libraries only in measured hot paths with an owner, an upgrade plan and an interface to fall back on, and a re-evaluation at each LTS upgrade.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Over ten years, the JDK's concurrent collections win by default: they are maintained with the JDK, tested on every supported platform, and survive upgrades without any work from us. Specialised libraries such as JCTools, Agrona and the LMAX Disruptor can deliver lower latency and far less allocation for specific patterns like single-producer queues, but they are extra dependencies, and some have historically relied on internal JDK APIs such as sun.misc.Unsafe, which adds upgrade risk. My policy would be JDK collections by default, specialised libraries allowed only in measured hot paths with a named owner and an upgrade plan, and a re-evaluation at each LTS upgrade of whether the gain still holds.
Why this question is asked
Teams building low-latency services, market data, telemetry pipelines, game servers, eventually hit the limits of general-purpose queues and discover libraries built for exactly their pattern. The benchmarks are impressive, and the request to adopt them arrives at the architecture group. A ten-year horizon changes the question from which is faster today to which choice will still be cheap to own after four JDK upgrades and two generations of engineers. Interviewers ask this at principal level to see how a candidate weighs performance against long-term cost and turns that into a policy people can follow. In this answer, we will recap what the specialised libraries offer, compare long-term costs, write the policy, and set up the regular re-evaluation.
1A Quick Recap of the Options
The JDK's java.util.concurrent package offers general-purpose structures: ConcurrentLinkedQueue, the blocking queues, ConcurrentHashMap and others. They are designed to be correct for any number of producers and consumers, on every platform, with every garbage collector.
The specialised libraries trade generality for speed. JCTools offers queues specialised by pattern, such as single-producer single-consumer or multi-producer single-consumer, often backed by preallocated arrays so they create no garbage per element. Agrona, from the team behind the Aeron messaging system, offers off-heap buffers, primitive collections and similar queues. The LMAX Disruptor is a ring buffer with preallocated event objects and configurable waiting strategies, built for pipelines where events pass through several stages. For their target patterns, these can cut latency and allocation dramatically compared with a linked queue that allocates a node per element.
2What Each Choice Costs Over Ten Years
The JDK collections are free to own. Their maintenance is done by the OpenJDK project, they are tested on every platform and with every collector the JDK supports, and when we move from Java 21 to Java 25 they simply keep working, often faster. Their weakness is that they are general: a linked queue allocates per element and handles cases our single-producer pipeline never has.
A specialised library is a dependency that we own in practice. Someone must track its releases, check it on each new JDK, and understand it well enough to debug it. Some of these libraries have historically used sun.misc.Unsafe, an internal JDK class, for direct memory access and ordered writes. The JDK is closing those doors: memory-access methods in sun.misc.Unsafe were deprecated for removal in recent releases and now produce warnings, with VarHandle and the foreign memory API as replacements. Well-maintained libraries have been migrating, but a version pinned five years ago may break on a new LTS. Check each library's current status for your JDK.
| Factor | JDK concurrent collections | Specialised library |
|---|---|---|
| Maintenance | Done by OpenJDK | Tracked by us; depends on a small team |
| Platform testing | Every JDK platform and GC | Whatever the project tests |
| JDK upgrades | No work | Check compatibility; internal API risk |
| Performance | Good general-purpose | Best for its specific pattern |
| Skills needed | Common Java knowledge | Specialist knowledge to tune and debug |
3The Policy
The policy I would set has a default and a gate. The default is JDK concurrent collections everywhere. No justification is needed to use them, and code reviews should question custom or exotic structures without a reason.
The gate allows a specialised library when four conditions hold. There is a measured hot path, shown by a profile or latency data from production or a realistic benchmark, where the JDK structure is the bottleneck. A benchmark, for example with JMH, shows the library delivers a gain that matters for the business, such as reducing p99 latency from 2 milliseconds to 300 microseconds on a market data path, not 5 percent on a path nobody waits for. A named team owns the dependency, including its upgrades. And the usage sits behind a small interface in our code, so we can switch back to the JDK structure in a day if the library is abandoned or breaks.
- Is the JDK structure the measured bottleneck?YesBenchmark the libraryNoUse the JDK structure
- Is the gain significant for the business?YesCheck ownershipNoUse the JDK structure
- Named owner and upgrade plan?YesApprove, behind an interfaceNoNot approved yet
- Record in the dependency registerre-evaluate at next LTS
4 steps in order. Play them, or step through them one at a time.
4Re-evaluating at Every LTS
Decisions made for performance reasons expire. The JDK keeps improving its own collections and runtime: virtual threads, better collectors such as generational ZGC, compiler improvements and occasional rewrites of the concurrent classes themselves. A gain measured on Java 11 may shrink or vanish on Java 25. So each approved library has a review at every LTS upgrade: rerun the benchmark that justified it, on the new JDK, against the JDK alternative.
If the gain still holds and the library supports the new JDK, it stays. If the gain has shrunk below what justifies a dependency, we switch to the JDK implementation behind the interface and remove the library. Over ten years, this keeps the number of specialised dependencies small and every one of them justified by current evidence rather than by history.
5An Example Decision
A telemetry team ingests 2 million events per second per instance through a multi-producer, single-consumer queue. Profiles show 30 percent of CPU in allocating and collecting ConcurrentLinkedQueue nodes, and GC pauses causing drops. A JMH benchmark shows an array-based MPSC queue from JCTools removes per-element allocation and cuts consumer latency by a factor of several. The team owns the pipeline and commits to the upgrade review. Approved, behind their EventQueue interface.
A web team asks to use the Disruptor for their request handling because it is fast. Their p99 is dominated by database calls at 40 milliseconds, and the queue accounts for microseconds. Not approved: the gain does not matter for their service, and the cost of owning the dependency would.
6Follow-up questions
Is it a risk that these libraries are maintained by small teams?
Yes, and it is part of the cost. Mitigations are choosing libraries with a track record and active releases, keeping usage behind our own interface, and having an owner who could, in the worst case, switch back to the JDK structure or maintain a fork for a short time.
Does the policy slow down teams that genuinely need performance?
Only slightly, and deliberately. The gate asks for a profile and a benchmark, which a team with a real performance problem already has. It mainly stops adoption based on blog benchmarks for paths where it does not matter.
How do you keep track of approved specialised dependencies?
In a dependency register, often the same place as license and security approvals, listing each library, the services using it, the owner, the justification benchmark and the next review date. Build tooling can flag uses of these libraries outside the approved modules.
7Conclusion
In this answer, we weighed JDK concurrent collections against specialised libraries such as JCTools, Agrona and the LMAX Disruptor over a ten-year horizon. The JDK structures are maintained with the JDK, tested on every platform and survive upgrades for free; the specialised libraries can deliver lower latency and less allocation for specific patterns, but they are dependencies we must own, and some have relied on internal JDK APIs that are being closed. The policy is JDK collections by default, specialised libraries only in measured hot paths with an owner, an upgrade plan and an interface to fall back on, and a re-evaluation at each LTS upgrade.
Open with
Over ten years I'd weigh total cost of ownership, not just speed. The JDK concurrent collections are maintained by OpenJDK, tested on every platform and garbage collector, and survive every upgrade with no work from us.
Then, if they want more
Libraries like JCTools, Agrona or the Disruptor really can be much faster for specific patterns, for example a single-producer or single-consumer queue backed by a preallocated array that creates no garbage, but they're dependencies we own in practice.
Someone has to track releases and test them on each new JDK, and some have historically relied on internal APIs like sun.misc.Unsafe, which the JDK has been deprecating, so an old pinned version can break on a new LTS. So my policy would be JDK collections by default, no justification needed.
A specialised library is allowed only where there's a measured hot path: a profile showing the JDK structure is the bottleneck and a benchmark showing a gain that matters to the business, like cutting p99 latency on a market data path, not a few percent on a path dominated by database calls.
It needs a named owning team, an upgrade plan, and it sits behind our own small interface so we can switch back quickly. Then at every LTS upgrade, the owner reruns the benchmark against the JDK alternative on the new version. If the gain has disappeared, which happens as the JDK improves, we switch back and drop the dependency. That keeps specialised dependencies rare and always justified by current evidence.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 25, Java 11, Java 21
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Some teams want to adopt specialised concurrent structures such as JCTools queues...": https://scrivio-interview-library.netlify.app/java/concurrent-collections/fb05c4dfce/