使用 Locust 对核心 SignalR 进行负载测试 Asp.net

Load-testing Asp.net Core SignalR using Locust

我想使用 Locust 对 SignalR 服务进行负载测试。我发现以下库可以发送和接收 SignalR 请求:https://pypi.org/project/signalrcore/

现在,根据 Locust 文档,下一步是为 Locust 编写一个可以发送 SignalR 请求的自定义客户端。但是有如下警告:

Any protocol libraries that you use must be gevent-friendly (use the Python socket module or some other standard library function like subprocess), or your calls are likely to block the whole Locust/Python process.

Some C libraries cannot be monkey patched by gevent, but allow for other workarounds. For example, if you want to use psycopg2 to performance test PostgreSQL, you can use psycogreen

我是Python的初学者,所以我不明白它的确切含义。我使用的库“signalrcore”是 100% 同步的。这是否意味着我不能将它与 Locust 一起使用? 我找到了一个使用 asyncio 的 signalrcore 分支。我应该改用那个 fork 并确保我所有的信号器调用都是非阻塞的吗?

谢谢!

SignalRCore 似乎在幕后使用请求和 websocket-client,两者都是 gevent 友好的。我不能肯定地说,但我认为它有 90% 的可能性“开箱即用”:)

如果你确实使用 asyncio,你需要自己做一些魔术。至少我从来没有把它和gevent结合起来。