GithubHelp home page GithubHelp logo

Websocket test issues about locust-plugins HOT 9 CLOSED

j2l avatar j2l commented on June 14, 2024
Websocket test issues

from locust-plugins.

Comments (9)

cyberw avatar cyberw commented on June 14, 2024

Use the example as a starting point https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/socketio_ex.py

you are not supposed to copy the base class :)

from locust-plugins.

j2l avatar j2l commented on June 14, 2024

Thank you @cyberw , I finally understood the way it works 😅
Ok, I pip installed the plugins.
Since I want to test my websocket, in miniconda/.../locust_plugins/users.py, I changed:
self.ws = websocket.create_connection(f"wss://{ws_host}/socket.io/?EIO=3&transport=websocket")
to
self.ws = websocket.create_connection(f"wss://{ws_host}")

I copied https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/socketio_ex.py to my locustfile.py
and run it
and visited http://0.0.0.0:8089/ to start the load test
... but nothing happen. No user is spawned.

Only warning is about the file size (but it was also present while testing simple GET and it was working):

[2021-03-02 08:54:34,641] pop-os/WARNING/locust.main: System open file limit '1024' is below minimum setting '10000'. It's not high enough for load testing, and the OS didn't allow locust to increase it by itself. See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-number-of-open-files-limit for more info.
[2021-03-02 08:54:34,641] pop-os/INFO/locust.main: Starting web interface at http://0.0.0.0:8089 (accepting connections from all network interfaces)
[2021-03-02 08:54:34,648] pop-os/INFO/locust.main: Starting Locust 1.4.3
[2021-03-02 08:54:39,191] pop-os/INFO/locust.runners: Spawning 50 users at the rate 10 users/s (0 users already running)...

my Pop!_OS is Ubuntu 20.04
locust 1.4.3
WSS url to test is sub.REDACTED.com
GET https://sub.REDACTED.com

I guess I missed something :)
Any idea ?

image

from locust-plugins.

cyberw avatar cyberw commented on June 14, 2024

My first thought is that locust is unable to connect to your host. Can you run it in the debugger or print something just before and just after create_connection?

from locust-plugins.

j2l avatar j2l commented on June 14, 2024
print(ws_host)
        self.ws = websocket.create_connection(f"wss://{ws_host}")
        print(ws)

results in printing the host once after running and hanging there:

Starting Locust 1.4.3
[2021-03-02 11:18:45,902] pop-os/INFO/locust.runners: Spawning 50 users at the rate 10 users/s (0 users already running)...
REDACTED.com

from locust-plugins.

cyberw avatar cyberw commented on June 14, 2024

So websocket is unable to connect to your host. Most likely, this has nothing to do with locust or SocketIOUser.

Check your network, any proxy settings you might need etc.

from locust-plugins.

j2l avatar j2l commented on June 14, 2024

I use the same computer and network, actually the REDACTED.com service is running from my LAN, no proxy.
I can see websocket connections from regular clients in real time from my server.

Hmmm, as I want to understand, I re-ran the quickstart example:

import time
from locust import HttpUser, task, between

class QuickstartUser(HttpUser):
    wait_time = between(1, 2.5)

    @task
    def hello_world(self):
        self.client.get("")

from the same install (locust and server).
It totally works:
image

I really don't understand what is blocking the websocket locust plugin.

from locust-plugins.

j2l avatar j2l commented on June 14, 2024

Could I send you a private message withe the real domain for you to test?
I added REDACTED since it's a proptype server running from my home and I have to test it today for tomorrow presentation.

from locust-plugins.

j2l avatar j2l commented on June 14, 2024

FIXED!
I just added the same ws path (already present in the locustfile.py, so I wrongly assumed it was added to the host passed) and now it reaches the server:
image

I wonder why the path is present is the locustfile :)
Never mind, it's working!
Maybe adding a ping before to make sure the domain is responding might help the error code that should spawn 😄
I'm not into locust enough to know how to do it.

BTW, there are many other questions:

  • Looking at the webmin in real-time, I noticed a different behavior than when I use regular clients, how to mimic websocket outgoing?
  • How to add websocket and locust-plugins to work with the locust docker container?

from locust-plugins.

cyberw avatar cyberw commented on June 14, 2024

I just added the same ws path (already present in the locustfile.py, so I wrongly assumed it was added to the host passed)

Great! I might change it so that it defaults to use the "main" host specified in locust parameters or on host attribute for WS as well (in my use case I also wanted to run http requests against a different domain, so it made sense to keep them separate)

Looking at the webmin in real-time, I noticed a different behavior than when I use regular clients, how to mimic websocket outgoing?
How to add websocket and locust-plugins to work with the locust docker container?

These are things you'll just have to figure out yourself, sorry :)

from locust-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.