27 Aralık 2022 Salı

Tomcat Mimarisi

Giriş
Şeklen şöyle

Temel bileşenler şöyle
1. Server  : Tomcat'ın kendisi
2. Service : Connector ve Container içerir
3. Connector : İstemci bağlantılarını ve protokolleri içerir
4. Container : Engine'ı içerir

Açıklaması şöyle
The Server component is the outermost component of Tomcat, which is an abstraction of the Tomcat instance itself and represents Tomcat itself. A Server component can have one or more Service components.

The Service component is a set of components in Tomcat that provide services and process requests. A Service component can have multiple Connectors and a Container. Multiple Connectors indicate that it can use multiple protocols to receive user requests at the same time.

The connector is responsible for handling client connections, and it provides support for various service protocols, including BIO, NIO, AIO, etc. The value of its existence lies in shielding the complexity of multi-protocol Containers and unifying the processing standards of Containers.

The Container component is the container responsible for specific business logic processing. When the Connector component establishes a connection with the client, it forwards the request to the Engine component of the Container component for processing.

At this point, the core components of Tomcat are basically finished. In fact, there are many subdivided components in the Container component. In fact, if you are interested in the abstraction of the business, you can continue to look at it.

- The Engine component represents a runnable Servlet instance, including the core functions of the Servlet container, which can have one or more virtual hosts (Host). Its main function is to delegate the request to the appropriate virtual host for processing, that is, to match the appropriate virtual host for processing according to the configuration of the URL path.
- The Host component is responsible for running multiple applications, and it is responsible for installing these applications. Its main function is to parse the web.xml file and match it to the corresponding Context component.
- The Context component represents the specific Web application itself, and its most important function is to manage the Servlet instances inside. A Context can have one or more Servlet instances.
- A Wrapper component represents a Servlet, which is responsible for managing a Servlet, including Servlet loading, initialization, execution, and resource recovery. The wrapper is the lowest-level container.

It can be seen that Host is the abstraction of the virtual host, Context is the abstraction of the application, Wrapper is the abstraction of the Servlet, and Engine is the abstraction of the processing layer.
Container Component
Şeklen şöyle. Thread Pool'ları yönetir. Aslında acceptCount, maxConnections, maxThreads parametreler hep Connector'a tanımlanıyor. Tomcat server.xml Connector yazısına bakabilirsiniz


Engine Component
Tomcat server.xml Engine yazısına bakabilirsiniz. İçinde virtual host için tanımlamalar bulunur. Servlet'i temsil eder.

Context Component
Tomcat context.xml yazısına bakabilirsiniz. Environment variables, JNDI tanımlamaları burada yapılır





Hiç yorum yok:

Yorum Gönder