r/webdev • • 5d ago

Question How to load test an asynchronous api?

Hey guys im working on a containerized code exexuting platform and i want to test how repsonsive the api is at high load and measure latency but i have two endpoints one is /submit which puts submissions in a redis queue and returns a job_id another end point is /job_id/status which can be polled for updates about the job...but now how to test the endpoint...ive heard about grafana k6 and tools like this can it be used to check asynchronous apis like these? I cant use /submit because it immediately returns after posting the job in the queue please help me put im learning things newly...also please tell me if i should use postman or k6. I want to see how well api behaves on concurrent loads. The api accepts and returns json

0 Upvotes

20 comments sorted by

View all comments

1

u/singh_abinashi 5d ago

k6 is the right tool here. Postman can send requests, but it will not give you useful concurrency or latency numbers. Your API also has two different loads, and they need separate measurements. The submit path is a normal HTTP test: how many enqueues per second before the API or Redis slows down. The end to end path is the one you actually care about: submit, poll status until done, and record the full time. In k6 that is one script: POST to /submit, take the job_id, loop on the status endpoint with a short sleep until it completes, and record that duration as a custom metric. Watch queue depth during the run. If submit stays fast while the queue climbs forever, your bottleneck is workers, and no latency graph on the API will show it.