In this tutorial, you will learn what is meant by Cycle Time and Think
Time and how you can add these to your workload. We will use the same
sampleweb workload that was created in the Creating
your
first Workload in Faban Tutorial. Please follow the steps in
the tutorial to install the samplewebapp. The workload can also be downloaded
but the application needs to be deployed and Faban started.
Cycle Time in Faban refers to the inter-arrival time between subsequent
requests that arrive at a server. For internet-based applications where
the user population is unknown, it makes sense to model cycle times
(rather than think times). Note that there is a subtle difference
between using think times and cycle times. In a load test that uses
think times, if the server slows down and response times increase, the
think times are still generated in the same manner giving the server
time to recover. But in a test that uses cycle times, if the response
time is large, the cycle time still remains the same - the emulated
user simply sleeps for a shorter time between requests (and in the
worst case where the response time is larger than the cycle time, will
not sleep at all) causing the load on the server to increase. This will
quickly result in excessive load on the server causing increasingly
larger response times. This is not necessarily a bad thing - it
can pin-point scalability problems in the server more quickly and help
you fix them.
Modeling Delays
Think times or cycle times are typically modeled using a negative
exponential
distribution with a mean time that is reasonable for
the particular operation. The distribution is truncated at 5 to 10
times the mean. If you truncate the distribution too early, you may not
get the specified mean. You may have to iterate a few times to figure
out the right values for your mean and max. times. The figure below
shows the measured cycle time distributions from an Olio (a web2.0 workload)
run. This workload uses a mean cycle time of 5 seconds and
truncates the distribution at 25 seconds.
Cycle Time Annotation
Enough of the theory. Let's see how to specify a delay between
subsequent requests made by an emulated user in Faban. This is done by
editing the Driver source code. Go to the directory containing the
sampleweb installation.
$
cd sampleweb
$ ls README
license.txt
build
nbproject
build.properties.template src
build.xml
webapp
deploy
$
Edit the driver source file in
src/com/testnscale/sampleweb/SampleWebDriver.java and find the
FixedTime annotation starting on line 54:
This annotation specifies a fixed think time of 0 seconds - basically,
the emulated user will simply cycle back to the next request without
any delay at all. The cycleDeviation
property specifies the percentage deviation allowed for this parameter
- Faban will automatically check if the actual delay times are within
the specified range and print the results in the summary report.
Change this to a negative exponential distribution with a mean cycle
time of 5 seconds as follows:
By default, Faban will truncate the distribution at 5 times the mean
(25 seconds for this case). If you want a larger maximum value, add a cycleMax property. Make sure you
delete the FixedTime annotation. Save the file.
Deploy and Run
Since we modified the driver, we must re-build and re-deploy the
workload. Check that your build.properties file has the right entries
and your Faban master is up.
$
ant deploy
Buildfile: build.xml
init:
compile:
Compiling 1 source file to
/Users/testnscale/sampleweb/build/classes
bench.jar:
[jar] Building jar:
/Users/testnscale/sampleweb/build/lib/sampleweb.jar
deploy.jar:
[jar] Building jar:
/Users/testnscale/sampleweb/build/sampleweb.jar