Netflix Zuul vs OpenResty

3204 ワード

Spring Cloud NetflixのコンポーネントでZuulは、ゲートウェイサービスとして、動的なルーティング、監視、セキュリティ、および弾性伸縮などのサービスを提供する。ZuulJavaによって編纂されているので、その性能上の表現に疑問を持っています。いくつかの組のZuulnginxに基づくOpenRestyとのテスト比較をしました。
フレームのバージョン:
  • Spring Coud Zuul:1.1.0.RELEASE
  • OpenResty:1.11.2.2
  • Spring MVCでごく普通の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より優れていることが分かりました。