Skip to content

Commit c87b315

Browse files
committed
Merge branch 'add_idle_test' of github.com:tanvikini/openj9-systemtest into add_idle_test
Signed-off-by: Tanvi Kini <[email protected]>
2 parents ec36c12 + b12b01f commit c87b315

File tree

5 files changed

+86
-22
lines changed

5 files changed

+86
-22
lines changed

openj9.build/makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,18 @@ test.SharedClasses.SCM23.MultiThread \
416416
test.SharedClasses.SCM23.MultiThreadMultiCL
417417
SHARED_CLASSES_TESTS:=$(filter-out $(EXCLUDE),$(SHARED_CLASSES_TESTS))
418418

419+
IDLE_TESTS:=test.IdleBenchMark_MinIdleWaitTime \
420+
test.IdleBenchMark_GcOnIdle \
421+
test.IdleBenchMark_CompactOnIdle
422+
IDLE_TESTS:=$(filter-out $(EXCLUDE),$(IDLE_TESTS))
423+
419424
TEST_TARGETS:=test.list \
420425
test.help \
421426
$(DAA_TESTS) \
422427
$(GC_TESTS) \
423-
$(SHARED_CLASSES_TESTS)
428+
$(SHARED_CLASSES_TESTS) \
429+
$(IDLE_TESTS)
430+
424431
TEST_TARGETS:=$(filter-out $(EXCLUDE),$(TEST_TARGETS))
425432

426433
.PHONY: build configure clean refresh_source test $(TEST_TARGETS)
@@ -447,6 +454,7 @@ test: $(TEST_TARGETS)
447454
test.daa: $(DAA_TESTS)
448455
test.gc: $(GC_TESTS)
449456
test.SharedClasses: $(SHARED_CLASSES_TESTS)
457+
test.idle: $(IDLE_TESTS)
450458

451459
test.list:
452460
echo Running target $@
@@ -534,15 +542,15 @@ test.SharedClasses.SCM23.MultiThreadMultiCL:
534542
echo Target $@ completed
535543
test.IdleBenchMark_MinIdleWaitTime:
536544
echo Running target $@
537-
$(STF_COMMAND) -test=IdleLoadTest -java-args="-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
545+
$(STF_COMMAND) -test=IdleLoadTest -test-args="variation=MinIdleWaitTime" $(LOG)
538546
echo Target $@ completed
539547
test.IdleBenchMark_GcOnIdle:
540548
echo Running target $@
541-
$(STF_COMMAND) -test=IdleLoadTest -java-args="-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
549+
$(STF_COMMAND) -test=IdleLoadTest -test-args="variation=GcOnIdle" $(LOG)
542550
echo Target $@ completed
543551
test.IdleBenchMark_CompactOnIdle:
544552
echo Running target $@
545-
$(STF_COMMAND) -test=IdleLoadTest -java-args="-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
553+
$(STF_COMMAND) -test=IdleLoadTest -test-args="variation=CompactOnIdle" $(LOG)
546554
echo Target $@ completed
547555

548556
help:

openj9.test.idle/docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openj9.test.idle
2+
- This project contains a stress version of the Idle Micro Benchmark test which aims to test the Idle detection and management feature available in J9 vm. For more information on the feature and related -XX JVM options, visit : https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.lnx.80.doc/diag/appendixes/cmdline/commands_jvm_xx.html.
3+
- The test has been written to have alternating active and idle cycles.
4+
- Active cycles are periods of time when the test will perform CPU and Memory Intensive operations to consume CPU cycles and Heap Memory.
5+
- Idle cycles are longer periods of time where the test sleeps/ performs no activity.
6+
- Idle detection and management are enabled/disabled via newly added JVM options.
7+
- The Idle detection feature is available on all platforms whereas Idle management feature is supported only on Linux x86 platforms.
8+
- The test exercises the newly added JVM options and checks if they behave as expected under stress conditions.
9+
10+
- There are 3 variations to this test
11+
12+
1. MinIdleWaitTime
13+
- Tests the -XX:IdleTuningMinIdleWaitTime option. This is the minimum amount of time the application needs to be idle to be detected as Idle.
14+
- Applicable on all platforms.
15+
- Uses the following Java arguments while running the test
16+
-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog
17+
18+
2. GcOnIdle
19+
- Tests the -XX:+IdleTuningGcOnIdle and when enabled, GC kicks in during the Idle cycle and reduces the footprint of the application.
20+
- Applicable only on Linux_x86-32 and Linux_x86-64 platforms as of now.
21+
- Uses the following JVM arguments while running the test
22+
-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
23+
24+
3. CompactOnIdle
25+
- Tests the -XX:+IdleTuningCompactOnIdle and when enabled, GC performs compaction on the heap during idle cycle to create contiguious free memory spaces for newer allocations.
26+
- Applicable only on Linux_x86-32 and Linux_x86-64 platforms as of now.
27+
- Uses the following JVM arguments while running the test
28+
-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog
29+

