当前位置:网站首页>Performance comparison of seven websocket frameworks

Performance comparison of seven websocket frameworks

2021-10-22 10:43:21 Bird's nest

Previous post We use four frameworks to implement million websocket Often connected servers Four kinds of websocket Test method and basic data of the framework . Recently, I used several frameworks to implement websocket push Prototype of the server , And specifically tested these seven implementations . This paper records the test results and some analysis of the results .
These seven frameworks are :

Recently, with Golang Realized the eighth ,Go Good performance .

Test environment

Use three C3.4xlarge AWS The server tests . One as a server , Two machines as clients , Each client machine starts 10 individual client, altogether 20 individual client
C3.4xlarge The configuration is as follows :

model vCPU Memory (GiB) SSD Storage (GB)
c3.large 2 3.75 2 x 16
c3.xlarge 4 7.5 2 x 40
c3.2xlarge 8 15 2 x 80
c3.4xlarge 16 30 2 x 160
c3.8xlarge 32 60 2 x 320

The server and client machines are basically optimized according to the previous article .

The following is the test configuration data :

  • 20 clients
  • setup rate Set to 500 * 20 requests/second = 10000 request /second
  • Every client Responsible for establishing 50000 individual websocket Connect
  • etc. 1,000,000 individual websocket Build good , Send a message ( Time stamp ) To all clients , The client calculates based on the timestamp latency
  • If the server setup rate Building is slow , Actively stop the test
  • Monitor the performance indicators of the three stages : setup when , setup When finished, the application is in a daze (idle) when , When sending a message

test result

Netty

Setup when

  • cpu idle: 90%
  • minor gc: Few
  • full gc: No

Setup complete , application Idle when

  • cpu idle: 100%
  • memory usage: 1.68G
  • server free memory: 16.3G

When sending a message

  • cpu idle: 75%
  • minor gc: few
  • full gc: No
  • Message latency (one client)
           count = 50000
             min = 0
             max = 18301
            mean = 2446.09
          stddev = 3082.11
          median = 1214.00
            75% <= 3625.00
            95% <= 8855.00
            98% <= 12069.00
            99% <= 13274.00
          99.9% <= 18301.00
    

Vert.x

Setup when

  • cpu idle: 95%
  • minor gc: Few
  • full gc: No

Setup complete , application Idle when

  • cpu idle: 100%
  • memory usage: 6.37G
  • server free memory: 16.3G

When sending a message

  • cpu idle: 47% ~ 76%
  • minor gc: few
  • full gc: few
  • Message latency (one client)
           count = 50000
             min = 49
             max = 18949
            mean = 10427.00
          stddev = 5182.72
          median = 10856.00
            75% <= 14934.00
            95% <= 17949.00
            98% <= 18458.00
            99% <= 18658.00
          99.9% <= 18949.00
    

Undertow

Setup when

  • cpu idle: 90%
  • minor gc: Few
  • full gc: No

Setup complete , application Idle when

  • cpu idle: 100%
  • memory usage: 4.02G
  • server free memory: 14.2G

When sending a message

  • cpu idle: 65%
  • minor gc: few
  • full gc: No
  • Message latency
           count = 50000
             min = 1
             max = 11948
            mean = 1366.86
          stddev = 2007.77
          median = 412.00
            75% <= 2021.00
            95% <= 5838.00
            98% <= 7222.00
            99% <= 8051.00
          99.9% <= 11948.00
    

Jetty

Setup when

  • cpu idle: 2%
  • minor gc: Many
  • full gc: No
  • memory usage: 5G
  • server free memory: 17.2G

When establishing 360,000 Left and right websocket when , setup Very slow , gc frequent , Unable to continue normal build websocket, Actively terminate the test .

Grizzly

Setup when

  • cpu idle: 20%
  • minor gc: Some
  • full gc: Some
  • memory usage: 11.5G
  • server free memory: 12.3G

When establishing 500,000 Left and right websocket when , setup Very slow , gc frequent , Unable to continue normal build websocket, Actively terminate the test .

Spray

Setup when

  • cpu idle: 80%
  • minor gc: Many
  • full gc: No

When establishing 500,000 Left and right websocket when , setup Very slow , gc frequent , Unable to continue normal build websocket, Actively terminate the test .

Node.js

Setup when

  • cpu idle: 94%

Setup complete , application Idle when

  • cpu idle: 100%
  • memory usage: 5.0G
  • server free memory: 16.3G

When sending a message

  • cpu idle: 94%
  • Message latency (one client)
  • Message latency
           count = 50000
             min = 0
             max = 18
            mean = 1.27
          stddev = 3.08
          median = 1.00
            75% <= 1.00
            95% <= 1.00
            98% <= 1.00
            99% <= 1.00
          99.9% <= 15.00
    

Go

Setup when

  • cpu idle: 94%

Setup complete , application Idle when

  • cpu idle: 100%
  • memory usage: 15G
  • server free memory: 6G

When sending a message

  • cpu idle: 94%
  • Message latency (one client)
  • Message latency
           count = 50000
             min = 0
             max = 35
            mean = 1.89
          stddev = 1.83
          median = 1.00
            75% <= 1.00
            95% <= 2.00
            98% <= 2.00
            99% <= 4.00
          99.9% <= 34.00
    

Analysis of test results

  • Netty, Go, Node.js, Undertow, Vert.x Can normally establish millions of connections . Jetty, Grizzly and Spray Failed to complete connection
  • Netty Perform best . Very little memory , CPU The utilization rate is not high . In particular, memory usage , Much smaller than other frameworks
  • Jetty, Grizzly and Spray Will produce a large number of intermediate objects , Lead to frequent garbage collection .Jetty The worst
  • Node.js Very good performance . In particular, single instance and single thread are used in the test , The build speed is very fast , News latency Also very good. . Memory usage is also good
  • Undertow Well done, too , Memory usage ratio Netty higher , The others are similar
  • We haven't detected Spray Another bad place . In the case of a large number of connections , Even if no message is sent ,Spray Will take up 40% CPU Time

版权声明
本文为[Bird's nest]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/10/20211009000611604p.html

随机推荐