Java Concurrent Stress Test

2019-03-21  本文已影响0人  yunpxu

The Java Concurrency Stress tests (jcstress) is an experimental harness and a suite of tests to aid the research in the correctness of concurrency support in the JVM, class libraries, and hardware.

All source code is available at github.

How to run jstress test

[yunpxu@yunpxu-mac IdeaProjects]$ mvn archetype:generate \
  -DinteractiveMode=false \
  -DarchetypeGroupId=org.openjdk.jcstress \
  -DarchetypeArtifactId=jcstress-java-test-archetype \
  -DarchetypeVersion=0.5 \
  -DgroupId=com.jcst \
  -DartifactId=jcst \
  -Dversion=1.0
<dependency>
    <groupId>org.openjdk.jcstress</groupId>
    <artifactId>jcstress-samples</artifactId>
    <version>${jcstress.version}</version>
</dependency>
[yunpxu@yunpxu-mac IdeaProjects]$ cd jcst/
[yunpxu@yunpxu-mac jcst]$ mvn clean package
java -jar target/jcstress.jar -h
java -jar target/jcstress.jar -t APISample -l
[yunpxu@yunpxu-mac jcst]$ java -jar target/jcstress.jar -t ConcurrencyTest
[yunpxu@yunpxu-mac jcst]$ java -jar target/jcstress.jar
[yunpxu@yunpxu-mac jcst]$ tree
.
├── jcst.iml
├── jcstress-results-2019-03-19-17-31-42.bin.gz
├── pom.xml
├── results
     ├── com.jcst.ConcurrencyTest.html
     └── index.html

Concepts

JCST Samples

You can check the sample source code from here.
You can run all the jcst samples with java -jar target/jcstress.jar, this may take about 30mins.

Environment and Test Configurations.png

API Sample

API Sample.png

Operation Atomicity

Concurrency Sample Operation Atomicity.png

ConcurrentHashMap

Concurrency Sample ConcurrentHashMap.png

JMM NatureAccessAtomicity

JMM Nature Access Atomicity.png

JMM UnNatureAccessAtomicity

JMM UnNature Access Atomicity.png

JMM Sample Word Tearing

Word Tearing.png

JMM Sample Coherence

Coherence.png

JMM Sample Partial Order

Partial Order.png

JMM Sample Total Order

Total Order.png

JMM Sample Finals

Finals.png

Reference

OpenJDK jcstress wiki

Jcstress samples

上一篇 下一篇

猜你喜欢

热点阅读