奶爸

KCP与TCP端口转发性能测试
端口转发正在做一个内网穿透服务,考虑使用TCP或者KCP协议进行转发,因为在用酸酸,时常看到KCP的字眼,加上自带...
扫描右侧二维码阅读全文
02
2018/03

KCP与TCP端口转发性能测试

端口转发

正在做一个内网穿透服务,考虑使用TCP或者KCP协议进行转发,因为在用酸酸,时常看到KCP的字眼,加上自带降低延迟的功能,所以对TCP及KCP转发本地HTTP端口进行了性能测试。

  • 测试工具:wrk
  • 测试环境:Macbook 2015 13 inch
  • Web服务:gin

测试结果

###### KCP ######
 nb@NB  ~  wrk -t12 -c400 -d30s http://localhost:8000
Running 30s test @ http://localhost:8000
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   326.47ms  318.23ms   2.00s    76.64%
    Req/Sec   123.77     62.37   515.00     67.96%
  44100 requests in 30.07s, 136.73MB read
  Socket errors: connect 0, read 109, write 16, timeout 40
Requests/sec:   1466.73
Transfer/sec:      4.55MB
###### TCP ######
 nb@NB  ~  wrk -t12 -c400 -d30s http://localhost:8000
Running 30s test @ http://localhost:8000
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   294.84ms  344.94ms   2.00s    85.39%
    Req/Sec   143.05     70.57   440.00     69.43%
  51043 requests in 30.10s, 158.25MB read
  Socket errors: connect 0, read 299, write 22, timeout 312
Requests/sec:   1695.56
Transfer/sec:      5.26MB

第一个是KCP的结果,第二个是TCP的结果。可以看到Socket errors明显TCP比较多,加上KCP的降低延迟,我选择使用KCP进行端口转发。

Last modification:March 2nd, 2018 at 04:42 pm

Leave a Comment