Netflix Zuul vs OpenResty
3204 ワード
Spring Cloud Netflix
のコンポーネントでZuul
は、ゲートウェイサービスとして、動的なルーティング、監視、セキュリティ、および弾性伸縮などのサービスを提供する。Zuul
はJava
によって編纂されているので、その性能上の表現に疑問を持っています。いくつかの組のZuul
とnginx
に基づくOpenResty
とのテスト比較をしました。フレームのバージョン:
REST
のお願いを書きます。@RequestMapping("/hello")
public String hello() {
return "world";
}
その後、Zuul
およびOpenResty
を用いて逆エージェント(Zuul
は5555ポートを使用し、OpenResty
は80ポートを使用する)を行い、wrk
を用いてそれぞれテストを行う。第1ラウンド:
➜ ~ wrk -t 10 -c 50 -d 10s http://localhost:5555/api/test/hello
Running 10s test @ http://localhost:5555/api/test/hello
10 threads and 50 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 33.95ms 43.06ms 599.09ms 89.81%
Req/Sec 210.68 73.11 460.00 68.00%
21045 requests in 10.04s, 4.12MB read
Requests/sec: 2095.30
Transfer/sec: 419.61KB
➜ ~ wrk -t 10 -c 50 -d 10s http://localhost/test/hello
Running 10s test @ http://localhost/test/hello
10 threads and 50 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 24.52ms 5.87ms 89.64ms 87.58%
Req/Sec 202.87 35.50 297.00 75.25%
16222 requests in 10.11s, 2.66MB read
Requests/sec: 1604.71
Transfer/sec: 269.47KB
第二ラウンド:➜ ~ wrk -t 10 -c 100 -d 10s http://localhost:5555/api/test/hello
Running 10s test @ http://localhost:5555/api/test/hello
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 34.50ms 23.16ms 335.87ms 88.20%
Req/Sec 313.05 69.63 590.00 70.81%
31196 requests in 10.04s, 6.10MB read
Requests/sec: 3107.57
Transfer/sec: 622.49KB
➜ ~ wrk -t 10 -c 100 -d 10s http://localhost/test/hello
Running 10s test @ http://localhost/test/hello
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 41.88ms 4.91ms 69.37ms 83.79%
Req/Sec 236.47 29.29 386.00 69.42%
16332 requests in 10.09s, 2.68MB read
Requests/sec: 1619.00
Transfer/sec: 271.89KB
第三輪(このグループが先に走るOpenResty
):➜ ~ wrk -t 10 -c 100 -d 10s http://localhost/test/hello
Running 10s test @ http://localhost/test/hello
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 42.36ms 8.17ms 111.17ms 88.12%
Req/Sec 232.84 41.45 303.00 72.86%
16328 requests in 10.10s, 2.68MB read
Requests/sec: 1617.40
Transfer/sec: 271.63KB
➜ ~ wrk -t 10 -c 100 -d 10s http://localhost:5555/api/test/hello
Running 10s test @ http://localhost:5555/api/test/hello
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 29.35ms 22.16ms 367.66ms 90.37%
Req/Sec 376.03 73.41 696.00 72.10%
37504 requests in 10.03s, 7.33MB read
Requests/sec: 3737.35
Transfer/sec: 748.47KB
テストの結果、上記のデータから、ZuulはJVM予熱が終わった後、性能がOpenResty
より優れていることが分かりました。