1. Overview of Mysql architecture
The entire MySQL Server consists of the following
-
Connection Pool: indicates a Connection Pool component
-
Management Services & Utilities: Components that manage Services and tools
-
SQL Interface: SQL Interface component
-
Parser: Queries the Parser component
-
Optimizer: Optimizer component
-
Caches & Buffffers: Buffer pool assembly
-
Pluggable Storage Engines: Storage engine
-
File System: indicates the File System
1) connection layer
At the top layer are some client and link services, including local SOCK communication and most TCP/ IP-like communication implemented based on client/server tools. Mainly complete some similar connection processing, authorization and authentication, and related security schemes. On this layer, the concept of thread pools is introduced to provide threads for clients that are securely accessed through authentication. SSL – based secure links can also be implemented at this layer. The server also validates that it has operational permissions for each client that is securely connected.
2) Service layer
The second layer architecture mainly completes most of the core service functions, such as SQL interface, and completes the cache query, SQL analysis and optimization, and the execution of some built-in functions. All cross-storage engine functionality is also implemented in this layer, such as procedures, functions, and so on. In this layer, the server will parse the query and create the corresponding internal parse tree, and perform the corresponding optimization, such as determining the order of the query table, whether to use the index, and finally generate the corresponding execution operations. If the select statement is used, the server also queries the internal cache. If the cache space is large enough, the system performance can be improved in an environment where a large number of read operations are performed.
3) Engine layer
Storage engine layer, storage engine is really responsible for the storage and extraction of data in MySQL, server through API and storage engine communication. Different storage engines have different functions. In this way, you can select a proper storage engine based on your own needs.
4) Storage layer
The data storage layer stores data on file systems and interacts with storage engines.
MySQL is a bit different from other databases in that its architecture can be used and used well in many different scenarios. Mainly reflected in the storage engine, plug-in storage engine architecture, query processing and other system tasks and data storage extraction separation. In this architecture, you can select an appropriate storage engine based on service requirements.