Performance Comparison of Seven WebSocket Server Frameworks and an Additional Go Implementation
This article reports a benchmark of seven WebSocket server frameworks (Netty, Undertow, Jetty, Vert.x, Grizzly, spray-websocket, Node.js) plus a Go implementation, describing the test setup on AWS C3.4xlarge instances, detailed per‑framework results, and an analysis of latency, CPU and memory usage.
Recently I implemented prototypes of WebSocket push servers using several frameworks and conducted a benchmark of seven implementations, later adding an eighth one written in Go.
The seven frameworks tested are:
Netty (http://netty.io/)
Undertow (http://undertow.io/)
Jetty (http://www.eclipse.org/jetty/)
Vert.x (http://vertx.io)
Grizzly (https://grizzly.java.net/)
spray-websocket (https://github.com/wandoulabs/spray-websocket)
nodejs-websocket/Node.js (https://github.com/sitegui/nodejs-websocket)
An additional Go implementation was also tested and performed well.
Test Environment
Three AWS C3.4xlarge servers were used: one as the server and two as client machines. Each client machine launched 10 clients, for a total of 20 clients.
The C3.4xlarge specifications are shown in the image below:
Both server and client machines were tuned following the optimizations described in a previous article.
Test configuration:
20 clients
Setup rate = 500 * 20 requests/second = 10,000 requests/second
Each client creates 50,000 WebSocket connections (total 1,000,000 connections)
After all connections are established, a timestamp message is sent to every client, which measures latency.
If the server setup rate becomes too slow, the test is stopped.
Three performance phases are monitored: during setup, after setup while the application is idle, and during message broadcast.
Test Results
Netty
Setup phase:
CPU idle: 90%
Minor GC: few
Full GC: none
After setup (idle):
CPU idle: 100%
Memory usage: 1.68 GB
Server free memory: 16.3 GB
Message broadcast:
CPU idle: 75%
Minor GC: few
Full GC: none
Message latency (one client):
Vert.x
Setup CPU idle: 95%
Minor GC: few
Full GC: none
Idle CPU idle: 100%
Memory usage: 6.37 GB
Server free memory: 16.3 GB
Message broadcast CPU idle: 47% ~ 76%
Minor GC: few
Full GC: few
Message latency (one client):
Undertow
Setup CPU idle: 90%
Minor GC: few
Full GC: none
Idle CPU idle: 100%
Memory usage: 4.02 GB
Server free memory: 14.2 GB
Message broadcast CPU idle: 65%
Minor GC: few
Full GC: none
Message latency:
Jetty
Setup CPU idle: 2%
Minor GC: many
Full GC: none
Memory usage: 5 GB
Server free memory: 17.2 GB
When about 360,000 connections were being established, setup became very slow, GC frequency increased, and the test was aborted.
Grizzly
Setup CPU idle: 20%
Minor GC: some
Full GC: some
Memory usage: 11.5 GB
Server free memory: 12.3 GB
At roughly 500,000 connections, setup slowed dramatically and frequent GC forced the test to stop.
spray-websocket
Setup CPU idle: 80%
Minor GC: many
Full GC: none
Similarly, around 500,000 connections caused severe slowdown and GC pressure, leading to test termination.
Node.js
Setup CPU idle: 94%
Idle CPU idle: 100%
Memory usage: 5.0 GB
Server free memory: 16.3 GB
Message broadcast CPU idle: 94%
Message latency (one client):
Go
Setup CPU idle: 94%
Idle CPU idle: 100%
Memory usage: 15 GB
Server free memory: 6 GB
Message broadcast CPU idle: 94%
Message latency (one client):
Test Result Analysis
Netty, Go, Node.js, Undertow, and Vert.x can all establish one million connections; Jetty, Grizzly, and Spray cannot.
Netty shows the best performance with very low memory consumption and modest CPU usage.
Jetty, Grizzly, and Spray generate many intermediate objects, causing frequent garbage collection; Jetty performs the worst.
Node.js performs excellently, especially with a single‑instance single‑threaded setup, achieving fast connection speed, low latency, and reasonable memory usage.
Undertow also performs well, with slightly higher memory usage than Netty but comparable overall metrics.
Spray exhibits high CPU usage (≈40 %) even when no messages are sent under heavy connection load.
Source: Bird's Nest
Copyright statement: Content originates from the internet; copyright belongs to the original author. We strive to credit authors and sources unless verification is impossible. If any infringement is identified, please inform us for immediate removal and apology. Thank you.
-END-
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
