0

I am using a simple demo Starlette app (right out of the docs, just added an asyncio.sleep() statement there:

import asyncio
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route


async def homepage(request):
    await asyncio.sleep(1)
    return JSONResponse({'hello': 'world'})


app = Starlette(debug=True, routes=[
    Route('/', homepage),
])

I am running this using uvicorn

Using a load testing client (e.g. locust, or a custom test client), I see that I get 1 response per second, which implies no parallelism.

Shouldn't Starlette serve multiple requests concurrently?

sagism
  • 881
  • 4
  • 11
  • 18
  • 3
    Please show the `uvicorn` command you used to start the app and also the command you used for load-testing. Thank you. – Mark Setchell Jun 05 '22 at 16:34
  • have just tried and the above works fine for me, more details are needed to be able reproduce your issue – Sam Mason Feb 10 '23 at 12:37

0 Answers0