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

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

问题描述

我正在尝试对我们的网络应用进行负载测试,这是一个使用asp.net核心和信号器技术使用代码编写的实时游戏应用. 我们正在使用Peter Doornbosch的JMeter WebSocket Samplers进行Web套接字通信,但是我们无法从Signalr服务器获取任何消息(除了Web套接字层的ping帧). 我尝试读取的文本消息是从服务器到所有连接的客户端的广播,因此我可以看到该消息已被浏览器客户端接收,但jmeter客户端未收到该消息. 我已经嗅探到浏览器和jmeter客户端的流量,发现服务器消息根本不在jmeter客户端收到,而是在浏览器中. 因此,我认为我在初始连接建立步骤中丢失了一些参数或标头,因此即使webSocket连接当时处于打开状态且websocket层ping都已到达jmeter客户端,服务器也无法检测到jmeter客户端. >

在Jmeter中完成的事情:-

  1. 对signalr服务器端的HTTP请求,并获取signalr connectionId作为响应,将其提取并保存在jmeter变量中.
  2. 使用Single Write Sampler通过步骤1中获得的connectionId来建立新的websocket连接,并发送文本框来设置Signalr数据协议"{"protocol":"json"}.(已复制,在浏览器的开发者控制台中可以看到)
  3. 使用现有连接,使用另一个Single Write Sampler发送文本,以调用signalr集线器功能以将其添加到Signalr组中.在集线器功能中,广播广播到所有已连接的客户端.
  4. 使用单一读取采样器从步骤3中提到的服务器读取广播.此步骤始终会导致jmeter中的响应超时错误.

任何使用过jmeter和singnalr并使用webSocket进行传输的人都可以揭露一些信息吗? 欢迎任何线索. 预先感谢

解决方案

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

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

我不知道这个方形字符是什么unicode字符,但似乎标志着信号发送器写入的结束.

我检查了unicode,它可能是这个:□ 是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天全站免登陆