Multiple web-sockets in the same thread group

Issue #159 new
Gabriele Centinaro created an issue

Hi,

I am using JMeter to test our websockets server application and now I am facing the following issue. Our application manages multiple websocket servers that interact at the same time so I would need to be able to open and keep open multiple WS at the same time to be able to use them in parallel.

I know that this plugin only allows one WS at the time and as soon as a new one is created the previous one is shut down but I wonder if you can consider the possibility to add to the plug in the possibility of use multiple WSs in the same thread.

Thanks,

Gabriele Centinaro

Comments (40)

  1. Sven Koster

    Hi Peter. This branch is exactly what I need. I checked out the branch, compiled it and use it with JMeter 5.2.1. Can you merge this branch, so I am able to get the library from Maven Central?

    Alvast bedankt! Sven

  2. Gabriele Centinaro reporter

    Hi Peter, I did try building the repo but when I copy the jar into the lib/ex folder and try to use the plugin I don’t get the “WebSocket Advanced Options” in the Non-test Elements menu.

    Can you please post a build from your side that works so I can try?

    Thanks,

    Gabriele

  3. Sven Koster

    Just check out the repo, switch to the ‘multiple-connections’ branch and type ‘grade assemble’. You will find the jar (actually 3) in the ‘build’ directory.

  4. Gabriele Centinaro reporter

    I was checking out the wrong repo. It works as expected.

    When can this be merged to master?

    2020-05-04

  5. Gabriele Centinaro reporter

    Hi Peter,

    Do you have any plans to merge into master the multiple-connections branch so it becomes part of the official plug-in?

    Thanks,

    Gabriele Centinaro

  6. Peter Doornbosch repo owner

    Hi Gabriele,

    I had not until now, but with the feedback of you two, i think it’s time to merge it. Will try to do this soonish, but i’m quite busy at the moment, so i can’t promise when it will be done.

    Thanks for your feedback.
    Cheers,
    Peter

  7. Kalpit

    I downloaded the repository and build it but could not find  “WebSocket Advanced Options” in the Non-test Elements menu. Can you please elaborate on how to add this in jmeter?

  8. Sven Koster

    Did you download the right branch? And did you add it to the right lib/ext directory of JMeter? You should just see the option if you are on the top-level of your project.

  9. Kalpit

    Yeah. I downloaded the multiple connections branch. Then I added it in lib/ext of my apache jmeter folder. One thnng that bothers me is I downloaded the zip but every other folder in lib/ext are jar folders

  10. Sven Koster

    You should extract the zip, build the project (with gradle assemble) and then in the build directory move the jar to the lib/ext directory 🙂

  11. Kalpit

    Thank you @Sven Koster . I got the Websocket Advanced Options in non-test elements but I do not get any connection-id field or any additional feature as described by @Peter Doornbosch . Do I need to do something more to make it work?

  12. Sven Koster

    Did you add the Advanced Options and turned it on? You should. Then you get an extra option called ‘Connection ID’. I normally put in a number to differentiate.

  13. Peter Doornbosch repo owner

    I cannot reproduce this. I downloaded JMeter 5.2.1, created a test plan, added a “WebSocket Single Read Sampler”, added “WebSocket Advanced Options”, checked “Enable multiple connections per thread”. Then, when i select the read-sampler, there is a “Connection ID” field just below the “setup new connection” radio….

  14. Gabriele Centinaro reporter

    All correct here as well.

    A similar problem happened to me the first time I tried, i was downloading the wrong branch.

  15. Kartik Kanda

    I am having issues in building the project after downloading the repository. Can you please help me on this by providing detailed steps.

    Below are the steps which I followed, let me know if any of the steps followed are wrong

    1. Downloaded the repository to local machine and extracted the zip folder. Refer below screenshot for the repository which i downloaded

    2. Installed Gradle in local machine

    3. In cmd prompt, Navigated to the local repository path and executed the command 'gradle assemble'.

    Build is failing with below error

  16. Sven Koster

    @Kartik Kanda : it looks like you don’t have an internet connection. You have to see how to configure gradle to be able to download sources from the internet. It has nothing to do with this code.

  17. Kartik Kanda

    Hi ,

    I am able to build project and see Websocket Advanced options in Jmeter, after adding the jar to lib/ext

    But when I goto Jmeter ->Test Plan-> Non Test elements-> Select ‘WebSockets Advanced Options’, I am getting below error. Can you let me know the reason for this error and solution to it

    2020-06-09 09:56:41,104 ERROR o.a.j.JMeter: Uncaught exception in thread Thread[AWT-EventQueue-0,6,main]
    java.lang.NoSuchMethodError: eu.luminis.jmeter.wssampler.WebsocketSampler.checkJMeterVersion()Z
    at eu.luminis.jmeter.wssampler.AdvancedOptionsElement.<clinit>(AdvancedOptionsElement.java:30) ~[JMeterWebSocketSamplers-dev.jar:?]
    at eu.luminis.jmeter.wssampler.AdvancedOptionsGUI.createTestElement(AdvancedOptionsGUI.java:82) ~[JMeterWebSocketSamplers-dev.jar:?]
    at org.apache.jmeter.gui.GuiPackage.createTestElement(GuiPackage.java:373) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.gui.action.AddToTree.doAction(AddToTree.java:67) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:87) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:69) ~[ApacheJMeter_core.jar:5.3]
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) ~[?:1.8.0_202]
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) ~[?:1.8.0_202]
    at java.awt.EventQueue.access$500(EventQueue.java:97) ~[?:1.8.0_202]
    at java.awt.EventQueue$3.run(EventQueue.java:709) ~[?:1.8.0_202]
    at java.awt.EventQueue$3.run(EventQueue.java:703) ~[?:1.8.0_202]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_202]
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) ~[?:1.8.0_202]
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) ~[?:1.8.0_202]
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) [?:1.8.0_202]
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [?:1.8.0_202]
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [?:1.8.0_202]
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:1.8.0_202]
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [?:1.8.0_202]
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) [?:1.8.0_202]

  18. Kartik Kanda

    Yep. I have removed one now and kept only one plugin which I built. It is working and I am able open Websockets Advanced options. Thanks 🙂

  19. Peter Doornbosch repo owner

    @Sven Koster “any ETA when you will merge this branch to master?”

    No, sorry, not yet. I developed this feature long time ago and i remember that there was left some work to do, so it’s not just a matter of merging; i want to bring it to production quality before merging to master.

    What would merging to master bring you that you yet don’t have?

    Regards
    Peter

  20. Gabriele Centinaro reporter

    Hi Peter,

    The multiple web-sockets branch is from 2018‑11‑19 and since then you fixed a lot of things that are int he master branch. I thought about using directly the branch but I am afraid of what consequences could have on my current scripts.

    Gabriele

  21. Sven Koster

    @Peter Doornbosch : I can’t use this jar; I use it from an project where I use JMeter from junit through java. I start JMeter programmatically. To use this code I need a maven dependency, as the project is built by maven. So I can only include what is in maven central and not separate branch builds.

  22. Gabriele Centinaro reporter

    @Peter Doornbosch,

    Hi Peter, any news about merging this feature?

    Thanks,

    Gabriele

  23. Peter Doornbosch repo owner

    Hi Gabriele,

    I merged master branch into multiple-connections branch for you. So at this point, all fixes and improvements that are introduced on master, are now also in this branch. So you don’t have to fear that using this branch would break your current scripts.

    Hth,
    Peter

  24. Sven Koster

    Hi @Peter Doornbosch , can the connection id contain also @groovy() scripts to generate the id? Because I need multiple connections per thread and if the connection id is per thread group and not per thread it will interfere. Like if 2 threads make connection id “1”, they both read the same WebSocket when referencing “1”, or do they have their own private reference?

  25. Gabriele Centinaro reporter

    Thanks Peter,

    The branch seems to work perfectly and I can manage now multiple WS in the same thread.
    One question, moving forward will you maintain both master and this branch?
    If you make a fix in master because of a bug or new feature, will that also be merged in this branch?

    I am always worried using a branch instead of master I will be forced not to take advantage of any future implementations.

    Gabriele

  26. rhiadechavez

    Hi Peter Doornbosch,

    I hope your doing well. Recently, we had opportunity to use your multiple WebSocket connection feature into our ongoing project.
    We've found it immensely beneficial, since we have condition to run multiple WebSocket calls from a single ThreadGroup.

    No issues we're encountered during our extensive use of multiple WebSocket calls and we firmly believe that incorporating this
    functionality into the master build and including it in the current WebSocket plugins would be advantageous.

    Doing so would not only streamline the process of current user but also facilitate its accessibility for future users
    who can utilize it without the need for separate jar file builds.

    I hope you find a time making this feature official.

    Super Thanks!
    Rhia

  27. Peter Doornbosch repo owner

    Hi Rhia,

    Thanks a lot for your feedback! Great to hear that this feature was useful and that you didn’t encounter any issues with it. Makes me certainly more confident about merging it onto master.

    Thanks
    Peter

  28. Tech Visiom

    I have used multi-connection web-socket and its working great but I have an issue that if I’m using WSS connection for longer duration I get these errors :
    Response code:Websocket I/O error
    Response message:WebSocket I/O error: Connection reset by peer

    how can I extend life of WSS connection?

  29. mm

    Hello, I have a problem. When I use the official version of the same WebSocket interface, my requests are processed normally. However, when I use multiple WebSockets, I receive a 404 error. The server log indicates that the request origin is not allowed, but the data in the request header is the same.They are the same interface

  30. Log in to comment