jersey源码分析和reactor-netty集成

1.netty-jersey集成

  • netty 自带http协议解析包,需要把netty封装的HttpServerRequestHttpServerResponse桥接到jersey的ContainerRequest,ContainerResponseWriter
  • 用wrk测试400并发qps在7000左右,机器配置16核,8G内存虚拟机

jersey1.x流程图

jersey-flow.png

jersey-flow.jpg
wrk -H 'Connection: keep-alive' -t20 -c400 -d30s http://localhost:8082/api/get?id=3887099059629981696
Running 30s test @ http://localhost:8082/api/get?id=3887099059629981696
  20 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    54.04ms    9.31ms 142.88ms   71.88%
    Req/Sec   370.86     53.38   676.00     71.84%
  221881 requests in 30.08s, 107.92MB read
  Socket errors: connect 0, read 221881, write 0, timeout 0
Requests/sec:   7376.17
Transfer/sec:      3.59MB

netty jersey扩展

netty-jersey1.x
netty-jersey2.x

你可能感兴趣的:(jersey源码分析和reactor-netty集成)