150 likes | 161 Views
The Grinder. A load-testing framework. 30.11.2006 - Daniel Maier. Table of Contents. What is the Grinder? How does the Grinder work? Where to get the Grinder? How to start the Grinder? The TCPProxy Examples. What is the Grinder?. The Grinder is a Java load-testing framework
E N D
The Grinder A load-testing framework 30.11.2006 - Daniel Maier
Table of Contents • What is the Grinder? • How does the Grinder work? • Where to get the Grinder? • How to start the Grinder? • The TCPProxy • Examples
What is the Grinder? • The Grinder is a Java load-testing framework • Tool to coordinate the activities of a test script across many machines • Uses the powerful scripting language Jython (Java implemention of Python )
How does the Grinder work? The Grinder is divided into three parts: • Agent processes: runs on each test-client machine and is responsible for managing the worker processes on that machine • Worker processes: Created by The Grinder agent processes, they are responsible for performing the tests • The console: Coordinates the other processes and collates statistics
Where to get the Grinder? Official Project Page: http://grinder.sourceforge.net Newest version is The Grinder 3 (beta version)
How to start the Grinder ? • Create a grinder.properties file on each test machine • Set your CLASSPATH to include the grinder.jar file which can be found in the lib directory on each test machine • Start the console on one test machine: java net.grinder.Console
How to start the Grinder ? • Start an agent processs on each test machine: java net.grinder.Grinder • Start the agent processes by using the console
The TCPProxy • The TCPProxy is a proxy process that you can place in a TCP stream between your browser and a server • The TCPProxy's main purpose is to automatically generate HTTP test scripts
The TCPProxy How to use the TCPProxy : • java net.grinder.TCPProxy -console -http > grinder.py • Where grinder.py is the output script file
The TCPProxy How to use the TCPProxy : • Setting up the proxy localhost:8001 in your browser • Do the things you want to record and click stop in the console
Examples: grinder.properties grinder.processes=5 grinder.threads=100 grinder.runs=1 grinder.logDirectory=log grinder.numberOfOldLogs=0 grinder.script=test1.py
Examples: Test Script # This example shows how many HTTP interactions can be grouped as a # single test by wrapping them in a function. from net.grinder.script.Grinder import grinder from net.grinder.script import Test from net.grinder.plugin.http import HTTPRequest from HTTPClient import NVPair # We declare a default URL for the HTTPRequest. request = HTTPRequest(url = "http://localhost:9998") def page1(): request.GET('/addcontact.php') request.GET('/index.html') request.GET('/aufgabe4.html') page1Test = Test(1, "First page").wrap(page1) class TestRunner: def __call__(self): page1Test()