RabbitMQ consumer load test using K6

Hi,

Is it possible to do a load test on RabbitMQ consumer with K6? To monitor the consumer to see its performance. If yes, kindly let me know the process.

Kind of. There is an AMPQ xk6 extension, though it’s not very actively maintained, it’s more of a PoC: GitHub - grafana/xk6-amqp

1 Like

Hi, Ned. Thanks for the reply. I have executed the test.js with 1VU and duration 60s, I am getting the following error

time=“2022-07-12T12:59:36+05:30” level=info msg=“K6 Test05 queue is ready” source=console
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x9c88ce]
goroutine 87 [running]:
github.com/dop251/goja.AssertFunction.func1.1()
github.com/dop251/goja@v0.0.0-20210427212725-462d53687b0d/runtime.go:2090 +0x74
panic({0x1189620, 0x1e9be20})
runtime/panic.go:838 +0x207

Ah, sorry, as I said, it’s not very actively maintained :disappointed: We review and merge PRs though, if a bit slowly, so please submit a PR with a fix if you can.

I tried to publish 3 messages in the rabbitMQ and ran the script. I got the following error.

/\  /  \     |  |/  /   /  /
/  \/    \    |     (   /   ‾‾\

/ \ | |\ \ | (‾) |
/ __________ \ |__| _\ ____/ .io

execution: local
script: test.js
output: -

scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

time=“2022-07-12T13:02:59+05:30” level=info msg=“K6 amqp extension enabled, version: v0.0.1” source=console
time=“2022-07-12T13:02:59+05:30” level=info msg=“Connection opened: amqp://guest:guest@localhost:5672/” source=console
time=“2022-07-12T13:02:59+05:30” level=info msg=“K6 Test05 queue is ready” source=console
time=“2022-07-12T13:02:59+05:30” level=info msg=“received data: Test02” source=console
time=“2022-07-12T13:02:59+05:30” level=info msg=“received data: Test03” source=console
panic: context canceled at file:///C:/Users/nived/Desktop/RabbitMQ/test.js:42:24(87)

goroutine 68 [running]:
github.com/dop251/goja.(*Runtime).wrapJSFunc.func1({0xc001564120, 0x1, 0x2?})

github.com/grafana/xk6-amqp.(*Amqp).Listen.func1()

2022/07/12 13:02:59 [ERROR] exit status 2

Hi, Ned. Thanks for your time and reply. Will submit. :slightly_smiling_face:

Just as an FYI - you will likely need to make it work with the event loop which just didn’t exist at the time the extension was written.

There is a branch with a single commit by me that uses an early version of the event loop API, so you will likely need to update that as well.

Also, arguably some changes to the exposed API will be needed that I likely didn’t do as I was just testing the event loop at the time.

Hope this helps you

Hi, stoykov

Thank you so much for your help. After updating the scripts according to the commit, they are working now. I am unable to upload the logs as I am a new user.

After updating the scripts according to the commit,

Do you mean that you used my commit and it now doesn’t panic for you?

Yes, according to the following commit. My script worked

1 Like

I’ve opened Use event loop · Issue #10 · grafana/xk6-amqp · GitHub, but I would not be able to prioritize it myself, but if anyone wants to make those changes work with the latest k6 and then make a PR - I will try to code review it.