Back to Locust

aiolocust / asyncio

docs/asyncio.rst

2.44.11016 B
Original Source

=================== aiolocust / asyncio

aiolocust <https://github.com/cyberw/aiolocust>_ is a 2026 reimagining of Locust.

It uses asyncio <https://docs.python.org/3/library/asyncio.html>/aiohttp <https://docs.aiohttp.org/en/stable/> instead of gevent/requests and leverages modern Python.

.. code-block:: python

import asyncio
from aiolocust import HttpUser

async def run(user: HttpUser):
    async with user.client.get("http://example.com/") as resp:
        pass
    async with user.client.get("http://example.com/") as resp:
        # extra validation, not just HTTP response code:
        assert "expected text" in await resp.text()
    await asyncio.sleep(0.1)

It has less features than Locust and aims to be more minimalistic, relying on OTEL for more complex visualization and analysis.

It is currently maintained as a separate project <https://github.com/cyberw/aiolocust>_, but may be merged and/or shipped with Locust in the future.