如何在 JMeter 中测试异步回调? [英] How can I test async callbacks in JMeter?
问题描述
我在我的 API 中使用了 WebHook.因此,一旦请求被处理,我们的 REST 服务就会向请求中发送的回调 URL POST 一个响应.
客户端服务器|(请求)||----------------->||<-----------------||||(回应)|||||_||_ 时间|(回调)|\/|<-----------------|\/|----------------->||(回应)|||
如何使用 JMeter 进行压力测试?
这取决于 WebHook 的实现,如果是轮询的问题 - 你可以使用 While Controller 在循环中等待回调.可以使用 ie Transaction Controller
如果回调来自 Server-Sent Event 你可以使用 ie
I am using WebHooks in my API. So, once a request is processed our REST Service will POST a response back to the callback URL sent in the request.
Client Server
|(request) |
|----------------->|
|<-----------------| ||
| (response)| ||
| | _||_ Time
| (callback)| \ /
|<-----------------| \/
|----------------->|
|(response) |
| |
How can this be stress tested with JMeter?
It depends on WebHook implementation, if it is a matter of polling - you can just use While Controller to wait for callback in loops. The whole duration of the sequence can be measured using i.e. Transaction Controller
If the callback comes a a Server-Sent Event you can use i.e. JAX RS API which provides SseEventSource class which can be used for waiting for server-side events either in JSR223 Sampler or in Java Request sampler like described in Stress/Load-Testing of Asynchronous HTTP/REST Services with JMeter article
这篇关于如何在 JMeter 中测试异步回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!