Skip to content

Commit

Permalink
Add raftkeeper bench
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed Jun 15, 2024
0 parents commit fbfca14
Show file tree
Hide file tree
Showing 17 changed files with 933 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# vim cache files
*.swp

# JetBrains project files
.idea

# ignore benchmark target file
target

31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# RaftKeeper Benchmark

It is a RaftKeeper or Zookeeper benchmark tool.

1. Install requirements (the following shows how to install in Ubuntu)
```
sudo apt-get update && sudo apt-get install openjdk-8-jdk maven
```

2. Build the benchmark tool

```
cd raftkeeper-bench && mvn package
```

3. Run benchmark test

```
cd target && unzip raftkeeper-bench-1.0-bin.zip && cd raftkeeper-bench-1.0-bin && \
bin/run.sh $nodes $parallel $payload_size $run_duration $mode
For example:
./run.sh "localhost:2181" 10 100 60 mix
Arguments:
nodes: RaftKeeper or ZooKeeper connection string
parallel: execution parallel
payload_size: znode value size
run_duration: run duration in second
mode: execution mode only 'create' or 'mix'
```
44 changes: 44 additions & 0 deletions bin/batch_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Run multiple benchmark testing and get report
#
# Usage:
# ./batch_run.sh $nodes $mode
#
# For example:
# ./batch_run.sh "localhost:2181" mix
#
# Get CSV report:
# ./batch_run.sh $nodes $mode | grep -A2 "Benchmark result" | grep -v "Benchmark" | grep -v "parallel" | grep -v '-'

nodes=$1 # RaftKeeper or Zookeeper connection string
mode=$2 # Execution mode, only 'create' or 'mix'

workDir=`dirname $0`

sequence=(`seq 1 5`)
for i in ${sequence[*]}
do
parallel=$(($i * 2))
./start.sh $parallel
sleep 1
done

sequence=(`seq 1 15`)

for i in ${sequence[*]}
do
parallel=$(($i * 20))
./start.sh $parallel
sleep 1
done

sequence=(`seq 2 10`)
for i in ${sequence[*]}
do
parallel=$(($i * 200))
./start.sh $parallel
sleep 1
done

echo "done!"
37 changes: 37 additions & 0 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Run benchmark testing
#
# Usage:
# ./run.sh $nodes $parallel $payload_size $run_duration $mode
#
# For example:
# ./run.sh "localhost:2181" 10 100 60 mix
#
# Arguments:
# nodes: RaftKeeper or ZooKeeper connection string
# parallel: execution parallel
# payload_size: znode value size
# run_duration: run duration in second
# mode: execution mode only 'create' or 'mix'

nodes=$1
parallel=$2
payload_size=$3
run_duration=$4
mode=$5

binDir=`dirname $0`
libDir=$binDir/../lib
confDir=$binDir/../conf

jars=(`ls $libDir`)

classpath='.'
for j in ${jars[*]}
do
classpath=$classpath:$libDir/$j
done
classpath=$confDir:$classpath

java -cp $classpath raftkeeper.Benchmark -c $nodes -p $parallel -s $payload_size -t $run_duration -m $mode
5 changes: 5 additions & 0 deletions conf/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
log4j.rootLogger=OFF,console
log4j.additivity.org.apache=true
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
90 changes: 90 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>raftkeeper</groupId>
<artifactId>raftkeeper-bench</artifactId>
<version>1.0</version>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.7.1</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>0.5.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.32</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptors>
<descriptor>src/main/resources/assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>raftkeeper.Benchmark</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>assembly-project</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
32 changes: 32 additions & 0 deletions result/Report-v2.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# RaftKeeper Benchmarks

You can use the Benchmark tool that comes with RaftKeeper to benchmark RaftKeeper performance. Below we compare the performance of ZooKeeper and RaftKeeper.



## Environment

```
Server: Docker - 16 cores, 32GB memory, 50GB NVMe disk
System: CentOS 7.9
Version: RaftKeeper 2.0.0, ZooKeeper 3.7.1
Cluster: RaftKeeper 3 nodes, ZooKeeper 3 nodes
Config: RaftKeeper log level warning, ZooKeeper log level warn, others is default
Test Data: every item is 100 bytes
```

## 1. Write request benchmark (Create-100%)

![benchmark-create-tps.png](../images/benchmark-create-tps.png)

![benchmark-create-avgrt.png](../images/benchmark-create-avgrt.png)

![benchmark-create-tp99.png](../images/benchmark-create-tp99.png)

## 2. Mixed request benchmark (create-10% set-40% get-40% delete-10%)

![benchmark-mixed-tps.png](../images/benchmark-mixed-tps.png)

![benchmark-mixed-avgrt.png](../images/benchmark-mixed-avgrt.png)

