Implementing Rump-Up Functionality for Performance Testing
The article explains the concept of Rump‑Up in performance testing, details the steps to modify multithreaded task and executor classes, and provides Java code examples that enable gradual load increase and controlled data collection for more accurate bottleneck identification.
In performance testing, the Rump‑Up feature allows testers to gradually increase system load, helping to observe behavior under varying pressure, identify bottlenecks, and avoid contaminating results with low‑load data.
Core concepts include incremental load increase, system behavior observation, and data‑collection control (disabling data capture during the ramp‑up phase).
Key implementation steps are:
Modify the multithreaded task class by adding a boolean countState switch to control response‑time recording and a CountDownLatch to synchronize thread start‑up.
Adjust the executor class to compute per‑thread start intervals based on total Rump‑Up time, launch threads sequentially with the calculated gap, and wait for the latch before enabling data collection.
During the Rump‑Up phase set countState to false (no data); after all threads are started, set it to true to begin recording response times.
Code examples :
Multithreaded task class:
public class ThreadTask implements Runnable {
public CountDownLatch rumpUpCountDownLatch;
public boolean countState = false;
public List
costTime = new ArrayList<>();
@Override
public void run() {
rumpUpCountDownLatch.countDown(); // decrement latch
try {
before();
while (true) {
if (ABORT.get() || needStop || executeNum >= totalNum) {
break; // stop condition
}
try {
if (countState) {
executeNum++;
long start = System.currentTimeMillis();
test();
long end = System.currentTimeMillis();
costTime.add((int) (end - start)); // record latency
} else {
test();
}
} catch (Exception e) {
if (countState) errorNum++;
e.printStackTrace();
}
}
after();
} catch (Exception e) {
e.printStackTrace();
} finally {
stopCountDownLatch.countDown(); // decrement stop latch
}
}
}Executor class:
public class TaskExecutor {
public CountDownLatch rumpUpCountDownLatch;
public int rumpUpTime; // total ramp‑up time in seconds
public TaskExecutor(List
tasks, String taskDesc, int rumpUpTime) {
this.tasks = tasks;
this.taskDesc = taskDesc;
this.rumpUpTime = rumpUpTime;
this.rumpUpCountDownLatch = new CountDownLatch(tasks.size());
for (ThreadTask task : tasks) {
task.rumpUpCountDownLatch = rumpUpCountDownLatch;
}
}
public void start() {
int gap = rumpUpTime * 1000 / tasks.size(); // interval per thread
for (ThreadTask task : tasks) {
poolExecutor.execute(task);
ThreadTool.sleep(gap); // pause between submissions
}
try {
rumpUpCountDownLatch.await(); // wait for all threads to start
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
tasks.forEach(f -> f.countState = true); // enable data collection
System.out.println("Rump‑Up结束, 开始执行测试任务!");
this.startTimestamp = System.currentTimeMillis(); // record start time
}
}By applying these modifications, the performance testing engine gains a functional Rump‑Up phase that simulates realistic load growth and starts data collection only after the ramp‑up completes, enabling more accurate performance analysis.
FunTester
10k followers, 1k articles | completely useless
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.