Developers said: Sentinel flow control practice on SpringMVC / SpringBoot of

Integrated pre-existence Sentinel

Flow control in a distributed system is more basic needs, it needs to load in the system, quality of service, traffic identification, control and other security ⻛ ⽅ ⾯ into ⾏ security, and according to business needs, make the dynamic adjustment or temporary workers involved in the Face, especially during ⼀ of these events in order to achieve rapid control and recovery services results.

Flow control means mounted generally within the flow logic and gateway services.

Nginx is common in this type of traffic gateway proxy layer, by extension, Lua script into ⾏ flow control for IP / Path / Query and other forms of. The service signal is multi zoomed amount, thread pool, timeout logic or other local or frame layer flow control is achieved. The former is mainly reflected in the operation and maintenance of operability, does not invade START lines of business, while the latter is more targeted, but there is need to deploy when the invasion START or modify, ⾯ controlled the business team.

Two types of flow control more often ⽐ separated (without control in a space shared by different teams), the index often uncoordinated.

In order to solve this problem ⼀, we began a summary of existing demand, research-related systems, and is ready to implement ⼀ sets simultaneously for business and operation and maintenance, application-level isolation and meet the basic needs of the type of flow control rules implementation is expected in Nginx end use LuaJIT achieve a more powerful flow control module.

Research process, coincides with the release Sentinel 0.1 / 0.2, ⽀ support servlet integration (URL limiting), with an operating ⾯ panel (Dashboard), supports basic real-time status view, modify real-time distribution rules, and global load a single point fuse, flow control can be performed based on QPS, semaphores like. In addition to the zero-intrusive, full EMPTY basic to our needs, so be prepared to carry out programs based Sentinel landing attempt.

Practice of Integrated Sentinel

Our basic requirements are as follows:

  • Do flow control based on URL
  • Based Dashboard for dynamic modification rules
  • Business end for SpringMVC / SpringBoot
  • ⽀ support asynchronous Servlet (proposed follow-up)
  • sentinel-transport monitor end-connector can be customized (involved in fire prevention wall configurations, with ⼀ Multi-Service Node)

Integrated adaptation
functions provided by Sentinel based adaptation mode, the basic configuration and the need for modification.

Integrated manner
conventional flow START entry destination time-based multi-port portion zoomed SpringMVC project SpringBoot small part of the project, and from the point of view operation and maintenance deployment, the main front destination time when running a normal mode (JVM / Tomcat) and the container of the embodiment .

  • Normal operation mode: to avoid modification JVM startup parameters, parameters are defined by the central or centralized configuration files properties;
  • Container of Modes: Multi zoomed parameters are defined by the ENV environment variable.

So we according to the actual needs of the Sentinel initialization ⼯ into ⾏ for the package, provides an XML-based SpringMVC initialization method, based on SpringBoot for annotations initialization, for example:

    @InitDefaults(

          projectName = "demo",

          sentinelPort = 19000,

          sentinelGroup = "test"

     )

Integrated Block Diagram

Integration Points

  • AUTO START determines whether a corresponding primer-dependent Sentinel
  • Auto Configuration
  • Using ZooKeeper rule storage center (weight Using existing infrastructure)
  • End node supports reading and writing of the rules
  • Integrated sentinel-transport-netty-http to support the Dashboard
  • Dashboard API by using the operation unit ⼀ care has indirectly node can write rules Zookeeper, so that all nodes in the distribution ⾄

Using mainly the sentinel-web-servlet, using this program, no matter if the need to do any ⼆ times Dashboard development, can follow the upgrade, the business is less invasive

Sentinel's expectations

  • Simplified flow control different scenarios integrated with the floor
  • Simpler non-strict cluster limiting, can be introduced ADVANCED Use
  • Dashboard
  • Achieve Dubbo / ZooKeeper / Spring / Servlet adapted relevant standards of the box


Original link
This article Yunqi community original content may not be reproduced without permission.

Guess you like

Origin blog.csdn.net/weixin_43970890/article/details/91987476