Introduction to the

After exploring the process in the previous articles, most of the process is understood, and this document will provide a summary of the Soul gateway process

conclusion

The process flow of the Soul gateway is as follows:

The processing process is shown in the figure above, which can be roughly divided into two parts:

  • 1. Plug-in initialization and configuration initialization: initialization of the plug-in chain and associated routing configuration
  • 2. Request Processing process: How is a request handled roughly

Plug-in initialization and configuration initialization

In the ninth article: Soul Gateway source code reading (nine) plug-in configuration loading preliminaries, we analyze the relevant details

The initialization of the plug-in is implemented using Spring’s automatic configuration loading mechanism, and the plug-in needs to introduce any start dependencies

Plugin data, selector data, rule data initialization, all from the Websocket (or synchronous communication module) from the side, after receiving data, configuration load to the local

Request Processing process

In the figure above, you can see that we have roughly categorized plugins:

  • Preprocessing:

    • GlobalPlugin: Sets the type of request; HTTP Real back-end path; Rpc metadata; Its role can not be ignored, in the plug-in chain is more important
  • Expansion: blacklist, authentication, traffic limiting, degrade, fuse and other expansion operations; Extensions are divided into global and specific rules; Rule matching is required for a specific rule

  • Route matching:

    • DividePlugin: HTTP route matching; Load balancing; Change the path to a real back-end server
    • BodyParamPlugin: Rpc route matching; Put the request parameters into; The metadata globalPlugin places already contains path information; Load balancing is delivered with RPC
  • The request is sent, the response is put into exchange: HTTP, Websocket, RPC

  • Response return: divided into HTTP response return and RPC response return; The return call is actually sent to the client by calling the exchange response function

There are other explorations, such as the origin of the request type

Of course, this part of the other details or quite a lot of questions will continue to explore, the work behind another piece of the core: routing data configuration and synchronization to explore

Soul Gateway source code analysis article list

Github

  • Soul source reading (a) overview

  • Soul source code reading (two) the initial run of the code

  • HTTP request processing overview

  • Dubbo Request Overview

  • Soul Gateway source code reading (five) request type exploration

  • Soul Gateway source code reading (6) Sofa request processing overview

  • Soul gateway source code reading (seven) a stream limit plug-in exploration

  • Soul gateway source code reading (eight) route matching exploration

  • Soul Gateway source code reading (nine) plug-in configuration load preliminary discussion

  • Soul Gateway source code reading (ten) custom simple plug-in written

  • Soul Gateway source code read (11) request processing summary

  • Soul Gateway source code reading (12) data synchronization preliminary -Bootstrap end

  • Soul Gateway source code reading (thirteen) Websocket synchronization data -Bootstrap end

  • Soul Gateway source code reading (14) HTTP data synchronization -Bootstrap end

  • HTTP parameter request error

The Denver nuggets

  • Soul Gateway source code read (a) overview

  • Soul Gateway source code reading (two) the initial operation of the code

  • Soul Gateway source code reading (3) Request processing overview

  • Dubbo Request Overview

  • Soul Gateway source code reading (five) request type exploration

  • Soul Gateway source code reading (6) Sofa request processing overview

  • Soul gateway source code reading (seven) a stream limit plug-in exploration

  • Soul gateway source code reading (eight) route matching exploration

  • Soul Gateway source code reading (nine) plug-in configuration load preliminary discussion

  • Soul Gateway source code reading (ten) custom simple plug-in written

  • HTTP parameter request error