One of our application servers is accepting requests via regular sockets. Those are not WebSockets. I searched the documentation but can’t really find out anything about regular sockets. We want to do a stress test on that particular server, to find out about our actual limits.
My question is now, are regular sockets actually supported by k6?
If regular sockets aren’t supported, is there any possibility to implement this via an e.g. plugin?
Example of a regular socket in Node.js
const net = require('net')
const server = net.createServer(socket => {
socket.on('data', data => {
console.log('some data received', data)
const response = 'some response data'
socket.write(response)
})
})
server.listen()
We don’t support this yet, sorry. We plan to eventually, but we’ll probably first have to implement proper event loops for best effect (Global JS event loops in every VU · Issue #882 · grafana/k6 · GitHub).
Until then, you can use xk6 to write a Go extension for working with raw sockets and expose it to your scripts, see this for more details: Testing without limits: xk6 and k6 extensions
Hi Ned,
Thank you for your response. So I’ll start looking into xk6. Any chance that you know of a list or something like it to find already existing xk6 extensions? The reason is that I’m quite a beginner with Go and I’d love to have real-world use cases as an example.
Regards
Florian
We don’t have an official list of extensions yet, but since they’re simple github repos, and since most people prefix them with xk6-
, most of them are easy to find with the GitHub search functionality: https://github.com/search?q=xk6