ยูทิลิตี้มาตรฐาน HTTP Framework ที่ทันสมัยยิ่งขึ้น
F:rewrk> rewrk -h http://127.0.0.1:5000 -t 12 -c 60 -d 5s
Benchmarking 60 connections @ http://127.0.0.1:5000 for 5 seconds
Latencies:
Avg Stdev Min Max
3.27ms 0.40ms 1.95ms 9.39ms
Requests:
Total: 91281 Req/Sec: 18227.81
Transfer:
Total: 1.13 MB Transfer Rate: 231.41 KB/Sec
ด้วยการเลือก -PCT FLAG
+ --------------- + --------------- +
| Percentile | Avg Latency |
+ --------------- + --------------- +
| 99.9% | 6.88ms |
| 99% | 5.62ms |
| 95% | 4.62ms |
| 90% | 4.24ms |
| 75% | 3.78ms |
| 50% | 3.49ms |
+ --------------- + --------------- +
แรงจูงใจที่อยู่เบื้องหลังโครงการนี้ครอบคลุมจากนักพัฒนาในการมองเห็นอุโมงค์บนมาตรฐานเช่น Techempower ที่ใช้เครื่องมือเปรียบเทียบที่เรียกว่า WRK
ปัญหาคือ WRK จัดการเฉพาะ บางส่วน ของ HTTP และมีอคติต่อเฟรมเวิร์กและเซิร์ฟเวอร์ที่สามารถใช้งานได้อย่างหนักของ HTTP/1 pipelining ซึ่งไม่ได้เปิดใช้งานในเบราว์เซอร์หรือลูกค้าที่ทันสมัยที่สุด
นี่คือที่มาของ REWRK เข้ามาเปรียบเทียบกับ Benchmarker นี้สร้างขึ้นบน API ลูกค้าของ Hyper และนำมาซึ่งข้อดีมากมายและวิธีการเปรียบเทียบที่สมจริงยิ่งขึ้น
การใช้งานค่อนข้างง่ายถ้าคุณมีไบนารีที่รวบรวมได้ง่ายๆโดยใช้ CLI
นี่คือตัวอย่างในการสร้างเกณฑ์มาตรฐานต่อไปนี้:
-c 256 )--http2 )-t 12 )-d 15s )--pct )http://127.0.0.1:5000 ( -h http://127.0.0.1:5000 ) คำสั่ง CLI:
rewrk -c 256 -t 12 -d 15s -h http://127.0.0.1:5000 --http2 --pct
หากต้องการเปิดใช้เมนูวิธีใช้เพียง Run rewrk --help เพื่อผลิตสิ่งนี้:
USAGE:
rewrk.exe [FLAGS] [OPTIONS] --duration <duration> --host <host>
FLAGS:
--help Prints help information
--http2 Set the client to use http2 only. (default is http/1) e.g. '--http2'
--pct Displays the percentile table after benchmarking.
-V, --version Prints version information
OPTIONS:
-c, --connections <connections> Set the amount of concurrent e.g. '-c 512' [default: 1]
-d, --duration <duration> Set the duration of the benchmark.
-h, --host <host> Set the host to bench e.g. '-h http://127.0.0.1:5050'
-t, --threads <threads> Set the amount of threads to use e.g. '-t 12' [default: 1]
การสร้างจากแหล่งที่มานั้นง่ายอย่างไม่น่าเชื่อเพียงตรวจสอบให้แน่ใจว่าคุณติดตั้ง Rust เวอร์ชันที่เสถียรก่อนที่จะเริ่ม
ด้วยการติดตั้งสินค้า
cargo install rewrk --git https://github.com/ChillFish8/rewrk.gitด้วยการขนส่งสินค้า
cargo run --release -- <enter flags here>ด้วยการสร้างสินค้า
cargo build --release