Coder Social home page Coder Social logo

gaplo917 / generic-http-benchmark Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 3.0 1.17 MB

Generic HTTP benchmark using Gatling. Check out the results ๐Ÿ‘‡

Home Page: https://benchmarks.gaplo.tech/index.html#

Kotlin 6.42% Shell 0.74% Java 4.28% JavaScript 12.25% Dockerfile 1.24% TypeScript 1.19% Rust 1.67% C# 0.98% HTML 58.79% CSS 12.43%
benchmark java jvm kotlin kotin-coroutines reactor virtual-threads

generic-http-benchmark's Introduction

Generic HTTP benchmark

Check out the interesting result at https://benchmarks.gaplo.tech.

Contributions are welcome. Rust and C# implementations were contributed by others! If you are interested to add your favourite framework in this project, take a look on their PRs for reference.

Goal Description
โœ… End-to-End HTTP benchmark Utilizing Gatling to generate real-world HTTP load and output fruitful performance report
โœ… Fully Containerized Single docker compose dependency is enough to get started. Say good bye to countless installations of project dependencies.
โœ… Scalable Design Adding a new benchmark target only needs a Dockerfile and a simple configuration.
โœ… Dev-Friendly Design Run the benchmark in your local machine instead of trusting the report online. Easy to make code changes to run to learn.
โœ… Zero Code Configuration Kotlin implementation of utilizing Gatling to work like ab or wrk CLI tools
โœ… High Concurrency Thanks for the containerization. Tested 20k+ concurrent users with no problem. No more file description or TCP connection limit issues.
โœ… Continuous Concurrency Ramp Up and Sustain Discover the application performance across continuous time series charts with configuration ramp up and sustain duration.
โœ… Gatling Reports Automation Automatically parse Gatling output and upload to https://benchmarks.gaplo.tech CDN
๐Ÿ”ง Self-host action runner Create a self-hosted action runner base image on cloud and provision faster to run benchmarks
๐Ÿ”ง Provisioning Automation Use GitHub Actions to automatically provision a self-hosted action runner to run benchmarks on
๐Ÿ”ง Report Summary Aggregate all-in-one Gatling simulation log to visualize avg. request/s, response time
๐Ÿ”ง More features complaint with ab Support to define http methods, cookies, headers, payload, http connections, custom cert...etc
...more
Gatling Scenario Goal
โœ… Two dependent I/O Compare various implementations of non-blocking IO or blocking IO within its HTTP framework. (i.e. Spring w/ Kotlin Coroutine, Reactive Stream, and Java virtual threads)
๐Ÿ”ง Two parallel I/O Compare various implementations of non-blocking or blocking IO implementation
...

Getting Started (end-to-end HTTP benchmark)

All benchmark targets are designed to run in Docker container and use Gatling to run the load test and get the benchmark of end-to-end result.

cover

1. Define benchmark scenarios in ./config/*.env

In ./config/*.env, there are key configurations to control gatling's concurrency. duration

2. Start up the benchmark

First, you need to build the docker image for each application you want to test.

You might need at least 7 vCPU and 16GB Memory resources for the whole docker engine.

Run a single benchmark with the follow commands, it will build automatically if there is no available images.

# In case you need to change architecture to build cross platform
DOCKER_DEFAULT_PLATFORM=linux/arm64/v8 # Mac M1/M2 CPU
DOCKER_DEFAULT_PLATFORM=linux/amd64 # Intel / AMD CPU

# Run single benchmark (i.e. ktor)
ENV_FILE=./config/ktor.env
docker compose --env-file $ENV_FILE build && \
docker compose --env-file $ENV_FILE up -d benchmark-target && \
docker compose --env-file $ENV_FILE up gatling-runner && \
docker compose --env-file $ENV_FILE down

OR run all benchmarks through the scripts

# Run all benchmarks, config available in `./config/`
sh all-gatling-benchmarks.sh

3. During the test, Grab a โ˜•๏ธ or ๐Ÿต and wait.

  • gatling-runner output all the logs to ./logs/

  • gatling reports available in ./reports/

4. Study the Gatling reports

Checkout the benchmark report in ./reports/. Hope you would have a great understanding of your applications!

(Optional) Grafana Dashboard to view application metrics

  1. Un-comment the prometheus and grafana services in docker-compose.yaml
  2. Make sure the application support prometheus, and add job and endpoints in prometheus.yml
ENV_FILE=./config/ktor.env
docker compose --env-file $ENV_FILE up -d benchmark-target prometheus grafana &&

Go to http://localhost:3000 to configure the grafana dashboard.

Benchmark Environment

Configuration Description
Platform x86 Intel
Cloud Provider Digital Ocean
CPU 8 vCPU (Dedicated, CPU-Optimized)
RAM 16GB Memory
Disk 100GB SSD

Result: https://benchmarks.gaplo.tech/index.html

Develop Gatling Kotlin Project

After making Gatling code changes, make sure you run to build the docker image.

docker compose --env-file $ENV_FILE build gatling-runner

Contribution

  1. Add new web framework frameworks/xxx implementation under that is functionally equivalent to other implementations.
  2. Add benchmark configuration in ./config/xxx.env

Troubleshooting

# Remove orphans containers
docker compose --env-file ./config/ktor.env down --remove-orphans

History

This project is originally designed for testing the performance of Kotlin Coroutines, Reactor, and cutting edge Java 19 Virtual Threads on Spring Boot for my application of KotlinConf 2023 talk (Not being selected by KotlinConf, moved in here).

Meanwhile, I realized if my work go the extra miles, it can be further extended to benchmark generic frameworks.

generic-http-benchmark's People

Contributors

gaplo917 avatar irasychan avatar rm1138 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  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.