Skip to content
Ameen Abozaid
Planned lessonMID-007-L01

The thread-per-request problem

  • Lesson 1 of 6
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

explain why blocking I/O wastes platform threads.

Planned topics

  • Classic servers give each request one platform thread (an OS thread, about 1 MB of stack by default; verify).
  • A thread waiting on a database or HTTP call does no work but still occupies the thread.
  • Pool of 200 threads means about 200 concurrent requests; more queue up.
  • Reactive code avoids this but is harder to write and debug.
  • Wish: simple blocking code that scales.
Draft outline details

Demonstration

200 threads, 190 waiting on a slow supplier endpoint; request 201 waits in line.

Check your understanding

Why does a waiting thread limit throughput?

Show answer

It holds a scarce OS thread while doing nothing.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.