What is the operation mode and overall architecture of Tomcat?
What this article shares with you is about the operation mode and overall structure of Tomcat. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Overall architecture
If we want to understand a framework, we first need to understand what it does. Tomcat, as we all know, is used to handle connected Socket requests. Then Tomcat will have two functions:
Handle the connection externally and convert the received byte stream into the Request and Response objects you want
Process Servlet internally and distribute the corresponding Request request to the corresponding Servlet
Then our overall skeleton comes out, and the Tomcat is actually divided into two parts, one is that the Connnector handles external connections and the other is that the Container manages the internal Servelet. The general diagram is as follows
The outermost large box represents a Tomcat service, and a Tomcat service can correspond to multiple Service. Each Service has connectors and containers. We can also open these corresponding relationships and see them in server.xml in the Tomcat directory configuration file.