JMeter WebSocket Sampler
WebSocket load testing for Apache JMeter, before JMeter could do it.
Product screens
Overview
I built an open-source Apache JMeter plugin that adds RFC 6455 WebSocket testing, including long-lived streaming connections, regex-matched responses and message backlogs.
Problem statement
Teams load-testing real-time applications such as trading feeds, chat and live dashboards had no simple, standards-compliant way to open a WebSocket in Apache JMeter, keep it open across samples and check the messages it streamed back.
Solution
A native JMeter sampler.
I implemented a native sampler installed through lib/ext with its Jetty WebSocket client libraries, alongside JMeter's built-in samplers, with server, port, ws/wss protocol, timeouts and request data settings.
Streaming connections.
I designed the sampler for long-lived WebSocket connections, much like COMET, keeping one TCP session per thread across iterations, so a loop of samples reads a continuous stream instead of reconnecting each time.
Response matching and backlog.
I added response regular expressions to decide when a sample completes, a close-connection pattern to end the stream, and a configurable message backlog to keep recent frames for inspection in View Results Tree.
Packaged as open source.
I published the plugin under Apache-2.0 with a Maven build, tagged releases (latest 1.0.3) and installation instructions on the project wiki. It has since accepted community contributions, such as support for multiple response patterns.
Outcome
The plugin was adopted widely. BlazeMeter (now Perforce) called it the only easy, RFC 6455-compliant way to test WebSockets in JMeter that reuses a single TCP session, and RedLine13 built WebSocket support into its cloud platform around it. Screenshots are from RedLine13's 2016 walkthrough.
View the repository on GitHubTechnologies used
Data volumes & scale
- 318 GitHub stars
- 185 forks
- RFC 6455 (v13)
- 1 TCP session per thread
