skip to content

Load Shaping

The elements that decide how many virtual users exist and when each request leaves the injector. Interviewers probe it because a plan's shape bounds what its run can prove.

on this pageshow

explore

questions

29

In JMeter's Uniform Random Timer, what pause do Constant Delay Offset 300 and Random Delay Maximum 700 produce?

level: juniorimportance: must knowfreq 72%

answer

  1. Two numeric fields, both in milliseconds
  2. One value is paid on every pause
  3. The other bounds a random component
  4. The thread sleeps for the sum

basics

~10 s

Each pause is 300 ms plus a uniformly drawn value between 0 and 700 ms, so the thread waits somewhere from 300 to 1000 ms before every sampler the timer holds.

solid answer

~40 s

`UniformRandomTimer` computes `Math.abs(random.nextDouble() * range + offset)`, where `range` is the **Random Delay Maximum** field and `offset` is the **Constant Delay Offset** field. Both are milliseconds. With 300 and 700 the pause is spread evenly over 300 ms to 1000 ms, every value in that window equally likely; the offset is a floor that is always paid, not a midpoint. In the `.jmx` the fields are saved as `ConstantTimer.delay` and `RandomTimer.range`, because `UniformRandomTimer` extends `RandomTimer`, which extends `ConstantTimer`. JMeter serves the timer *before* the sampler it is scoped to, and when several timers share a scope their delays are summed into one sleep.

code

xml · 5 lines
xml
<UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="Uniform Random Timer" enabled="true">
  <stringProp name="ConstantTimer.delay">300</stringProp>
  <stringProp name="RandomTimer.range">700</stringProp>
</UniformRandomTimer>
<hashTree/>

go deeper

for a junior

Recall that both fields are milliseconds and that the pause is offset plus a random draw capped by the maximum. Being able to state the 300 ms to 1000 ms window is the whole of the expected answer.

for a middle

Explain the mechanics: nextDouble scaled by the range, added to the offset, drawn per thread from ThreadLocalRandom, and stored in the .jmx under the inherited ConstantTimer.delay and RandomTimer.range names.

for a senior

Show that you check placement and arithmetic together: which samplers the timer holds, that timers in one scope sum into a single sleep, and that a non-numeric field degrades to zero rather than failing the run.

for a principal

Own the convention. Decide whether pause values are hard-coded per plan or parameterised, and whether the team relies on the timer.factor property to rescale them, since that lever reaches only the three random timers.

