⚡️ High performance websocket servers implemented by Spray-can, Netty, undertow, jetty, Vert.x, Grizzly, node.js and Go. It supports 1,200,000 active websocket connections
Scala Go Other
Latest commit b7ba1ee Aug 16, 2016 @smallnest add details in README


This project provides eight high performance websocket server implementation and can be used to test their benchmark.

The eight high performance websocket servers contain:

I have test them and wrote two posts about test results in Chinese:

七种WebSocket框架的性能比较 使用四种框架分别实现百万websocket常连接的服务器

The test result shows Netty, Go, Node.js, Undertow, Vert.x can setup 1 million connections. Netty and Go is best.

You can test them and update the test result by submitting an issue or create a pull request.


I wrote those websocket implementation in Scala, Go and Node.js. The code is simple but they are a basic websocket server prototype. You can use them as a scaffold to develop chat, message pushing, notifications systems, etc.

You can run sbt task to create distributions for scala projects (netty, grizzly, jetty,spray,undertow,vert.x, testclient).

sbt clean dist

For goserver and go-fasthttp, you can run the "install" script to build the server.

Node.js is a javascript file.


For scala projects, you can copy target/universal/xxxxxx.zip to your server and unzip it. The unzipped directory contains start script (at bin directory), configuration files (at conf directory) and libraries (at lib directory).

For Go projects, copy compiled binary file and config.json to your server.

For node.js, copy scripts and dependencies modules to your server.


One server can't support benchmark test for one million websocket connections. There servers are recommended, for example, there AWS C3.8xlarge servers or better.

One server is used for a websocket server and two servers are for clients.

echo 2000000 > /proc/sys/fs/nr_open
echo 2000000 > /proc/sys/fs/file-max
ulimit -n 2000000

Modify /etc/sysctl.conf and add:

net.ipv4.ip_local_port_range = 1024  65000

and for Java, set memory options:

export JAVA_OPTS="-Xms12G -Xmx12G -Xss1M -XX:+UseParallelGC"

for node.js/V8:

node --nouse-idle-notification --expose-gc --max-new-space-size=1024 --max-new-space-size=2048 --max-old-space-size=8192 ./webserver.js

because one client/one IP only setup about 60,000 connections so you need set up more test IP, for example:

ifconfig eth0:1 netmask up
ifconfig eth0:2 netmask up
ifconfig eth0:3 netmask up
ifconfig eth0:19 netmask up
ifconfig eth0:20 netmask up

Servers will send one message per minutes to all 1,200,000 connections. Each message only contains current time of this server. Clients can output metrics to monitor.

You can adjust those parameters in application.conf. Please refer to reference.conf.

For example, Netty uses the below parameters:

server.port = 8088
sending.timer.delay = 10 minutes
sending.timer.interval = 1 minutes
totalSize = 1200000
onlyTestConnect = true

It will send the first message after 10 minutes and will send messages per minute since then. But if connections has not reached 1,200,000, it won't send messages to active connections. onlyTestConnect is true means server won't send message and we only test websocket setup.

For testclient, you can adjust those below parameters:

local.ip = ""
server.uri = "ws://localhost:8088"
setup.batchSize = 500
setup.interval = 1000
total.clients = 50000
websocket.timeout = 0
setup.threadpool.size = 1

You can change local.ip to multiple ip:

local.ip = ",,,,,,,,,,,,,,,,,,,"

and server uri:

server.uri = "ws://"

total.clients is max count of clients per IP.