- Notifications
You must be signed in to change notification settings - Fork569
License
JCTools/JCTools
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Java Concurrency Tools for the JVM. This project aims to offer some concurrent data structures currently missing fromthe JDK:
SPSC/MPSC/SPMC/MPMC variations for concurrent queues:
- SPSC - Single Producer Single Consumer (Wait Free, bounded and unbounded)
- MPSC - Multi Producer Single Consumer (Lock less, bounded and unbounded)
- SPMC - Single Producer Multi Consumer (Lock less, bounded)
- MPMC - Multi Producer Multi Consumer (Lock less, bounded)
SPSC/MPSC linked array queues (bounded and unbounded) offer a balance between performance, allocation and footprint
MPSC/MPMC XAdd based, unbounded linked array queues offer reduced contention costs for producers (using XADD insteadof a CAS loop), and pooled queue chunks for reduced allocation.
An expanded queue interface (MessagePassingQueue):
- relaxedOffer/Peek/Poll: trade off conflated guarantee on full/empty queue state with improved performance.
- drain/fill: batch read and write methods for increased throughput and reduced contention
Many queues are available in bothUnsafe
(default, usessun.mic.Unsafe
) andAtomic
(relyingonAtomicFieldUpdater
) variations, as well asUnpadded
(lower footprint by removing false sharing avoiding fieldpadding).
There's more to come and contributions/suggestions are most welcome. JCTools has enjoyed support from the communityand contributions in the form of issues/tests/documentation/code have helped it grow.JCTools offers excellent performance at a reasonable price (FREE! under the Apache 2.0 License). It's stable and inuse by such distinguished frameworks as Netty, RxJava and others. JCTools is also used by commercial products to greatresult.
Add the latest version as a dependency using Maven:
<dependency> <groupId>org.jctools</groupId> <artifactId>jctools-core</artifactId> <version>4.0.3</version></dependency>
Or use the awesome, built from source,https://jitpack.io/ version, you'll need to add the Jitpack repository:
<repository> <id>jitpack.io</id> <url>https://jitpack.io</url></repository>
And setup the following dependency:
<dependency> <groupId>com.github.JCTools.JCTools</groupId> <artifactId>jctools-core</artifactId> <version>v4.0.3</version></dependency>
You can also depend on latest snapshot from this repository (live on the edge) by setting the version to'4.0.5-SNAPSHOT'.
JCTools is maven built and requires an existing Maven installation and JDK8 (only for building, runtime is 1.6compliant).
With 'MAVEN_HOME/bin' on the path and JDK8 set to your 'JAVA_HOME' you should be able to run "mvn install" from thisdirectory.
While you are free to copy & extend JCTools, we would much prefer it if you have a versioned dependency on JCTools toenable better support, upgrade paths and discussion. The shade plugin for Maven/Gradle is the preferred way to getJCTools fused with your library. Examples are available intheShadeJCToolsSamples project.
JCTools is benchmarked using both JMH benchmarks and handrolled harnesses. The benchmarks and related instructions canbefound in the jctools-benchmarks moduleREADME. Go wild and please let us know how it didon your hardware.
mvn packagecd jctools-concurrency-testjava -jar target/concurrency-test.jar -v
Experimental work is available under the jctools-experimental module. Most of the stuff is developed with an eye toeventually porting it to the core where it will be stabilized and released, but some implementations are kept purely forreference and some may never graduate. Beware the Jabberwock my child.
The best way to discuss JCTools is on the GitHub issues system. Any question is good, and GitHub provides a betterplatform for knowledge sharing than twitter/mailing-list/gitter (or at least that's what we think).
We have kindly been awardedIntelliJ IDEA licencesbyJetBrains to aid in the development of JCTools. It's a great suite of tools which hasbenefited the developers and ultimately the community.
It's an awesome and inspiring company,BUY THEIR PRODUCTSNOW!!!
JCTools has enjoyed a steady stream of PRs, suggestions and user feedback. It's a community! Thank you all for gettinginvolved!