|
Assuming the JVM running service B has our metering instrumentation agent deployed we can introduce delay by simply enabling our qos metering extension, defining a QoS service then mapping it to a QoS resource and finally controlling service reservations using either rate limiting or fixing the capacity artificially low. The degree of delay is controlled via a timeout setting on the service and its occurrence by the availability (more so unavailability) of capacity at the resource.
The configuration below introduces a delay up to a maximum value of 10 seconds (10,000 ms) for all entry point calls into the service codebase beyond the first call within each 1 second (1,000 ms) interval by replenishing the (non-renewal) resource ever second with 1 unit of reservation capacity. We can increase both the limit and interval properties on the resource to vary the call sample size and sequencing of the injected delay.
j.s.p.qos.enabled=true
j.s.p.qos.services=b
j.s.p.qos.service.b.name.groups=com.acme
j.s.p.qos.service.b.timeout=10000
j.s.p.qos.service.b.resources=d
j.s.p.qos.service.b.resource.d.shared=false
j.s.p.qos.service.b.resource.d.rate.limit=1
j.s.p.qos.service.b.resource.d.rate.interval=1000
Here is alternative configuration this one introducing a similar delay as above but for all concurrent calls above a degree of one by restricting the (renewal) resource reservation capacity to only 1. A benefit of this approach is that we increase the capacity slightly to allow both A and B to ramp-up and than introduce randomness into the call selection process by way of the typical fluctuating call concurrency.
j.s.p.qos.enabled=true
j.s.p.qos.services=b
j.s.p.qos.service.b.name.groups=com.acme
j.s.p.qos.service.b.timeout=10000
j.s.p.qos.service.b.resources=d
j.s.p.qos.service.b.resource.d.shared=false
j.s.p.qos.service.b.resource.d.capacity=1
There are many other possibilities with our amazing QoS for Apps technology including using concurrency barriers and latches attached to resources which has been detailed in the article Achieving Required Workload Levels in Performance Testing using QoS for Apps. |
|