In today’s world of e-business, e-governance, e-revenue and e-commerce, performance testing helps identify bottlenecks, improves response times, sets fault tolerance and helps to recover from failures. This helps in improving the customer satisfaction and increase the business value significantly. Grinder is one of the many open-source performance testing frameworks, which can be used to performance test your software effectively and efficiently.
- The Grinder is a free Java-based load-testing framework available under a BSD-style open-source license.
- Grinder is a performance testing framework, not just a tool. It is a framework that enables you to tailor the tests according to your needs.
- Along with Jmeter, Grinder is one of a few performance testing solution which supports testing for e-mail protocols such as SMTP/POP3
- Supported by Blazemeter, a famous cloud-based testing service.
- Grinder has a generic approach towards load testing anything based on Java APIs. This includes testing custom protocols, application servers, HTTP web servers, and more.
- It follows a flexible scripting approach with test scripts written in powerful Jython and Clojure languages (https://clojure.org/). Jython is Python that runs on Java Virtual Machine which means that you are using Java multi-threading (https://www.jython.org/) .
- It has a distributed framework that allows multiple load injectors with a centralized script editing and distribution.
- It automatically manages client connections and cookies.
- It uses TCP proxy to record network related activities.
- It uses the power of Python and Java API to create test scripts.
How it works
Grinder runs test scripts across a number of machines. 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:
- Interprets test scripts and performs the tests.
- Each worker process can run many tests in parallel using a number of worker threads.
- Long running process that starts and stops worker processes as required.
- Maintains a local cache of test scripts distributed from the console.
- Coordinates the other processes.
- Collates and displays statistics.
- Provides script editing and distribution.
As The Grinder is written in Java, each of these processes is a Java Virtual Machine (JVM).
Sample Grinder script
The following simple script will tell a worker process to open the url of ‘https://tms.nashtechglobal.com’. The measured performance will be output into a text file:
from net.grinder.script.Grinder import grinder from net.grinder.script import Test from net.grinder.plugin.http import HTTPRequest test1 = Test(1, "Open NashTech TMS") request1 = HTTPRequest() test1.record(request1) class TestRunner: def __call__(self): result = request1.GET("https://xyz.nashtechglobal.com/") # result is a HTTPClient.HTTPResult. We get the message body # using the getText() method. writeToFile(result.text) # Utility method that writes the given string to a uniquely named file. def writeToFile(text): filename = "%s-page-%d.html" % (grinder.processName, grinder.runNumber) file = open(filename, "w") print >> file, text file.close()
Grinder test result
The ‘Grinder Console’ screen-shot is the result after running the simple script mentioned above
Compare with other tools
The attached table shows the feature comparison between Grinder and the other popuplar open-source performance testing tools.
The Grinder is suitable for programmers/testers who are familiar with Python programming languages. The ability to distributed the test via Console/Agent mechanism makes it flexible in simulating many performance test scenarios. It is free under BSD license and platform-independent.