无法使用 Jmeter 中的 Single Read Sampler 从 .net core signalr 服务器读取文本 [英] Cannot read text from .net core signalr server using Single Read Sampler in Jmeter

查看:26
本文介绍了无法使用 Jmeter 中的 Single Read Sampler 从 .net core signalr 服务器读取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对我们的 Web 应用程序进行负载测试,这是一个使用 asp.net 核心和信号器技术编写的实时游戏应用程序.我们正在使用 Peter Doornbosch 的 JMeter WebSocket Samplers 进行 websocket 通信.但是我们无法从信号服务器获取任何消息(除了来自 websocket 层的 ping 帧).我试图读取的文本消息是从服务器到所有连接的客户端的广播,因此我可以看到浏览器客户端已收到该消息,但 jmeter 客户端没有收到它.我已经嗅探到浏览器和 jmeter 客户端的流量,发现服务器消息根本没有在 jmeter 客户端收到,而是在浏览器中.所以我想我在初始连接建立步骤中缺少一些参数或标头,因此服务器无法检测到 jmeter 客户端,即使当时 webSocket 连接打开并且 websocket 层 ping 到达 jmeter 客户端.

在 Jmeter 中完成的事情:-

  1. 向signalr的服务器端点发出HTTP请求并获取signalr connectionId作为响应,将其提取并保存在jmeter变量中.
  2. 使用 Single Write Sampler 使用步骤 1 中获得的 connectionId 设置新的 websocket 连接,并发送文本框以设置 Signalr 数据协议 "{"protocol":"json"}".(在浏览器的开发者控制台中复制)
  3. 使用现有连接另一个单写入采样器发送文本,调用信号器集线器函数以添加到信号器组.此处,集线器函数中有一个广播写入所有连接的客户端.
  4. 使用 Single Read Sampler 从步骤 3 中提到的服务器读取广播.此步骤总是导致 jmeter 中的响应超时错误.

任何有使用 webSocket 作为传输的 jmeter 和 singnalr 经验的人都可以解释一下吗?欢迎任何线索.提前致谢

解决方案

根据提问者的要求,我的评论作为答案:

<块引用>

对于编写步骤我必须在最后发送一个方形字符,当我检查网站是什么时,我可以在浏览器的开发者控制台中看到这一点正在做.据我了解,它标志着您请求的结束".没有这个方形字符,它对我不起作用.

我不知道这个方形字符是什么 unicode 字符,但它似乎表示信号写入结束.

我检查了 unicodes,它可能是这个:□这是unicode 9633

I am trying to load test our web app which is a real time gaming app written using code using asp.net core and signalr technology. We are using JMeter WebSocket Samplers by Peter Doornbosch for websocket communication.But we are not able to get any messages from the signalr server(except the ping frames from the websocket layer). The text message I am trying to read is a broadcast from server to all connected clients, so I can see that the message has been received by the browser clients but the jmeter client is not getting it. I have sniffed traffic to both browser and jmeter client and found that the server messages are not at all received at jmeter client but are in browser. So I think I am missing some parameter or a header in the initial connection establishment step so the server is not able detect the jmeter client even though the webSocket connection is open at that time and websocket layer pings are getting reached to jmeter client.

Things done in Jmeter :-

  1. HTTP Request to the server end point of signalr and get the signalr connectionId as response extract it and keep in jmeter variable.
  2. Using Single Write Sampler to setup new websocket connection using the connectionId obtained in step 1 and sending a text frame to set Signalr data protocol "{"protocol":"json"}".(Copied as seen in browser's developer console)
  3. Using existing connection another Single Write Sampler to send text calling a signalr hub function to add to a signalr group.Here the in the hub function there is a broadcast written to all connected clients.
  4. Using a Single Read Sampler to read the broadcast from server mentioned in step 3.This step always results in response timeout error in jmeter.

Anybody having prior experience with jmeter and singnalr using webSocket as transport could shed some light? Any leads are welcome. Thanks in advance

解决方案

As per questioner requested here my comment as an answer:

For the write step I had to send a square character at the end , I could see this in the developer console of the browser when I checked what the website is doing. To my understanding it signals the "end" of your request. Without this square character it didn't work for me.

I can't tell what unicode character this square character is but it seems to signal the end of a signalr write.

I checked the unicodes and it could be this one: □ which is unicode 9633

这篇关于无法使用 Jmeter 中的 Single Read Sampler 从 .net core signalr 服务器读取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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