|
Grinder Load Testing Framework Here is a "classroom" approach to making use of this free tool for performance testing, as if I'm leading you through it for the first time. Along the way, I point out internals and undocumented knowledge. reference LoadRunner terms. | Topics this page:
|
Download and Installation
I suggest that you create a private folder to put your project files, such as "grinder3", rather a default name such as "C:\grinder-3.0-beta29". Define an environment variable such as "GRINDERENV" to specify that location.
Download from grinder.sourceforge.net:
|
grinder-development archive Introduction to Jython Part 1 and Part 2 from IBM DeveloperWorks. |
|
Properties Configuration
grinder.processes=1 grinder.threads=2 grinder.runs=10 grinder.sourceforge.net/g3/getting-started.html To create a "log" folder to hold logs:
grinder.logDirectory=logs grinder.numberOfOldLogs=2 grinder.logProcessStreams=false To ...
grinder.jvm.classpath=build/classes;build/test grinder.jvm.arguments=-Dpython.home=/applications/jython-2.1 |
Communities discussing this
"performance-book-1.0"The "EPizza" folder contains "test_scripts.zip"The "Pet Store" folder contains files "grinder.properties" and "http-plugin-sniffer-post-340" |
|
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! |