环境

macOS Mojave 10.14.4
MacBook Pro (13-inch, 2019, Four Thunderbolt 3 ports)
CPU 2.4 GHz Intel Core i5
Memory 16 GB 2133 MHz LPDDR3
Graphics Intel Iris Plus Graphics 655 1536 MB

Nginx

  1. ~ wrk -c40 -d60 -t30 http://127.0.0.1
  2. Running 1m test @ http://127.0.0.1
  3. 30 threads and 40 connections
  4. Thread Stats Avg Stdev Max +/- Stdev
  5. Latency 2.66ms 0.94ms 26.25ms 96.41%
  6. Req/Sec 381.73 29.18 606.00 83.51%
  7. 684871 requests in 1.00m, 1.08GB read
  8. Requests/sec: 11399.62
  9. Transfer/sec: 18.39MB

Zuul+Nginx

  1. ~ wrk -c40 -d60 -t30 http://127.0.0.1:8080
  2. Running 1m test @ http://127.0.0.1:8080
  3. 30 threads and 40 connections
  4. Thread Stats Avg Stdev Max +/- Stdev
  5. Latency 5.43ms 1.81ms 39.41ms 80.45%
  6. Req/Sec 185.58 34.76 290.00 67.98%
  7. 333175 requests in 1.00m, 522.44MB read
  8. Requests/sec: 5543.40
  9. Transfer/sec: 8.69MB

用Zuul反向代理Nginx减少了大概一半的请求数,可见Zuul性能比Nginx更差,比Nginx性能差50%以下