Run Requests in Parallel

Talk it through out loud with your AI coach.

The problem

  • hard
  • Pro

A dashboard loads ten independent widgets. The current code awaits each request one after another, so the page takes the sum of all ten response times. Explain how you'd load them in parallel, what should happen when one request fails or hangs, and how you'd avoid overwhelming the server if there were a thousand requests instead of ten.

What a strong answer covers

  • Starting independent requests together rather than one after another.
  • Choosing between failing fast and collecting every result, error or not.
  • Dealing with a request that never answers.
  • Keeping a very large batch from flooding the server.

Common mistake: Awaiting each request inside a loop and expecting them to run in parallel.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud