GithubHelp home page GithubHelp logo

wl21st / spring-boot-2-performance Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cancerian0684/spring-boot-2-performance

0.0 0.0 0.0 135 KB

A simple poc to measure spring boot 2.0 reactive web performance

Java 100.00%

spring-boot-2-performance's Introduction

spring-boot-2-performance metrics

Starting the server

First step is to build the project and then start the server from terminal.

Gradle build
./gradlew clean build
Start the server
$ cd build/libs
$ java -Xms512m -jar <artifact.jar>

Now the server shall start on port 8080 ready for serving the requests.

Install wrk tool for performance testing

wrk - a HTTP benchmarking tool

wrk is a modern HTTP benchmarking tool capable of generating significant load when run on a single multi-core CPU. It combines a multithreaded design with scalable event notification systems such as epoll and kqueue.

More Information

https://github.com/wg/wrk

Installation on Ubuntu

To install wrk on ubuntu 18.04 system, just run the below command

sudo apt install wrk

Now wrk is ready for the testing.

Benchmarking Metrics

Now start the Spring Boot application and run the below command from terminal

$ wrk -t8 -c40 -d30s http://localhost:8080/api/perf

This will launch 8 threads and keep 40 HTTP open connections for a duration of 30s and measure the results.

wrk output
Figure 1. Benchmark details

My machine is 16GB DDR3, Xeon E31245, 2011 Model Desktop

cpu info
Figure 2. cpu-information

So we can see that a simple ping controller gives throughput of 31000 requests per second, which is not bad at all.

Using h2load for HTTP Benchmarking

h2load is another high performance HTTP benchmarking tool that we can use to bench mark our API.

h2load to send 100000 requests using 50 concurrency level
$ h2load -n100000 -c50 --h1 http://localhost:8080/api/perf
Response
starting benchmark...
spawning thread #0: 50 total client(s). 100000 total requests
Application protocol: http/1.1

finished in 1.61s, 62089.09 req/s, 5.39MB/s
requests: 100000 total, 100000 started, 100000 done, 100000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 8.68MB (9100000) total, 4.20MB (4400000) headers (space savings 0.00%), 1.91MB (2000000) data
                     min         max         mean         sd        +/- sd
time for request:      114us     11.88ms       801us       213us    98.82%
time for connect:      204us      3.11ms      1.64ms       817us    58.00%
time to 1st byte:     3.17ms      8.25ms      5.35ms      1.34ms    58.00%
req/s           :    1242.20     1248.13     1244.66        1.22    70.00%

We can see that with latest version of Spring Boot 2.2.0, we can get a throughput of 62K requests/second on the same Ubuntu 18.04.2 server.

spring-boot-2-performance's People

Contributors

cancerian0684 avatar wl21st avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.