tsung websocket testing garble message
Asked Answered
S

0

6

I am trying to load test a websocket server. Server accepts and sends application/json and interactions seems to be rather fine.

Server accepts correctly messages sent from client (tsung). Unfortunately from the client perspective it can't read responses and I think might be related to the fact messages are garble at least looking at tsung.dump I see ASCII characters like NUL, SOH, SI, etc but I also see json responses from the server somehow ok.


This is my tsung.xml file snippet:

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/Cellar/tsung/1.5.0/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" dumptraffic="true">
  <clients>
    <client host="localhost" use_controller_vm="true" maxusers="1000" />
  </clients>

  <servers>
    <server host="127.0.0.1" port="8282" type="tcp" />
  </servers>

  <load>
    <arrivalphase phase="1" duration="120" unit="second">
      <users maxnumber="1" arrivalrate="1" unit="second" />
    </arrivalphase>
  </load>

  <sessions>
    <session name="websocket" probability="100" type="ts_websocket">
        <request subst="true">
             <websocket type="connect" path="/fancyurl?Content-Type=application/json"></websocket>
        </request>
        <transaction name="getsession">
          <request subst="true">
            <dyn_variable name="sessionid" jsonpath="session"/>
            <websocket type="message">{"type": "EventMessageCmd", "user": "lnramirez", "eventCode" : "epfl"}
            </websocket>
          </request>
        </transaction>
        <thinktime value="10"/>
        <request>
          <dyn_variable name="boothAck" jsonpath="commandStatus" />
          <websocket type="message">
          {
            "user": "lramirezmonterosa",
            "eventCode": "epfl",
            "type": "BoothMessageCmd",
            "boothCode": "ic",
            "commandStatus": "REQUESTED",
            "boothRequest": "JOIN"
          }
          </websocket>
        </request>
        <request>
            <websocket type="close"></websocket>
        </request>
    </session>
  </sessions>
</tsung>

tsung.dump:

Send:1390970727.56257:<0.84.0>:‚ìÝju¦`U_ýJU_ýJU_ýJU_ÿ¸HO_ÿ/³8®¸)ÿFU]¨
ÿPU]±´°¸¼HY_ÿ³6¹W_çJW­]×JU_ýJU_ýJU_ýJU
Recv:1390970727.588689<0.84.0>:~{"type":"HeartBeatMessageCmd","timeCmdBroadcasted":1390970727588,"timeCmdGenerated":1390970727588,"commandStatus":"REQUESTED","user":"lramirezmonterosa","eventCode":"epfl","uuid":"a91e2c1b-859d-4299-99fd-e7ba63ba1f42","userSession":"25bb5627-4eb3-4a23-a1c9-edd5b8231808"}`
Stubble answered 29/1, 2014 at 15:9 Comment(4)
Looks like the dump contains the websocket framing data (2 bytes in this case) as well as the payload. So that's probably ok.Washburn
but I am trying to read the response with <dyn_variable name="sessionid" jsonpath="session"/> and variable "session": "%%_sessionid%%" says undefined alwaysStubble
This seems like a known bug, support.process-one.net/browse/TSUN-270. There have been lots of updates to the web socket support in Tsung since the 1.5.0 release, my guess it's fixed in the repo head github.com/processone/tsung, you probably should try and build it from the repo.Washburn
IDK it helps or not but Instead of default websocket support which is provided by Tsung in 1.5. I use github.com/wulczer/tsung_ws for my websocket testing and it works pretty well.Beset

© 2022 - 2024 — McMap. All rights reserved.