![benchmark-mixed-tp99.png](../images/benchmark-mixed-tp99.png)
131 changes: 131 additions & 0 deletions result/data-v2.0.0.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
1. zk create
thread_size,tps,avgRT(microsecond),TP90(microsecond),TP99(microsecond),TP999(microsecond),failRate
10,23500,431.0,400.0,600.0,2000.0,0.0
20,31900,637.0,600.0,1000.0,3200.0,0.0
30,32400,955.0,1000.0,1400.0,9100.0,0.0
40,33800,1220.0,1200.0,1600.0,21600.0,0.0
50,34850,1496.0,1500.0,2100.0,28700.0,0.0
60,28571,2128.0,2400.0,3400.0,31700.0,0.0
70,30000,2385.0,2600.0,3400.0,34400.0,0.0
80,32000,2624.0,3000.0,3400.0,34400.0,0.0
90,27000,3467.0,3400.0,4000.0,38900.0,0.0
100,26086,3865.0,3800.0,4500.0,41200.0,0.0
110,31428,3651.0,4200.0,5100.0,41000.0,0.0
120,30047,4029.0,4400.0,6200.0,43200.0,0.0
130,30952,4358.0,4900.0,6700.0,40500.0,0.0
140,30434,4679.0,5300.0,8200.0,45400.0,0.0
150,32608,4719.0,4900.0,5800.0,48800.0,0.0
160,34782,4783.0,5100.0,6000.0,46900.0,0.0
170,28333,6009.0,6400.0,7300.0,45800.0,0.0
180,28809,6463.0,6900.0,8000.0,43100.0,0.0
190,27142,7010.0,7200.0,8100.0,42900.0,0.0
200,27272,7464.0,7600.0,9400.0,44100.0,0.0
210,32307,6696.0,7200.0,10300.0,49400.0,0.0
220,26400,8406.0,8400.0,13200.0,45600.0,0.0
230,27600,8551.0,8800.0,13900.0,48000.0,0.0
240,26666,9259.0,9200.0,17800.0,46200.0,0.0
250,26785,9381.0,9500.0,15600.0,47400.0,0.0
260,27857,9613.0,9900.0,11000.0,48700.0,0.0
270,27523,9944.0,10300.0,11200.0,47500.0,0.0
280,28965,9853.0,10600.0,11800.0,48800.0,0.0
290,32222,9319.0,10800.0,11500.0,55500.0,0.0
300,27272,11186.0,11400.0,12800.0,67300.0,0.0

2. rk create
thread_size,tps,avgRT(microsecond),TP90(microsecond),TP99(microsecond),TP999(microsecond),failRate
10,13950,728.0,800.0,900.0,1900.0,0.0
20,24500,833.0,900.0,1100.0,1900.0,0.0
30,32350,946.0,1000.0,1200.0,2000.0,0.0
40,40150,1022.0,1100.0,1300.0,2400.0,0.0
50,45700,1118.0,1200.0,1500.0,2600.0,0.0
60,51750,1194.0,1300.0,1600.0,3000.0,0.0
70,54700,1325.0,1400.0,1800.0,3400.0,0.0
80,57100,1437.0,1500.0,2000.0,3300.0,0.0
90,59650,1552.0,1600.0,2300.0,4100.0,0.0
100,60000,1704.0,1800.0,2100.0,4400.0,0.0
110,60550,1838.0,1900.0,2300.0,4100.0,0.0
120,62809,1976.0,2000.0,2500.0,5500.0,0.0
130,65000,2089.0,2100.0,2600.0,5500.0,0.0
140,65190,2191.0,2300.0,2700.0,5900.0,0.0
150,64285,2346.0,2400.0,3000.0,6500.0,0.0
160,69800,2380.0,2500.0,3100.0,7700.0,0.0
170,69857,2531.0,2600.0,3400.0,12600.0,0.0
180,68428,2701.0,2800.0,3600.0,12800.0,0.0
190,69238,2793.0,3000.0,3500.0,11000.0,0.0
200,70000,2887.0,3100.0,3700.0,10200.0,0.0
210,70000,3023.0,3200.0,3900.0,7300.0,0.0
220,73333,3073.0,3300.0,4000.0,8600.0,0.0
230,72619,3206.0,3300.0,4100.0,16900.0,0.0
240,72904,3294.0,3500.0,4400.0,9300.0,0.0
250,75380,3414.0,3600.0,4400.0,9900.0,0.0
260,74590,3520.0,3800.0,4500.0,10200.0,0.0
270,73636,3676.0,3900.0,4500.0,8100.0,0.0
280,75590,3804.0,4100.0,4900.0,9200.0,0.0
290,78142,3867.0,4200.0,5000.0,10900.0,0.0
300,76571,4016.0,4400.0,5100.0,15800.0,0.0

