如何在 JMeter 中测试异步回调? [英] How can I test async callbacks in JMeter?

查看:134
本文介绍了如何在 JMeter 中测试异步回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 API 中使用了 WebHook.因此,一旦请求被处理,我们的 REST 服务就会向请求中发送的回调 URL POST 一个响应.

客户端服务器|(请求)||----------------->||<-----------------||||(回应)|||||_||_ 时间|(回调)|\/|<-----------------|\/|----------------->||(回应)|||

如何使用 JMeter 进行压力测试?

解决方案

这取决于 WebHook 的实现,如果是轮询的问题 - 你可以使用 While Controller 在循环中等待回调.可以使用 ie Transaction Controller

如果回调来自 Server-Sent Event 你可以使用 ie JAX RS API 提供 SseEventSource 类可用于等待服务器-JSR223 SamplerJava 请求 采样器,如 异步HTTP/REST服务的压力/负载测试s with JMeter文章

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