【问题标题】:Load test websocket with continous streaming using JMeter使用 JMeter 连续流式加载测试 websocket
【发布时间】:2017-04-27 11:53:44
【问题描述】:

JMeter 中的 WebSocket 流仅针对一帧执行,我无法使用可用的 jar 加载测试连续流@https://bitbucket.org/pjtr/jmeter-websocket-samplers

Jmeter WebSocket jmx 当我尝试通过终端触发 WebSocket 请求时,它会流式传输输出/日志。但在 JMeter 的情况下,Websocket 只运行一帧。

使用端口 443 的 WSS 请求:

感谢您回答问题。请您解决我的一些疑问:我正在尝试负载测试客户端不断侦听 WebSocket 的场景。

1 Using a jar file I am able to continuously stream the data when I hit the java jar in the terminal. I can see the data flowing

2. Now I try to replicate the scenario in JMeter, the sampler acts like a request/response, where the connection is lost after the response.

3. Now if I set a loop in JMeter, it does not satisfy the purpose of streaming. It will act as multiple requests sent to the same channel.

同样在附加的图片链接中,流连接的复选框被选中,但它的作用类似于请求/响应。

循环是 WebSocket 流的唯一选择吗?

线程名称:线程组 1-1 示例开始:2017-04-27 17:21:40 IST 加载时间:1383 连接时间:0 延迟:0 字节大小:1065 已发送 字节:0 标头大小(以字节为单位):0 正文大小(以字节为单位):1065 示例 计数:1 错误计数:0 数据类型(“text”|“bin”|“”):响应代码: 200 响应消息:

[执行流程] - 打开新连接 - 使用响应消息模式“” - 使用断开模式“” - 等待服务器连接 60000 MILLISECONDS - WebSocket 连接已打开 - 连接已建立 - 等待消息 60000 MILLISECONDS - 接收到的帧#1(15 字节);匹配的响应模式 - 接收到的消息#2(15 个字节);匹配的响应模式 - 保持流连接打开

[变量] - 消息数:2

[问题]

响应标头:

SampleResult 字段:ContentType:DataEncoding:UTF-8

【问题讨论】:

  • 资料不足,请详细说明你的测试计划和配置

标签: websocket jmeter streaming wss


【解决方案1】:

(我无法评论,这更适合第一部分)

根据您帖子中的文字,您使用的是https://bitbucket.org/pjtr/jmeter-websocket-samplers,但您发布的日志不是来自该插件,而是来自 Maciej Zaleski 的插件......

我不是 100% 确定您所说的“负载测试连续流”是什么意思,但如果您的意思是服务器只是将帧推送到客户端,则可以使用前一个插件进行测试。只需使用“单读采样器”设置一个循环...

【讨论】:

  • 感谢您回答问题。请您解决我的一些疑问:我正在尝试负载测试客户端不断侦听 WebSocket 的场景。 1 Using a jar file I am able to continuously stream the data when I hit the java jar in the terminal. I can see the data flowing2. Now I try to replicate the scenario in JMeter, the sampler acts like a request/response, where the connection is lost after the response.3. Now if I set a loop in JMeter, it does not satisfy the purpose of streaming. It will act as multiple requests sent to the same channel.
  • 您不应该使用请求-响应采样器,而应使用“WebSocket 单读采样器”。它读取一个 websocket 帧,不多也不少(websocket 协议是基于帧的)。因此,如果您将“Single Read Sampler”放入循环中,您实际上只是在读取帧,因此这应该符合您读取数据流的要求...
  • 此采样器不会断开连接,它会保留它以供同一 JMeter 线程重复使用。在循环之前设置与“WebSocket Open Connection”采样器的连接并检查“Single Read Sampler”中的“使用现有连接”选项。
  • 此外,根据您的回答,我猜您正在使用 Maciej Zaleski 插件中的 WebSocket Sampler;这可能会导致混乱。使用(确切)称为:“WebSocket Single Read Sampler”的采样器。 Hth.
  • 谢谢!!我已经使用了您提到的采样器并设计了您提到的加载脚本。它工作正常,也感谢您对 websocket 的概述。
猜你喜欢
  • 2021-07-17
  • 2019-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多