@@ -88,7 +88,7 @@ void runAppOnce(TestConfig config, Agent agent) throws Exception {
88
88
writeStartupTimeFile (agent , start );
89
89
90
90
if (config .getWarmupSeconds () > 0 ) {
91
- doWarmupPhase (config );
91
+ doWarmupPhase (config , petclinic );
92
92
}
93
93
94
94
long testStart = System .currentTimeMillis ();
@@ -115,28 +115,37 @@ private void startRecording(Agent agent, GenericContainer<?> petclinic) throws E
115
115
"jcmd" ,
116
116
"1" ,
117
117
"JFR.start" ,
118
- "settings=profile " ,
118
+ "settings=/app/overhead.jfc " ,
119
119
"dumponexit=true" ,
120
120
"name=petclinic" ,
121
121
"filename=" + outFile
122
122
};
123
123
petclinic .execInContainer (command );
124
124
}
125
125
126
- private void doWarmupPhase (TestConfig testConfig ) {
127
- long start = System .currentTimeMillis ();
128
- System .out .println (
129
- "Performing startup warming phase for " + testConfig .getWarmupSeconds () + " seconds..." );
130
- while (TimeUnit .MILLISECONDS .toSeconds (System .currentTimeMillis () - start )
131
- < testConfig .getWarmupSeconds ()) {
126
+ private void doWarmupPhase (TestConfig testConfig , GenericContainer <?> petclinic ) throws IOException , InterruptedException {
127
+ System .out .println ("Performing startup warming phase for " + testConfig .getWarmupSeconds () + " seconds..." );
128
+
129
+ // excluding the JFR recording from the warmup causes strange inconsistencies in the results
130
+ System .out .println ("Starting disposable JFR warmup recording..." );
131
+ String [] startCommand = {"jcmd" , "1" , "JFR.start" , "settings=/app/overhead.jfc" , "dumponexit=true" , "name=warmup" , "filename=warmup.jfr" };
132
+ petclinic .execInContainer (startCommand );
133
+
134
+ long deadline = System .currentTimeMillis () + TimeUnit .SECONDS .toMillis (testConfig .getWarmupSeconds ());
135
+ while (System .currentTimeMillis () < deadline ) {
132
136
GenericContainer <?> k6 =
133
137
new GenericContainer <>(DockerImageName .parse ("loadimpact/k6" ))
134
138
.withNetwork (NETWORK )
135
139
.withCopyFileToContainer (MountableFile .forHostPath ("./k6" ), "/app" )
136
- .withCommand ("run" , "-u" , "5" , "-i" , "25 " , "/app/basic.js" )
140
+ .withCommand ("run" , "-u" , "5" , "-i" , "200 " , "/app/basic.js" )
137
141
.withStartupCheckStrategy (new OneShotStartupCheckStrategy ());
138
142
k6 .start ();
139
143
}
144
+
145
+ System .out .println ("Stopping disposable JFR warmup recording..." );
146
+ String [] stopCommand = {"jcmd" , "1" , "JFR.stop" , "name=warmup" };
147
+ petclinic .execInContainer (stopCommand );
148
+
140
149
System .out .println ("Warmup complete." );
141
150
}
142
151
0 commit comments