Each request runs in a separate thread!

You might hear people say things like, “Each instance of the servlet...” but that’s just wrong. There aren’t multiple instances of any servlet class, except in one special case (called SingleThreadModel, which is inherently evil), but we’re not talking about that special case yet.

The Container runs multiple threads to process multiple requests to a single servlet.

And every client request generates a new pair of request and response objects.

image with no caption

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.