Code Monkey home page Code Monkey logo

grinder's Introduction

The Grinder

The Grinder is a framework for running test scripts across a number of machines aimed at running load test. The framework is comprised of three types of process (or program): worker processes, agent processes, and the console. The responsibilities of each of the process types are:

  • Worker processes
    • Interprets test scripts and performs the tests.
      Each worker process can run many tests in parallel using a number of worker threads.
  • Agent processes
    • Long running process that starts and stops worker processes as required.
    • Maintains a local cache of test scripts distributed from the console.
  • The Console
    • Coordinates the other processes.
    • Collates and displays statistics.
    • Provides script editing and distribution.

Download

You can download the latest grinder version here

Grinder Architecture

As The Grinder is written in Java, each of these processes is a Java Virtual Machine (JVM).

The Grinder Processes

For heavy duty testing, you start an agent process on each of several load injector machines. The worker processes they launch can be controlled and monitored using the console. There is little reason to run more than one agent on each load injector, but you can if you wish.

Tests and test scripts

A test is a unit of work against which statistics are recorded. Tests are uniquely defined by a test number and also have a description. Users specify which tests to run using a test script. If you wish your scripts can report many different actions (e.g. different web page requests) against the same test, The Grinder will aggregate the results.

The script is executed many times in a typical testing scenario. Each worker process has a number of worker threads, and each worker thread calls the script a number of times. A single execution of a test script is called a run.

You can write scripts for use with the Grinder by hand. There are a number of examples of how to do this in the Script Gallery. See the Scripts section for more details on how to create scripts.

If you are creating a script to test a web site or web application, you can use the TCPProxy to record a browser session as a script.

Network communication

Each worker process sets up a network connection to the console to report statistics. Each agent process sets up a connection to the console to receive commands, which it passes on to its worker processes. The console listens for both types of connection on a particular address and port. By default, the console listens on port 6372 on all local network interfaces of the machine running the console.

If an agent process fails to connect to the console, or the grinder.useConsole property is false, the agent will continue independently without the console and automatically will start its worker processes. The worker processes will run to completion and not report to the console. This can be useful when you want to quickly try out a test script without bothering to start the console.

To change the console addresses, set the grinder.consoleHost and grinder.consolePort properties in the grinder.properties file before starting The Grinder agents. The values should match those specified in the console options dialog.

Output

Each worker process writes logging information to a file called host-n.log, where host is the machine host name and n is the worker process number.

Data about individual test invocations is written into a file called host-n-data.log that can be imported into a spreadsheet tool such as Microsoft ExcelTM for further analysis. The data file is the only place where information about individual tests is recorded; the console displays only aggregate information.

The final statistics summary (in the log file of each process) looks something like this:

Final statistics for this process:

              Successful
              Tests         Errors        Mean Test    Test Time
                                          Time (ms)    Standard
                                                       Deviation
                                                       (ms)
                                                       
Test 0        25            0             255.52       22.52
Test 1        25            0             213.40       25.15
Test 2        25            0             156.80       20.81         "Image"
Test 3        25            0             90.48        14.41
Test 4        25            0             228.68       23.97         "Login page"
Test 5        25            0             86.12        12.53         "Security check"
Test 6        25            0             216.20       8.89
Test 7        25            0             73.20        12.83
Test 8        25            0             141.92       18.36
Test 9        25            0             104.68       19.86         "Logout page"

Totals        250           0             156.70       23.32

The console has a dynamic display of similar information collected from all the worker processes. Plug-ins and advanced test scripts can provide additional statistics; for example, the HTTP plug-in adds a statistic for the content length of the response body.

Each test has one of two possible outcomes:

  1. Success. The number of Successful Tests for that test is incremented The time taken to perform the test is added to the Total.
  2. Error. The execution of a test raised an exception. The number of Errors for the test is incremented. The time taken is discarded.

The Total, Mean, and Standard Deviation figures are calculated based only on successful tests.

How do I start The Grinder?

It's easy:

  1. Create a grinder.properties file. This file specifies general control information (how the worker processes should contact the console, how many worker processes to use, ..), as well as the name of the test script that will be used to run the tests.

  2. Set your CLASSPATH to include the grinder.jar file which can be found in the lib directory.

  3. Start the console on one of the test machines: java net.grinder.Console

  4. For each test machine, do steps 1. and 2. and start an agent process: java net.grinder.Grinder

    The agent will look for the grinder.properties file in the local directory. The test script is usually stored alongside the properties file. If you like, you can specify an explicit properties file as the first argument. For example:

    java net.grinder.Grinder myproperties

The console does not read the grinder.properties file. It has its own options dialog (choose the File/Options menu option) which you should use to set the communication addresses and ports to match those in the grinder.properties files. The console process controls can be used to trigger The Grinder test scenario. Each agent process then creates child worker processes to do the work.

When you know a little more about the console, you can use it to edit and distribute properties files and scripts instead of copying them to each agent machine.

As the worker processes execute, they dynamically inform the console of the tests in the test script. If you start the console after the agent process, you should press the Reset processes button. This will cause the existing worker processes to exit and the agent process to start fresh worker processes which will update the console with the new test information.