## The formula behind the two fields The Uniform Random Timer has exactly two numeric fields and it adds them: ```java // UniformRandomTimer.delay() return (long) Math.abs((getRandom().nextDouble() * getRange()) + super.delay()); ``` - `getRange()` is the **Random Delay Maximum** field, in milliseconds. - `super.delay()` is `ConstantTimer.delay()`, which returns the **Constant Delay Offset** field, in milliseconds. - `getRandom()` hands back `ThreadLocalRandom.current()`, so each thread draws independently and threads do not contend on one shared generator. `nextDouble()` yields a value in `[0.0, 1.0)`, so the random component lands in `[0, 700)` and the total in `[300, 1000)`. The distribution is flat: 310 ms and 940 ms are equally likely. The `Math.abs` call is inherited boilerplate here — with a non-negative offset and a non-negative range the sum can never go negative — but it matters in the sibling Gaussian timer. ## The random-timer family shares one base class All three random timers extend `RandomTimer`, so they reuse the same two stored properties and differ only in how the random component is drawn. | Timer | GUI field for the random part | What the field means | Second field | |---|---|---|---| | Uniform Random Timer | Random Delay Maximum | upper bound of a flat draw | Constant Delay Offset | | Gaussian Random Timer | Deviation | standard deviation of the draw | Constant Delay Offset | | Poisson Random Timer | Lambda | mean of the Poisson draw | Constant Delay Offset | The Constant Timer is the degenerate case: it has one field, **Thread Delay**, and returns it unchanged. ## What the .jmx actually stores Because the class hierarchy is `UniformRandomTimer -> RandomTimer -> ConstantTimer`, the saved property names do not match the class you dragged into the tree: ```xml <UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="Uniform Random Timer" enabled="true"> <stringProp name="ConstantTimer.delay">300</stringProp> <stringProp name="RandomTimer.range">700</stringProp> </UniformRandomTimer> ``` That is worth knowing when you grep a plan or diff one in review: searching for `UniformRandomTimer.range` finds nothing, and `ConstantTimer.delay` appears under the Gaussian and Poisson timers too. ## Where the timer applies A timer is not attached to an iteration; it is attached to a **scope**. JMeter serves every timer in a sampler's scope before that sampler runs, sums their delays, and sleeps once. Placement therefore decides everything: 1. As a child of one HTTP Request, the timer runs only before that request. 2. Directly under a Thread Group, it runs before *every* sampler in the group. 3. Under a controller, it runs before every sampler that controller holds. 4. With no sampler anywhere in its scope, it never runs at all. ## Traps this timer sets - **The offset is not optional in effect.** Leaving Constant Delay Offset empty gives you a pause between 0 and the maximum, which is a different profile from the one most people intend. - **A non-numeric field is silently zero.** Both fields are read through `getPropertyAsLong` / `getPropertyAsDouble`, whose string conversion catches `NumberFormatException` and returns `0`. Put an unresolved variable reference in the Constant Delay Offset and JMeter does not fail: the unset reference renders as the literal text `${PAUSE}`, the conversion returns `0`, and the run continues with only the random half of the pause. - **The values are milliseconds, not seconds.** `Random Delay Maximum` of `2` is two milliseconds. - **Two timers in the same scope add up.** Dropping a second Uniform Random Timer beside the first does not replace it; the thread sleeps for the sum of the two draws. - **`timer.factor` can rescale it behind your back.** That JMeter property multiplies the computed delay of the Uniform, Gaussian and Poisson timers, so a plan that pauses less than its fields say may be running on a machine where that property is set.

  • What does the Uniform Random Timer do if its Constant Delay Offset holds an unresolved ${PAUSE} reference?
    Nothing loud. An unset variable reference is not blanked out; it renders as the literal text ${PAUSE}. ConstantTimer reads the field with getPropertyAsLong, whose string conversion catches the NumberFormatException and returns 0, so the offset quietly becomes 0 ms and the run continues with only the random component.
  • Where do you place a Uniform Random Timer so it pauses before only one HTTP Request?
    Make it a child of that sampler. A timer applies to every sampler in its scope, so at Thread Group level it fires before all of them, and as a child of one request it fires only for that request. A timer with no sampler in its scope is never processed at all.

saying these in an interview costs you the question

  • Says the pause is between 0 and 700 ms, ignoring the offset entirely.
  • Treats Random Delay Maximum as the total pause rather than an addition.
  • Claims the timer runs after the sampler and its response.
  • Assumes an unparsable value in either field aborts the run.
  • Thinks two timers in one scope override each other instead of summing.
  • Reads the fields as seconds rather than milliseconds.
open as a page

In JMeter's Open Model Thread Group, what does the Schedule rate(10/sec) random_arrivals(5 min) run?

level: juniorimportance: must knowfreq 58%

basics

~20 s

A flat ten arrivals per second for five minutes. The rate step names the arrival rate, random_arrivals spans five minutes, and because no rate follows the span its end rate is taken to equal its start rate.

open as a page

Which thread groups does a stock Apache JMeter 6 download actually ship?

level: juniorimportance: must knowfreq 62%

basics

~10 s

Four: Thread Group, setUp Thread Group, tearDown Thread Group and Open Model Thread Group. The Concurrency, Arrivals, Free-Form Arrivals, Ultimate and Stepping groups are third-party, from the jpgc-casutg add-on.

open as a page

In JMeter's Thread Group, what do the Number of Threads and Ramp-up period fields set?

level: juniorimportance: must knowfreq 86%

basics

~20 s

Number of Threads sets how many JMeter threads run the plan concurrently. Ramp-up period sets how many seconds JMeter takes to start all of them. Each thread then walks the whole plan on its own.

open as a page

In JMeter's Constant Throughput Timer, what does a Target Throughput of 600 ask for?

level: juniorimportance: must knowfreq 70%

basics

~20 s

600 samples per minute, not per second, so ten a second. The field's unit is per minute, and by default the rate applies to each thread on its own, counting every sampler in the timer's scope.