3. zk mixed (create-10% set-40% get-40% delete-10%)
thread_size,tps,avgRT(microsecond),TP90(microsecond),TP99(microsecond),TP999(microsecond),failRate
10,29000,347.0,400.0,400.0,1100.0,0.0
20,50800,397.0,500.0,700.0,1900.0,0.0
30,59450,511.0,600.0,1000.0,2600.0,0.0
40,56700,714.0,1000.0,1500.0,4000.0,0.0
50,55500,921.0,1200.0,2100.0,5200.0,0.0
60,56800,1077.0,1500.0,1800.0,5900.0,0.0
70,59300,1205.0,1700.0,2800.0,8600.0,0.0
80,60000,1368.0,2000.0,2500.0,8100.0,0.0
90,60700,1537.0,2200.0,3400.0,12600.0,0.0
100,58800,1762.0,2500.0,3900.0,16400.0,0.0
110,57714,1919.0,2800.0,3200.0,16000.0,0.0
120,61050,2038.0,3000.0,3500.0,14800.0,0.0
130,64300,2110.0,3200.0,3600.0,15300.0,0.0
140,59380,2432.0,3500.0,3800.0,15800.0,0.0
150,63150,2431.0,3800.0,4300.0,16100.0,0.0
160,60714,2731.0,4000.0,4600.0,16400.0,0.0
170,63750,2758.0,4300.0,4800.0,18300.0,0.0
180,66904,2769.0,4200.0,4800.0,18200.0,0.0
190,60363,3169.0,4800.0,5200.0,18800.0,0.0
200,60095,3450.0,5100.0,5900.0,19700.0,0.0
210,59428,3573.0,5300.0,6400.0,19700.0,0.0
220,58600,3938.0,5700.0,9200.0,20600.0,0.0
230,58476,4041.0,6000.0,9400.0,18700.0,0.0
240,58000,4241.0,6200.0,9700.0,22100.0,0.0
250,57956,4415.0,6400.0,10000.0,23100.0,0.0
260,61809,4317.0,6700.0,7300.0,20200.0,0.0
270,60047,4513.0,6900.0,7300.0,19300.0,0.0
280,60500,4802.0,7100.0,8100.0,20800.0,0.0
290,59809,5002.0,7400.0,8000.0,20600.0,0.0
300,59272,5142.0,7600.0,8200.0,20900.0,0.0

4. rk mixed (create-10% set-40% get-40% delete-10%)
thread_size,tps,avgRT(microsecond),TP90(microsecond),TP99(microsecond),TP999(microsecond),failRate
10,18350,552.0,700.0,900.0,1600.0,0.0
20,33550,602.0,800.0,900.0,1600.0,0.0
30,47400,643.0,900.0,1000.0,1900.0,0.0
40,58550,694.0,1000.0,1100.0,2500.0,0.0
50,68200,748.0,1100.0,1200.0,2500.0,0.0
60,75450,808.0,1200.0,1400.0,2600.0,0.0
70,83450,855.0,1200.0,1400.0,2400.0,0.0
80,88500,923.0,1400.0,1600.0,2700.0,0.0
90,92850,986.0,1500.0,1700.0,3600.0,0.0
100,98000,1038.0,1600.0,1800.0,3300.0,0.0
110,101700,1107.0,1700.0,2000.0,3800.0,0.0
120,104650,1165.0,1800.0,2100.0,3100.0,0.0
130,109200,1217.0,1900.0,2200.0,3800.0,0.0
140,112050,1284.0,2000.0,2300.0,3600.0,0.0
150,113400,1353.0,2100.0,2400.0,4500.0,0.0
160,114800,1426.0,2200.0,2600.0,5000.0,0.0
170,117600,1489.0,2300.0,2600.0,4000.0,0.0
180,117050,1568.0,2400.0,2800.0,4200.0,0.0
190,121800,1630.0,2500.0,3000.0,4600.0,0.0
200,120000,1713.0,2700.0,3100.0,4800.0,0.0
210,124750,1756.0,2700.0,3100.0,4500.0,0.0
220,113300,2008.0,2800.0,3300.0,8500.0,0.0
230,126500,1882.0,2900.0,3400.0,5900.0,0.0
240,123600,1997.0,3100.0,3500.0,5000.0,0.0
250,125300,2049.0,3200.0,3600.0,7100.0,0.0
260,123809,2119.0,3300.0,3700.0,5600.0,0.0
270,119714,2256.0,3600.0,4300.0,7500.0,0.0
280,126200,2291.0,3600.0,4000.0,6900.0,0.0
290,124142,2384.0,3800.0,4300.0,7100.0,0.0
300,126700,2428.0,3900.0,4300.0,6800.0,0.0
Binary file added result/images/benchmark-create-avgrt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added result/images/benchmark-create-tp99.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added result/images/benchmark-create-tps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added result/images/benchmark-mixed-avgrt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added result/images/benchmark-mixed-tp99.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added result/images/benchmark-mixed-tps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fbfca14

Please sign in to comment.