The poor man's benchmarker is a set of pyton script and java code to benchmark different kafka configuration and generate graphs from the result. It's composed of two utilities
- python bench.py: An utility to start benchmarking Kafka
- python graph.py: An utility to render graphs from the benchmark results
The following application need to be available in your path as a prerequisites:
- gcc: Requirement for matplotlib
- python-devel: Requirement for matplotlib
- pip: To install all required libraries
- kafka-topics: Used in the benchmarker to create and delete topic
- maven: Used to build the java driver
To install the required libraries in python, please execute:
pip install -r requirements.txt
To compile the java driver, please execute:
(cd java/driver && mvn package)
# Sequentially execute all test in the "properties" directory
python bench.py
# Execute the tests provided
python bench.py <test1.json> <test2.json>
# Render a graph of the result
# Note: You need to have a user interface running (e.g. X11)
python graph.py <result.out>
Global configuration and properties are available in the configuration.json file. If you need to configure different properties for the KafkaConsumer or KafkaProducer (e.g. TLS configuration, Authentication, etc...), put all the required properties in this file in a JSON format. Note: the bootstrap.servers is a required attributes. Example of configuration:
{
"bootstrap.servers": "localhost:9092"
}
Test has to be written in JSON and the following keys are required:
- test: name of the test to execute, ensure that your name is unique as the result will be written in a file named .out
- type: either producer, to test KafkaProducer, or consumer, to test KafkaConsumer
- properties: containing all the properties that need to be specified for KafkaProducer or KafkaConsumer
You could use an array in property value, in this case all different combination of value will be tested by the benchmarker. For example, if you specify { a: [1, 2], b: [1, 2]}
, the following tests would be performed: {a: 1, b: 1}
, {a: 1, b: 2}
, {a: 2, b: 1}
and {a: 2, b: 2}
.
{
"test": "batchsizeandlinger",
"type": "producer",
"properties": {
"linger.ms": [1,2,3,4,5,6,7,8,9,10],
"batch.size": [1024,8192,16384,32768,65536,131072,262144,307200,409600,524288,624288,624288,724288,824288,924288,1048576]
}
}