Included below are some sample scripts, for both Unix/Linux and Windows, for starting grinder agents, the console, and the TCPProxy for recording HTTP scripts.

Windows

setGrinderEnv.cmd

set GRINDERPROPERTIES=(full path to grinder.properties)\grinder.properties
set CLASSPATH=%GRINDERPATH%\lib\grinder.jar;%CLASSPATH%
set JAVA_HOME=(full path to java installation directory)
PATH=%JAVA_HOME%\bin;%PATH%

startAgent.cmd

echo %CLASSPATH%
java -classpath %CLASSPATH% net.grinder.Grinder %GRINDERPROPERTIES%

startConsole.cmd

java -classpath %CLASSPATH% net.grinder.Console

startProxy.cmd

java -classpath %CLASSPATH% net.grinder.TCPProxy -console -http > grinder.py

##< Unix

setGrinderEnv.sh

GRINDERPATH=(full path to grinder installation directory)
GRINDERPROPERTIES=(full path to grinder.properties)/grinder.properties
CLASSPATH=$GRINDERPATH/lib/grinder.jar:$CLASSPATH
JAVA_HOME=(full path to java installation directory)
PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH PATH GRINDERPROPERTIES

startAgent.sh

. (path to setGrinderEnv.sh)/setGrinderEnv.sh
java -classpath $CLASSPATH net.grinder.Grinder $GRINDERPROPERTIES

startConsole.sh

#!/usr/bin/ksh
. (path to setGrinderEnv.sh)/setGrinderEnv.sh 
java -classpath $CLASSPATH net.grinder.Console

startProxy.sh

#!/usr/bin/ksh
. (path to setGrinderEnv.sh)/setGrinderEnv.sh
java -classpath $CLASSPATH net.grinder.TCPProxy -console -http > grinder.py

grinder's People

Contributors

csolesala avatar dependabot[bot] avatar omerlin avatar solcyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

grinder's Issues

[Test] Some Instrumentation tests are not working

To investigate why the following tests are not working

  • TestJython25Instrumenter.*
  • TestJython22Instrumenter.*
  • TestJavaDCRInstrumenter.testInstrumentClass()
  • TestJavaDCRInstrumenter.testWithNoPackage()
  • TestASMTransformerFactory.testConstructors()
  • TestASMTransformerFactory.testOverloading()
  • TestASMTransformerFactory.testVariedByteCode()

For the moment, they are ignored in the code.

Removing BlockingSender class

As a developer I would like to remove the class BlockingSender as it seems to be not used anymore so that I keep a clean code

[Test] After updating the HTTPPlugin to manage the TLSv1.2 some tests are failing

Some tests are failing, apparently related to TLSv1.2 implementation.
After a first analysis, I have the feeling recreating the default.keystore used to established the test SSL server may help

The failing tests are:

  • TestHTTPProxyTCPProxyEngine.testWithChainedHTTPSProxy()
  • TestHTTPProxyTCPProxyEngine.testHTTPProxyEngine()

For the moment, they are Ignored

Create Docker Image

As a Grinder User I would like to have a dockerized version of the Grinder, so that I can easily install it.

We would like to have a small docker image, Alpine Linux seems to be a good candidate
We would like to use OpenJDK
We would like to have the capability to mount a distribution folder that is already configured in Grinder image
We would like to have a way to overload the default grinder image configuration

Internationalise Grinder Messages

as a grinder user, I would like to have all grinder log messages in my local language, so that I can understand better the grinder status

[Web Console] Internationalization of the messages

We would like to have the Web console internationalized using the same messages as the Swing console.

The technology to put in place is different compare to the webconsole, because the local of the browser should be used instead of the server local.

Spring boot is capable to do such internationalization,

Packaging: Publish modules to sonatype

As a developer of a project dependent to the Grinder, I would like to have grinder artifacts accessible through sonatype so that I'm autonomous building my own project using maven.

Console: Add a log panel

As a grinder user I would like to have the log messages that currently go to terminal inside a dedicated UI panel, so that I don't have to keep an open terminal to understand a test issue.

In addition, start, stop test runs events should be reported.
Logs should be time stamped.
Use log to replace use of System.err for warnings.

Support JDK 11 and above

Grinder 4.X is limited on Java 8 due to the fact Grinder extends the Application ClassLoader by merging the URLs.
ince Java9, ApplicationClassLoader is not an URL ClassaLoader anymore.

blockingClassLoader should be reimplemented and lot of dependencies must be upgraded

Statitistics: Custom event management

As a grinder user I would like to fire my own event so that the console can report a count of this custom event

As a exemple: the Jython code can create a named event and fire the event when some condition was met. When the console polls for statistics the events and their count would be sent to the console.

Console: enhance the console editor

As a grinder user I would like to enhance the console editor so that I don't need to use an alternative editor to develop my tests:

Following features are requested:

  • Revert file.
  • Status bar.
  • Undo.
  • Copy and Paste menu items.
  • Specialised grinder properties editor.

