concept Tomcat in category cloud

This is an excerpt from Manning's book Cloud Native Spring in Action.
An application is self-contained if it doesn’t depend on a web server to be available in the execution environment. A Java web application would probably run inside a web server container like Tomcat or Undertow. A Twelve-Factor app would not require the environment to have a Tomcat server available, but it would manage it itself as any other dependency. Spring Boot, for example, lets you use an embedded web server: the app will contain the web server rather than depending on one being available in the execution environment. One of the consequences of this approach is that there is always a one-to-one mapping between app and web server, unlike the traditional method where multiple applications were deployed on the same web server.
Figure 3.3. The parameters for initializing the Catalog Service project.
![]()
Tomcat is initialized with a thread pool used to manage all incoming HTTP requests. When all threads are in use, new requests will be queued, waiting for a thread to get free. In some applications having to respond to high demands, this setup might not be ideal. In later chapters, I’ll introduce some alternatives that will use asynchronous, non-blocking approaches to better handle those cases.
Spring MVC is the library included in the Spring Framework to implement web applications, either full MVC or REST-based apps. In both cases, the functionality is based on a web server like Tomcat that provides a servlet container according to the Java Servlet API. Figure 3.6 shows how the REST-based request/response interaction works in a Spring web application.
Figure 3.6. The DispatcherServlet is the entry-point to the servlet container. It delegates the actual HTTP request processing to a Controller identified by the HandlerMapping as the one responsible for a given endpoint.
![]()