Benchmark of frameworks using Kotlin and one project using GO in order to have a basic benchmark of performance between JVM based frameworks X GO
All the Api's have two endpoints:
A POST endpoint that receives a username and a password, store at a list in memory and returns the User created with an ID
A GET enpoint that returns a User based in a path param ID
- go: Simple REST Api written in Go using gorilla/mux and net/http
- javalin: Simple REST Api written in Kotlin using javalin
- reactor-netty: Simple Reactive REST Api written in Kotlin using reactor-netty
- spark: Simple REST Api written in Kotlin using sparkjava
- spring-webflux: Simple Reactive REST Api written in Kotlin using spring_webflux
- spring: Simple REST Api written in Kotlin using spring-boot
- results: HTML results from Gatling
- JDK11 Amazon Correto
- If you like to use your own installation of Gradle, otherwise just use the wrapper that is included inside each project
- Jmeter
- Gatling
- GO 1.13
Just clone this repository and start to build all the projects for you to be able to run the Jmeter or Gatling scripts
Just execute the build script.
$ cd $HOME/kotlin-bench/
$ sh build-all.sh
If you would like to know how to build individually, just take a look at the script.
- go: just run the executable file and you can use nohup in case you don't want to lock your terminal session
$ cd $HOME/kotlin-bench/go/
$ ./api-test
- javalin, reactor-netty, spark, spring-webflux and spring: Just use java -jar and you can use nohup in case you don't want to lock your terminal session
$ java -jar $HOME/kotlin-bench/javalin/build/libs/javalin-all-1.0.0-SNAPSHOT.jar
$ java -jar $HOME/kotlin-bench/reactor-netty/build/libs/reactor-netty-1.0.0-SNAPSHOT-all.jar
$ java -jar $HOME/kotlin-bench/spark/build/libs/spark-all-1.0.0-SNAPSHOT.jar
$ java -jar $HOME/kotlin-bench/spring-webflux/build/libs/spring-webflux-1.0.0-SNAPSHOT.jar
$ java -jar $HOME/kotlin-bench/spring/build/libs/spring-1.0-SNAPSHOT.jar
In order to run the benchmark we must have the random username and password data generated. To do that we'll run the file generate_data.rb
$ ruby generate_data.rb
After you run this command above you should have a file named data.csv
created inside the folder. We'll use this file to run our benchmark.
Start one of the API's. The API will listen to requests at localhost:61543/users
Using Jmeter command line listed bellow, start the benchmark.jmx
script and wait till it finish
$ JVM_ARGS="-Xms1024m -Xmx2048m -XX:NewSize=512m -XX:MaxNewSize=1024m" && export JVM_ARGS && $JMETER_HOME/bin/jmeter -n -t benchmark-test.jmx -l testresults.jtl
The result will be available at testresults.jtl
file.
In order to see the compilation of the results, open Jmeter in GUI mode (double click to jmeter
located at bin folder) and open the benchmark.jmx
test plan. After that you will be able to go to Summary Report and browse to the file testresults.jtl
and all the information will be resumed in the table located in this report.
First you'll have to copy the file kotlinBenchSimulation.scala
to the gatling simulations folder and the data.csv
file to the gatling resources folder
$ mkdir $GATLING_HOME/user-files/simulations/kotlinbench
$ cp kotlinBenchSimulation.scala $GATLING_HOME/user-files/simulations/kotlinbench/
$ cp data.csv $GATLING_HOME/user-files/resources/
Start one of the API's. The API will listen to requests at localhost:61543/users
Start the Gatling script
$ sh $GATLING_HOME/bin/gatling.sh
Choose the kotlinBenchSimulation number or hit enter if you have only our simulation located at user-files
- Writing tests - Feel free to contribute
- Code review - Feel free to contribute
- Other contributions - Feel free to contribute with anything that you want!!!
- Repo owner or admin josemanzoli
- Other community or team contact Well, it`s just me for now!