open as a page

In JMeter, how do you make a pause happen after an HTTP Request rather than before it?

level: middleimportance: must knowfreq 58%

basics

~20 s

Not by moving it. A JMeter timer always runs before the sampler in its scope. Put it on the next sampler instead, or add a Flow Control Action set to Pause with Duration 0 and make the timer its child.

open as a page

In JMeter's Open Model Thread Group, what does a pause(2 min) step do to the arrival rate?

level: middleimportance: must knowfreq 52%

basics

~10 s

It schedules no new arrivals for two minutes and then restores the rate that was in force before it. The pause counts toward the thread group's total duration and is always honoured in full.

open as a page

In JMeter's bzm - Concurrency Thread Group, what does Ramp-Up Steps Count 5 do?

level: middleimportance: must knowfreq 57%

basics

~10 s

It cuts the ramp into five equal landings. With Target Concurrency 500 and Ramp Up Time 300 seconds the group holds 100, then 200, 300, 400 and finally 500 threads, sixty seconds per landing.

open as a page

In JMeter's Thread Group, what stops a thread first: Loop Count or the scheduler's Duration?

level: middleimportance: must knowfreq 71%

basics

~20 s

Whichever limit is reached first. JMeter stops a thread when its Loop Count is exhausted or the scheduler's Duration expires, so a finite Loop Count can end a run long before a scheduled hour is up.

open as a page

In JMeter's stock Thread Group, which field sets the request rate?

level: middleimportance: must knowfreq 68%

basics

~20 s

None of them. The stock Thread Group has no throughput field: Number of Threads caps how many threads run at once, and the rate the plan achieves is a result of the run rather than a setting.

open as a page

In JMeter's Constant Throughput Timer, what do the five Calculate Throughput based on options do?

level: middleimportance: must knowfreq 58%

basics

~20 s

They choose what the target rate is divided among: this thread alone, the current thread group, or every thread group, and whether each thread paces off its own last sample or off one clock shared by all of them.

open as a page

In JMeter's Gaussian Random Timer, is the Deviation field a cap on the extra pause?

level: middleimportance: should knowfreq 34%

basics

~20 s

No. Deviation is a standard deviation in milliseconds. JMeter scales a Gaussian draw of mean 0 and deviation 1 by that field, adds Constant Delay Offset and takes the absolute value, so individual pauses can exceed the Deviation figure.

open as a page

In JMeter's Synchronizing Timer, what does a Number of Simulated Users to Group by of 0 mean?

level: middleimportance: should knowfreq 50%

basics

~20 s

Zero means the whole Thread Group. JMeter leaves the barrier unsized until the first thread starts, then sizes it from that Thread Group's Number of Threads, so the timer releases only once every thread in the group has arrived.

open as a page

What does the Random Seed field of JMeter's Open Model Thread Group control?

level: middleimportance: should knowfreq 37%

basics

~20 s

It seeds the generator that decides where arrivals fall inside a random_arrivals span. Zero, the default, means an unseeded generator, so the instants differ on every run; any non-zero value makes the same schedule produce the same arrival instants each time.

open as a page

How does JMeter's jp@gc - Stepping Thread Group express a stepped profile?

level: middleimportance: should knowfreq 41%

basics

~20 s

As a fill-in-the-blank sentence: start this many threads, first wait, then start a burst, next add a portion every so many seconds using a ramp-up, then hold load, finally stop a portion every so many seconds.

open as a page

What does JMeter's Thread Group checkbox 'Same user on each iteration' change between iterations?

level: middleimportance: should knowfreq 41%

basics

~20 s

The checkbox declares whether a thread's next iteration is the same visitor or a new one. Ticked, which is the default, cookies, cache and the connection carry over the iteration boundary; cleared, they are reset each time.

open as a page

In JMeter's Precise Throughput Timer, what do Target throughput, Throughput period and Test duration set?

level: middleimportance: should knowfreq 48%

basics

~20 s

Target throughput divided by Throughput period is the arrival rate, so 600 over 60 seconds is ten a second. Test duration is the window the timer builds a schedule for; it does not end the test.

open as a page

Your JMeter checkout run goes quiet: a Synchronizing Timer set to 100 users never releases. What do you check?