Ignoring Content-type

Hello.
I have some api, which require set Content-type for GET request without request data. But grinder discard it
create_request(self, test, headers): request = HTTPRequest(url=self.host_url) headers.append(NVPair("Content-type", "application/json; charset=utf-8")) headers.append(NVPair("Accept", "application/json")) headers.append(NVPair("Protection-Token", "Protection-Token-Value")) request.setHeaders(headers) return request
I have found it place - HTTPClient.HTTPConnection#assembleHeaders
Could you fix it

No '=' found for token starting at position 227

Hi,

I have this cookie with HttpOnly:

csrf_x=f74735354645575672c37f4; expires=Tue, 16-Jun-2020 13:29:05 GMT; Max-Age=22000; path=/;Secure, x_session=1gasfstertwetr9345835i3mr8jkc5eth; expires=Tue, 16-Jun-2020 19:22:25 GMT; Max-Age=43200; path=/;HttpOnly;Secure

and is giving me this error:

in call
Caused by: java.net.ProtocolException: Bad Set-Cookie header: csrf_habitat=b610d461cd3c0397b3517604a375f2e6; expires=Tue, 16-Jun-2020 13:29:05 GMT; Max-Age=22000; path=/;Secure, Habitat_session=34e2m783bc537vkqfu3o9q9i5hdim7ru; expires=Tue, 16-Jun-2020 19:22:25 GMT; Max-Age=43200; path=/;HttpOnly;Secure
No '=' found for token starting at position 227

Can you help pls?

I tried to fix the problem in the code, but I have many errors in the build:

C:\Users\mchillitupa\git\grinder\grinder-core\src\main\java\net\grinder\console\editor\TextSource.java:52: error: bad use of '>'

  • @return true => the text has changed.

Can you tell me, why? is it maybe my JDK versión?

[Web Console] Use Base 64 encodded body to post file to be written on the backend

When saving a file using the web console, if the file contains some special character, the REST request fails and the file is not correctly saved,

Escaping the HTTP characters could be an option, however, I would prefers to post the file, in the rest request body, encoded in Base64. This way, we don't need anymore to care about the content.

Remark: the same mechanism could be implemented in the file retrieval

Console: Create a Web based Grinder Console Interface

As a Grinder user I would like to have a web based grinder console so that I'm able to run the grinder from a non graphical server.

This story is particularly useful when working on the cloud and/or with remote resources.

Simple Question

Dear contributors.

I have a simple question. When doing performance test, I prefer to using nGrinder based on grinder. So i am researching grinder source, And then i found two repository for grinder github and sourceforge. This is my question. What different between two repository?

Grinder Console: showing wrong statistics

Grinder Console is showing wrong TPS, we can reproduce it with the simple HelloWorld program.
Showing same TPS for all commands and Total also.

This issue started with the 3.11 version.

Script to reproduce issue:
hellow.py

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
log = grinder.logger.info
test1 = Test(1, "Log method")
test2 = Test(2, "Test1 method")
test3 = Test(3, "Test2 method")
logWrapper1 = test1.wrap(log)
logWrapper2 = test2.wrap(log)
logWrapper3 = test3.wrap(log)

class TestRunner:
def call(self):
tid = grinder.threadNumber

    if tid % 4 == 5:
    	logWrapper1("Test1 ThreadNumber:" + str(tid))
            grinder.sleep(2500)
    elif tid % 4 == 1:
    	logWrapper2("Test2 ThreadNumber:" + str(tid))
            grinder.sleep(200)
    else:
    	logWrapper3("Test3 ThreadNumber:" + str(tid))
            grinder.sleep(10)

Attached results screenshot for Grinder-4.0.0 and Grinder3.10
grinder4 0 0results
grinder3 10resultsscreenshot

LOCAL LOGS tab : auto refresh at load

When switching from another tab to Local logs, it can be nice to have an automatic refresh to see the last logs without hitting the refresh button

HTTPPlugin: Consider an alternative to ch.innovation:HTTPClient

As a grinder developer I would like to rely on a newer and better supported HTTP Client library to implement the HTTPPlugin, so that I can take advantage of the newer library community to maintain the Grinder HTTPPlugin

Instead of using:
http://www.innovation.ch/java/HTTPClient/index.html
http://www.innovation.ch/java/HTTPClient/FAQ.html

How about using Jakarta Commons HttpClient (more popular and Apache
License):
http://jakarta.apache.org/commons/httpclient/index.html

Reasons for HTTPClient:

  • Its solid, (and not 'alpha' which is the case for HttpClient).
  • Its small and comprehensible.
  • It is efficient.
  • Its extremely well written.
  • Its the incumbent.

Reasons for Commons HttpClient:

  • Its actively maintained.
  • It is more modular.
  • It is richer.

Reasons for HttpUnit:

  • nekohtml, parsing support

I prefer HttpClient, HTTPClient over HttpUnit for The Grinder as they are "closer to the wire".

Move console-service to SpringBoot

As a developer, I would like to have all the HTTP based services of the grinder based on spring boot, so that I have an homogeneous classpath

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.