MySQL Proxy-Core layer (Core) Network Core is built on the basis of socket processing implementation, and the client connection and server connection are associated together. [Connection Life Cycle] connection can be in one of the following four basic protocols: connectauthentificationquerydisconnect can change the default working mode of network core by customizing the plug-in function, then, obtain one of the following three basic plug-in functions: plugin-admin only implements the listen function client plugins only implements the connection function plugin-proxy implements the above two features [Scripting] plugin provided in the source code are implemented corresponding callback function, and exposed it to the scripting layer. Currently, the scripting layer is provided by Lua-a simple, fast, and easy-to-embed scripting language. By exposing most of the internal data to the scripting layer, the corresponding module functions can perform operations on the data uploaded to the scripting layer. [Network Core Layer] The Network engine of MySQL Proxy is designed to process thousands of connections at the same time and is intended to be used for load-balancing and fail-over processing, therefore, it must be able to handle connections elegantly when there are many MySQL backend servers at the same time. The target is locked in the number of connections ranging from 5 k to 10 k. Until MySQL Proxy version 0.7, MySQL Proxy uses purely event-driven, non-blocking network models. Based on the event-driven design, MySQL Proxy only saves a small amount of necessary information for idling connection: that is, it only saves the connection status and waits for the event to arrive. [Threaded Scripting] scripts are usually exquisite and only used for simple decision processing. Most of the work is handled by the network layer. In future versions 0.9, the multi-threaded model supported in the script layer will be used to achieve the simultaneous running of multiple script threads in the form of thread pools. In this way, the script layer can call blocking or slow functions without interrupting the execution of other connections. The lift of global plugin mutex means that we must access the global structure in different ways. Because most of the access occurs at the connection level (that is, the layer of event-threading. global.. Based on this requirement, we will study how to send data between independent Lua-states.