Grinder : Load Testing Framework

What is Grinder?

The Grinder is a Java load-testing framework. It is freely available under a BSD-style open-source license. The Grinder makes it easy to orchestrate the activities of a test script in many processes across many machines, using a graphical console application. Test scripts make use of client code embodied in Java plug-ins. Most users of The Grinder do not write plug-ins themselves, instead they use one of the supplied plug-ins. The Grinder comes with a mature plug-in for testing HTTP services, as well as a tool which allows HTTP scripts to be automatically recorded.

How can I use it? A small tutorial…

  • download & extract grinder (also make sure you have java installed)
  • create a project directory where you’ll keep your scripts & config file(s)

    mkdir foo

  • we startup the TCPProxy, so we can record a session

    /path-to-java/bin/java -cp /path-to-grinder/lib/grinder.jar net.grinder.TCPProxy -console -http > foobar.py

  • we record the session, by doing the needed actions thru the TCPProxy

    Example: curl -g -D – -H Content-Type:application/myapp.xml -d@mymessagecontent ‘http://hostname:port/uri’ -x ‘localhost:8001’

  • press stop, and we’ll have a nice foobar.py script that contains what we did in the session
  • let’s adjust our properties file

    Example: user@gnu-linux:~/grinder-3.0-beta33/foo$ cat grinder.properties
    grinder.processes=10
    grinder.threads=5
    grinder.runs=1000
    grinder.useConsole=true
    grinder.logDirectory=log
    grinder.numberOfOldLogs=2
    #grinder.initialSleepTime=500
    #grinder.sleepTimeFactor=0.01
    #grinder.sleepTimeVariation=0.005
    grinder.script=foobar.py

    So 5 threads will handle 10 processes, and this will be iterated 1000 times. As script we’ll be using foobar.py. (NOTE: you may enter multiple scripts, each as a different property, not space delimited)

  • We’ll startup the console

    /path-to-java/bin/java -cp /path-to-grinder/lib/grinder.jar net.grinder.Console

  • Startup the agent

    /path-to-java/bin/java -cp /path-to-grinder/lib/grinder.jar
    net.grinder.Grinder /path-to-grinder/foo/grinder.properties

    7/11/07 5:05:04 PM (agent): The Grinder 3.0-beta33
    7/11/07 5:05:04 PM (agent): waiting for console signal

    NOTE: if you want multiple (remote) test machines, enter the console host/port in the properties file

  • In the console, select “Action” & “Start Processes” (make sure collection is showing “Stop collection, otherwise do “Start collection” first)
  • Check the magic… 😉
  • Grinder Console

9 thoughts on “Grinder : Load Testing Framework

  1. can elaborate the recording process a bit more in order to understand more on how to record. whether we should write the script or will it generate.?

  2. The script will be generated whilst recording:

    /path-to-java/bin/java -cp /path-to-grinder/lib/grinder.jar net.grinder.TCPProxy -console -http > foobar.py

  3. hi
    hi i am testing a zk app and the process what u have suggested till now is fine!!
    but what i nedd is if for. eg if i am load testing a login page and every time a thread is run, the data should be inserted in the database how to do that!!

    as of now the result is shown in the console, but i want to insert the result data from test to DB , how to do that? should i write a script for that and how to do that? and to see how the server behaves u know?? can u help me regarding this??? its urgent

  4. The Grinder is the best tool for performance testing. I’ve working on IDE for Grinder scripts – GrinderStone – which allows debug scripts using Eclipse and provides some interesting features for development like modularity and pretty useful logging in debug mode. This project you can download from official project site:

    http://code.google.com/p/grinderstone

    We also have Eclipse Update site for simple plugin installation into Eclipse platform. All details you can obtain on our site and support group. Look thru GrinderStone aand you’ll like it, it gives you more power to develop Grinder scripts.

  5. Hi,

    why you guys appriciate grinder it’s really a bad that nobody provide the complete running
    application. Means how can i use your folder or zip grinder-3.4 that you are provide us .

    Give me answer ASAP.

    ?

  6. how to distribute the loads in grinder..say if i have three scripts i have to distribute the load like 50% to the first script then 25% to the second , 25% to the third one..could anyone help me in this

  7. Can you specify number of simulated/concurrent users as what you have configured processes,threads and runs in above grinder.properties file.

    Thanks in advance,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.