Git Product home page Git Product logo

hertz-benchmark's Introduction

Hertz-Benchmark

调研其他项目的 benchmark 以及 HTTP 使用场景后,我们觉得 Echo 场景能够反映真实的使用场景。本项目提供若干 HTTP 框架在 Echo 场景下的性能记录。

使用说明

同机压测

执行前请先确认满足环境要求

Server

./scripts/benchmark_server.sh

Client

./scripts/benchmark_client.sh

Profiling

由于默认压测参数会比较迅速完成一次压测,为了获得更长采集时间,可以手动在 ./scripts/env.sh 中调整压测参数 n 大小。

Profiling Server

不同 server 的 port 映射参见相应脚本,如:

cat ./scripts/benchmark_pb.sh

# ...
repo=("hertz" "fasthttp" "gin" "fasthttp_timeout")
ports=(8000 8001 8002 8003 8004)

获取到对应 server 端口号后,执行:

go tool pprof localhost:{port}/debug/pprof/{pprof_type}

你也可以用 wrk 作为发压端,参考下面的命令。

./scripts/benchmark_wrk.sh

# parse data
# ${input_file} locates in /output/$(date +%F-%H-%M).log
# specify one ${output_file}
python ./scripts/wrk/parse_data.py ${input_file} ${output_file} 

# render images
python ./scripts/reports/render_images.py ${output_file}

你也可以用 ab 作为发压端,参考下面的命令。

./scripts/benchmark_ab.sh

# parse data
# ${input_log_file} locates in /output/$(date +%F-%H-%M).log
# ${input_latency_file} folder locates in /output/latency_$(date +%F-%H-%M)
# specify one ${output_file}
python ./scripts/ab/parse_data.py ${input_log_file} ${input_latency_file} ${output_file} 

# render images (ab does not provide tp999)
python ./scripts/reports/render_images.py ${output_file}

环境要求

  • OS: Linux
    • 默认依赖了命令 taskset, 限定 client 和 server 运行的 CPU; 如在其他系统执行, 请修改脚本。
  • CPU: 推荐配置 >=20核, 最低要求 >=4核
    • 压测脚本默认需要 20核 CPU, 具体在脚本的 taskset -c ... 部分, 可以修改或删除。

参考数据

相关说明:

该压测数据是在调用端有充分机器资源压满服务端的情况下测试,更侧重于关注服务端性能。后续会提供调用端性能数据情况。

配置

  • CPU: Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz
    • 运行限定 server 4-CPUs,client 16-CPUS
  • OS:Debian 5.4.56.bsk.9-amd64 x86_64 GNU/Linux
  • Go: 1.16.5

数据 (Echo,100 concurrency,1k Header)

Performance

hertz-benchmark's People

Contributors

ppzqh avatar duslia avatar

Watchers

James Cloos 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.