level: seniorimportance: should knowfreq 42%

basics

~20 s

Check whether 100 threads can ever wait at that barrier together. With Timeout in milliseconds at 0 the barrier waits forever, so a group size above the Thread Group's thread count or threads that already finished will hang the run.

open as a page

A JMeter Open Model Thread Group run ends with failed, cut-short samples. What in the schedule causes that?

level: seniorimportance: should knowfreq 44%

basics

~20 s

The schedule ran out. An Open Model Thread Group interrupts its threads as soon as the last arrivals or pause step elapses, cancelling in-flight samplers, so those iterations land as failures. Append a pause step to buy them time.

open as a page

How many iterations does one thread run in JMeter's Open Model Thread Group?

level: seniorimportance: should knowfreq 33%

basics

~20 s

Exactly one. Each scheduled arrival gets its own thread, that thread walks the group's children once and exits, and the group's controller marks itself done after the first iteration. There is no loop-count field to change this.

open as a page

A JMeter plan using bzm - Concurrency Thread Group will not open on a fresh install. Why?

level: seniorimportance: should knowfreq 49%

basics

~10 s

The .jmx stores that element under its fully-qualified class name, and a stock install has no such class. JMeter cannot resolve it, so the whole plan fails to load rather than losing one element.

open as a page

A JMeter Thread Group ramps 200 threads over 300 seconds with Duration 3600. How long does the last thread sample?

level: seniorimportance: should knowfreq 47%

basics

~20 s

About 3,300 seconds. JMeter measures the scheduler's Duration from the group's start, so the five-minute ramp is spent inside the hour and the last thread, starting near 298.5 seconds, stops when all the others do.

open as a page

A JMeter Constant Throughput Timer targets 600 samples a minute but the run achieves 240 - what does the timer do about it?

level: seniorimportance: should knowfreq 54%

basics

~20 s

Nothing. A JMeter timer can only add delay, never remove it or add threads, so once it falls behind schedule it simply stops pausing. There is no catch-up burst, no warning and no failed sample.

open as a page

How would you decide whether a team's JMeter plans may depend on the Custom Thread Groups add-on?

level: principalimportance: should knowfreq 31%

basics

~20 s

Weigh what the add-on expresses that stock elements cannot against the cost: every machine that opens or runs a plan needs the same pinned jar, and without it the plan will not load at all.

open as a page

Standardising pacing across a team's JMeter plans, would you pick the Constant Throughput Timer or the Precise Throughput Timer?

level: principalimportance: should knowfreq 38%

basics

~20 s

Either is defensible; the reasoning is what matters. Choose the Constant Throughput Timer for evenly spaced rates and mid-run changes, the Precise Throughput Timer for randomised arrivals, exact sample counts and repeatable seeds. Neither creates threads.

open as a page

In a JMeter Open Model schedule, how does even_arrivals differ from random_arrivals?

level: middleimportance: nice to knowfreq 24%

basics

~20 s

Both take a duration and interpolate between the rate before and the rate after them. Only placement differs: random_arrivals scatters the arrival instants using the thread group's generator, while even_arrivals spaces them evenly from the start of the span.

open as a page

How do you drive JMeter's Ultimate Thread Group schedule from a property?

level: middleimportance: nice to knowfreq 21%

basics

~20 s

Set the JMeter property threads_schedule to a list of spawn(threads, initialDelay, startupTime, holdLoadFor, shutdownTime) directives. When that property is non-empty the element logs that the GUI profile will be ignored and builds its table from the property.

open as a page

In JMeter's Precise Throughput Timer, what do the Batched departures settings actually do?

level: seniorimportance: nice to knowfreq 22%

basics

~20 s

Number of threads in the batch releases that many threads on one scheduled arrival, and the timer divides the rate by the batch size so the average holds. The companion in-batch delay field is not applied in JMeter 6.0.0.

open as a page

How would you rescale every random pause in a JMeter plan without editing the .jmx?

level: principalimportance: nice to knowfreq 20%

basics

~10 s

Set JMeter's timer.factor property. It multiplies the delay computed by the Gaussian, Uniform and Poisson Random Timers, defaults to 1.0f, and leaves the Constant, Synchronizing, JSR223 and BeanShell timers untouched.

open as a page