|
Grinder Load Testing Framework This page expands on grinder.sourceforge.net/g3/getting-started.html as a step-by-step "classroom" approach to installing, configuring, running, and making use of this free tool for performance testing. Along the way, I hope to point out internals and insights gained from experience. | Topics this page:
|
|
IntroductionGrinder Java load testing framework, downloaded from sourceforge.net/projects/grinder. It's described in J2EE Performance Testing with BEA WebLogic Server (Expert Press and now by APress 2002) by Peter Zadrozny, Philip Aston and Ted Osborne. Grinder3 (in Beta as of Dec 2006) uses the Jython scripting engine based on Python. | Phil Aston now tirelessly answers questions on these forums: Grinder-use forum Grinder-Use mail list on sourceforge grinder-development archive gmane.comp.java.grinder.user searchable archives. his article dated 11/11/2002 describes how the net.grinder.Console in CLASSPATH=/opt/grinder/lib/grinder.jar controls net.grinder.Grinder agents running on client machines. |
Download and Installation
At the time you read this, the version number may have likely moved on from "grinder-3.0-beta32" created December 14, 2006. But you get the idea...
If it's not already on your system, download and install:
Download from grinder.sourceforge.net the package "Grinder 3":
Both these zips contain folder "grinder-3.0-beta32", so you need to unzip them to the same folder (such as C:\ root), and accept the overwrite of common files.
| Agents read from a common network a share grinder.properties file which specifies the number of worker processes, threads, plug-ins, etc. |
Configuring Grinder
|
Invoke the Modules
The agent will finish immediately if the Console is not already invoked. Note: Ironically, the "grinder.py" default python script file is not provided by default. | The Grinder's "Console" is like LoadRunner's "Controller". It is the central program (on a "main" machine) which starts and stops load generator ("injector") worker processes which interpret and carry out Jython test scripts. During a test run, it collates the "samples" it receives, and displays statistics summarizing the activity. Unlike LoadRunner (which presents activity of all agents on a single screen), the status of each Grinder agent is presented on a separate window. Also, I haven't see where Grinder calculates all the analysis that LoadRunner provides (graphs of standard deviation, 90th percentile, median, etc.). |
Recording Scripts
Each recording session creates two files: httpscript.py and httpscript_test.py The latest beta records scripts with tests grouped into pages, making it easier to comment out whole pages at once.
|
|
Common Script Edits
Every Grinder script defines "TestRunner" class which instantiates each worker thread. That is repeatedly called for each test (iteration) of that thread.
def __call__(self):
Because these are Python scripts, each request must begin with two (and only two) tabs. The HTTPclient plug-in is used through the facade obtained from net.grinder.script import Test from net.grinder.script.Grinder import grinder from net.grinder.plugin.http import HTTPPluginControl from HTTPClient import NVPair from java.net import InetAddress The "Test" class imported above references "test0", "test1", etc. in the grinder.properties files referenced in these statements:
"Sport01" : Test(2, "Sport 1 posting"), "Sport02" : Test(3, "Sport 2 posting"), "Trading01" : Test(4, "Trading 1 query"), "LifeStyle01" : Test(5, "LifeStyle 1 posting"), Because test sequences are defined manually, inserting tests within a list would require the list to be manually renumbered
To reset:
To ...
instrumentedGetByName = test.wrap(InetAddress.getByName) class TestRunner:
To us a regular expression:
# ... result2 = pattern.search(target, 0) value = result2.group(1) # everything captured between the parens
|
| |||
Running Scripts
A single worker process can manage several worker threads. At the Console:
If the script has:
out = grinder.logger.LOG then Grinder creates (if it doesn't already exist) a folder named according to the grinder.properties file entry
grinder.logDirectory=logs Within this folder the agent stores several files for each test, named using the agent's machine name:
data_<machine name>-<test number>.log But before that, files left over from a previous run are renamed with a sequence number: out_<machine name>-<test number>.log00001 error_<machine name>-<test number>.log00001 The number of previous runs kept this way is controlled in grinder.properties file entry
grinder.numberOfOldLogs=2 |
These entries in the grinder.properties file overrides the default zero sleep time:
grinder.initialSleepTime=500 grinder.sleepTimeFactor=0.01 grinder.sleepTimeVariation=0.005
To add pauses within a Jython script:
To ...
| Your first name: Your family name: Your location (city, country): Your Email address: |
Top of Page
Thank you! |