Locust: support async tasks?

Created on 1 Dec 2018  路  9Comments  路  Source: locustio/locust

now the http client is synchronised and we would like to use AioHttpClient to simulate large number of requests concurrently. However the task set supports no async def xxx() yet, adding support for async would be really helpful?

Most helpful comment

I should say I have thought that it might be worthwhile to swap from gevent library to asyncio... or at least make that an option behind the scenes

All 9 comments

@naivefun gevent ?

Why do you want to do this?

The easiest way is to create more locusts. The paradigm locust has is that each Locust is only executing one task simultaneously (reflecting user behavior). Does creating more clients not solve this situation?

There are some libraries that are based around async. For example, I have use case for connecting to a websocket during a task. The popular websockets library uses asyncio: https://websockets.readthedocs.io/en/stable/intro.html

@aldenpeterson-wf I'm not familiar with python, but async enables NIO so that it scales up easily. Does this work the same way in python?

I have to call asyncio websockets code from locustfile, seems it's not possible now.

I should say I have thought that it might be worthwhile to swap from gevent library to asyncio... or at least make that an option behind the scenes

Yes, it would be worthwhile 馃憤

Then I'll open a new issue to explicitly ask for asyncio support / rewrite.

See my comment here as it also applies to this issue as well: https://github.com/locustio/locust/issues/1251#issuecomment-580807529

Was this page helpful?
0 / 5 - 0 ratings