nGrinder is an open-source distributed load testing platform developed by Naver. It manages the Controller and Agents through a web UI and makes complex scenarios easy to build with Groovy/Jython scripts.
nGrinder Practical Examples
Examples for the Controller-Agent setup, Groovy scripts, and Docker deployment.
View practical examples ânGrinder is an enterprise-grade distributed load testing platform that Naver built on the Grinder framework. It is used to validate the performance of large-scale services in Korea.
| Feature | Description |
|---|---|
| Web UI | Design ¡ run ¡ monitor tests in the browser |
| Distributed architecture | Generate large-scale load with a Controller + many Agents |
| Groovy/Jython | Build complex scenarios with JVM-based scripts |
| Script recording | Record real user behavior automatically through an HTTP proxy |
Connecting several Agents to one Controller allows horizontal scaling.
version: '3'
services:
controller:
image: ngrinder/controller:3.5.9
ports:
- "8080:8080"
- "16001:16001"
- "12000-12009:12000-12009"
volumes:
- ./ngrinder-home:/opt/ngrinder-controller
agent:
image: ngrinder/agent:3.5.9
links:
- controller
environment:
- CONTROLLER_ADDR=controllerdocker-compose up -d
# Open http://localhost:8080
# Default account: admin / adminTo run several Agents, scale out the agent service: docker-compose up --scale agent=3 -d
import static net.grinder.script.Grinder.grinder
import static org.junit.Assert.*
import static org.hamcrest.Matchers.*
import net.grinder.script.GTest
import net.grinder.plugin.http.HTTPRequest
import net.grinder.plugin.http.HTTPPluginControl
def test1 = new GTest(1, "API Test")
def request = new HTTPRequest()
test1.record(request)
class TestRunner {
public void __call__() {
def response = request.GET("https://httpbin.org/get")
assertThat(response.statusCode, is(200))
grinder.logger.info("Response: ${response.text}")
}
}import net.grinder.plugin.http.HTTPRequest
import HTTPClient.NVPair
def request = new HTTPRequest()
def headers = [new NVPair("Content-Type", "application/json")] as NVPair[]
class TestRunner {
void __call__() {
def body = '{"username": "user1", "password": "pass1"}'
def response = request.POST(
"https://api.example.com/login",
body.bytes,
headers
)
assert response.statusCode == 200
}
}While the test runs you can monitor TPS, mean response time, and error rate in real time.
An HTML report is generated automatically when the test finishes. Key metrics:
Tune Agent memory: raise the JVM heap with -Xms512m -Xmx1024m in the Agent settings to handle more VUsers.
Putting the Controller, Agents, and Target Server on the same machine will not give accurate results. Always separate them.