openj9.test.idle/src/test.idle/net/openj9/test/IdleMicroBenchmark.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ public static void main(String args[]) throws MalformedObjectNameException, IOEx
116116
if (optionValue.equals("transactional") || optionValue.equals("image") || optionValue.equals("spike")) {
117117
workloadType = optionValue;
118118
if (optionValue.equals("transactional")) {
119-
nThreads = 15;
119+
nThreads = 8;
120120
workloadTypeNum = 1;
121121
}
122122
if (optionValue.equals("image")) {
123-
nThreads = 10;
123+
nThreads = 5;
124124
workloadTypeNum = 3;
125125
}
126126
if (optionValue.equals("spike")) {
127-
nThreads = 5;
127+
nThreads = 3;
128128
workloadTypeNum = 0;
129129
}
130130
} else {
@@ -167,6 +167,7 @@ public static void main(String args[]) throws MalformedObjectNameException, IOEx
167167
try {
168168
IdleMicroBenchmark imbm1 = new IdleMicroBenchmark();
169169
long memoryLimitInBytes = memoryLimit * 1024 * 1024;
170+
//multiply sleepTime by 1000L to convert seconds to milliseconds as it is passed to Thread.sleep();
170171
sleepTime = sleepTime * 1000L;
171172
System.setProperty("isIdle", "false");
172173

@@ -219,7 +220,7 @@ public static void main(String args[]) throws MalformedObjectNameException, IOEx
219220
void induceCombinedLoad(int threads, int interval, int workloadTypeNum, long runFor, long memoryLimit, ExecutorService executor) {
220221

221222
List<Future<Long>> combinedWorkerList = new ArrayList<Future<Long>>();
222-
long stopRunning = System.currentTimeMillis() + 1000L * runFor;
223+
long stopRunning = System.currentTimeMillis() + 1000L * runFor;
223224
java.lang.management.MemoryMXBean membean = ManagementFactory.getMemoryMXBean();
224225
long heapInBytes = 0;
225226
int iter = 1;
@@ -264,12 +265,6 @@ void induceCombinedLoad(int threads, int interval, int workloadTypeNum, long run
264265

265266
System.out.println("CombinedLoad Load: Iteration: " + iter + ": Complete. Time: " + timeDiff + " Heap: " + heapInBytes);
266267

267-
try {
268-
//Thread.sleep(10000);
269-
} catch (Exception e) {
270-
e.printStackTrace();
271-
System.exit(1);
272-
}
273268
}
274269

275270
iter++;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<inventory>
22
<arbitraryJava class="net.openj9.test.IdleMicroBenchmark" method="runTest" methodArguments="--workload=transactional" />
33
<arbitraryJava class="net.openj9.test.IdleMicroBenchmark" method="runTest" methodArguments="--workload=image" />
4-
<arbitraryJava class="net.openj9.test.IdleMicroBenchmark" method="runTest" methodArguments="--workload=spike" />
4+
<!-- <arbitraryJava class="net.openj9.test.IdleMicroBenchmark" method="runTest" methodArguments="--workload=spike" /> --!>
55
</inventory>

openj9.test.load/src/test.load/net/openj9/stf/IdleLoadTest.java

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*******************************************************************************
1+
/******************************************************************************
22
* Copyright (c) 2017 IBM Corp.
33
*
44
* This program and the accompanying materials are made available under the
@@ -25,23 +25,44 @@
2525
import net.adoptopenjdk.stf.extensions.core.StfCoreExtension;
2626
import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo;
2727
import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface;
28+
import net.adoptopenjdk.stf.environment.StfTestArguments;
2829
import net.adoptopenjdk.stf.processes.ExpectedOutcome;
2930
import net.adoptopenjdk.stf.processes.definitions.JavaProcessDefinition;
3031
import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition;
3132
import net.adoptopenjdk.stf.processes.definitions.SystemProcessDefinition;
3233
import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator;
3334

3435
/**
35-
* This is a test plugin for Java.util related tests, it runs a workload of
36-
* test cases from the test.util project.
36+
* This is a test plugin to run the Idle Microbenchmark as a load test which runs
37+
* workloads from the test.idle project.
3738
*/
3839
public class IdleLoadTest implements StfPluginInterface {
40+
String jvmOptions;
41+
String testType;
3942
public void help(HelpTextGenerator help) throws StfException {
40-
help.outputSection("IdleLoadTest runs a workload of Java.util related tests.");
43+
help.outputSection("IdleLoadTest runs a CPU and memory intensive workloads to test working of the Idle tuning feature.");
4144
help.outputText("");
4245
}
4346

4447
public void pluginInit(StfCoreExtension test) throws StfException {
48+
StfTestArguments testArgs = test.env().getTestProperties("variation=[MinIdleWaitTime]");
49+
testType = testArgs.get("variation");
50+
if(testType.equals("MinIdleWaitTime")) {
51+
jvmOptions = "-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog";
52+
}
53+
else {
54+
String platform = test.env().getPlatform();
55+
if ( !platform.equals("linux_x86-64") && !platform.equals("linux_x86-32") ) {
56+
throw new StfException("This test is only applible on Linux_x86 platforms.");
57+
}
58+
if ( testType.equals("GcOnIdle") ) {
59+
jvmOptions = "-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog";
60+
}
61+
if ( testType.equals("CompactOnIdle") ) {
62+
jvmOptions = "-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog";
63+
}
64+
}
65+
4566
}
4667

4768
public void setUp(StfCoreExtension test) throws StfException {
@@ -52,11 +73,16 @@ public void execute(StfCoreExtension test) throws StfException {
5273
test.env().verifyUsingIBMJava();
5374

5475
String inventoryFile = "/openj9.test.load/config/inventories/idle/idleTest.xml";
55-
int threadCount = 3;
76+
int threadCount = 2;
5677
int numOfIterations = 12;
57-
int cpuCount = Runtime.getRuntime().availableProcessors();
78+
79+
// Numbr of iterations reduced to 6 for MinIdleWait time as 12 iterations cause an OOM with -Xmx=1024m
80+
if ( testType.equals("MinIdleWaitTime") ) {
81+
numOfIterations = 6;
82+
}
5883

5984
LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification()
85+
.addJvmOption(jvmOptions)
6086
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
6187
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
6288
.addProjectToClasspath("openj9.test.idle")
@@ -69,12 +95,18 @@ public void execute(StfCoreExtension test) throws StfException {
6995
// Copying the images folder to the results dir
7096
test.doCpDir("Copy pics to results dir", test.env().findTestDirectory("openj9.test.idle").childDirectory("src/test.idle/net/openj9/test/images"), test.env().getResultsDir().childDirectory("images"));
7197

98+
7299
test.doRunForegroundProcess("Run idle load test", "ILT", Echo.ECHO_ON,
73100
ExpectedOutcome.cleanRun().within("1h30m"),
74101
loadTestInvocation);
75102

76103
if ( test.getJavaArgs(test.env().primaryJvm()).contains("-verbose:gc") || test.env().getResultsDir().childFile("gc.verbose").asJavaFile().exists() ) {
77-
test.doCountFileMatches("Looking for string release free pages in gc logs", test.env().getResultsDir().childFile("gc.verbose"), numOfIterations, "type=\"release free pages\"");
104+
if ( testType.equals("GcOnIdle") ) {
105+
test.doCountFileMatches("Looking for string release free pages in gc logs", test.env().getResultsDir().childFile("gc.verbose"), numOfIterations, "type=\"release free pages\"");
106+
}
107+
if ( testType.equals("CompactOnIdle") ) {
108+
test.doCountFileMatches("Looking for string sys-start reason=vm idle in gc logs", test.env().getResultsDir().childFile("gc.verbose"), 1, "sys-start reason=\"vm idle\"");
109+
}
78110
}
79111
}
80112

0 commit comments

Comments
 (0)