Micro Services and gateway technology (SIA-GateWay)

One, background

Software architecture, always in constant evolution ...

Back to the time before twenty years, when the field of R & D enterprise mainly respected or C / S mode, PB, Delphi software development such mainstream enterprise application development. Over time, browser-based B / S structure gradually began to pop up. Early, Web developers ASP also occupies a lot of advantages, but the JSP pre-compilation mode allows performance has been greatly improved, and then based on J2EE architecture JAVA language is becoming increasingly popular.

Early software architecture are basically single architecture, often it requires no interaction between systems, which also led to the development of data silos and ETL tools. As more and more enterprise applications, is also increasingly close relationship with each other, there is an urgent need for access to real-time interaction between applications, then XML based integration of heterogeneous systems and data technology start interacting been adopted by many companies, is the concept of SOA put out, web service is gaining popularity.

Internet era, many companies more flexibility in order to meet business needs, based on the HTTP protocol and Restful architectural style and a clear concise language and structure of JSON as the best practice of corporate development, in the SOA architecture, ESB enterprise service bus technology exposed centralized architecture allows developers to understand the disadvantages of approaches based on key registration and discovery of distributed architecture is to solve the problem. As a result, micro-service architecture became popular.

In the "micro-service design" in how to define a micro-services, it is the use of loosely coupled & high cohesion principle, due to the same factors change things come together, the result of different factors change things district separates.

Second, micro-service architecture features

Micro service, in fact, is an architectural style ...

2.1 Heterogeneous

Different services best suited to different technical solutions, micro-services can help us to easily use different technologies, and understand the benefits of these new technologies. Try new techniques typically associated with risk, but for micro-services system, there will always be something where you can choose a minimal risk of service adoption of new technologies, and reduce risk.

2.2 Isolation

Micro-service architecture system is decomposed into separate operating unit to the system a better isolation, independent micro-services easier to locate and isolate problems when an exception occurs, isolation is the basis of scalable services.

2.3 Extended

Large single service as a whole can only be extended, even if there are performance problems in the system, only a small part of the module, also needs to be extended to the entire system. Micro-architecture and service level performance required of different modules according to the extended, elastic microspheres and services can be well treated and functional service is unavailable degradations.

2.4 simple deployment

In the micro-services architecture, the deployment of each service is independent, so that you can more quickly deploy a specific part of the code. Service problems more easily and quickly rolled back, while the agile delivery and deployment brings better business demand response experience.

2.5 Flexible

In the micro-service architecture, the system will open many interfaces for external use, when circumstances change, you can build applications in different ways. The whole of the application can only offer a very coarse-grained interfaces for external use. Application of the monomer into a plurality of micro-services, can be achieved with a reusable object may be combined.

Third, micro-services and gateway technology

The figure is a typical micro-service architecture for reference purposes only.

Micro Services and gateway technology (SIA-GateWay)

3.1 What is a micro-service gateway

Micro Services Gateway is a key role micro-services architecture to protect, enhance, and control access to micro-services, micro-services gateway is a system in previous applications or services, to manage authorization, access control and flow restrictions, this service will be protected micro-micro gateway services together, transparent to all callers. Thus, hidden behind the micro-services gateway business system can be more focused on the business itself.

3.2 Classification of micro-services gateway

The common use of micro gateway service is divided into a flow characteristic substantially gateway and the service gateway. Two kinds of gateways each with a different focus, following figure summarizes two types of gateway features:

Micro Services and gateway technology (SIA-GateWay)

3.3 Role of micro-services gateway

Micro Services Gateway provides a connection service consumers and service middleware system side, the evolution and development of their business systems made of natural isolation, the business system itself is more focused on business services, while micro-services gateway can also service delivery and precipitation more additional features, micro-services gateway main role is as follows:

Micro Services and gateway technology (SIA-GateWay)

四, SIA-GateWay

SIA-GATEWAY is a distributed system based on micro-services gateway service under SpringCloud micro ecosystem development. It includes easy to use, visual, highly scalable, high availability characteristics provide cloud native, mature and complete access solutions.

4.1 Key Features

  • Easy to use, it supports rapid deployment Docker containers and delivery.
  • Good compatibility, compatible with load balancing SpringBoot micro services and traditional HTTP-URL and routing services.
  • High scalability, support for third-party plug-ins expand its features and dynamic loading mechanism based on the Java language.
  • Support for multi-tenancy, the gateway to split a multi-user management roles.
  • Visual management, providing real-time routing topology, the gateway cluster topology display function.
  • Service governance, support gateway cluster Dashboard, real-time log, history log, fusing management, alarm management.
  • Multi-registry support, providing handover management function for multi-registry cluster of distributed gateway cluster.
  • Dynamic routing component binding mechanism, providing public service components including URL statistics, logs, gray publish, current limiting, and security.

The figure is SIA-GATEWAY FIG overall architecture, and the architecture of CORE Admin Cluster, of which:

  • Main HTTP gateway service node bearer request CORE, CORE The gateway node may belong to the group information automatically registered to the management terminal Admin.
  • Admin is the gateway cluster management background by Admin, Service, Stream, Monitor and other service components.

Micro Services and gateway technology (SIA-GateWay)

The overall architecture of the gateway deployment as shown below:

Micro Services and gateway technology (SIA-GateWay)

4.2 micro gateway service-oriented business systems

Micro Services Gateway is a system in the application or service (provided REST API interface services) before the middleware system, SIA-GateWay in the initial stage of construction technology selection do take full account of the technical solution used should be compatible backend agency business system used technology stack and system technology, so we used the Netflix ZUUL as a gateway system technology stack, from the simple to use scenes to talk about how a certain kind of gateway powerful approach to the use of the follow-up will bring more business party Trouble.

More specifically say if the current technology stack, most of the business system uses JAVA system, it is not recommended to use Nginx, Kong or OpenResty and other gateway systems here primarily for software engineering aspects to consider.

For example, the business side needs to be a common mechanism Plugin components to be integrated into the micro-services gateway, if you use Lua script file or other scripting language, then introduce a new language technology stack brought about by the complexity of the business system will bring to more uncertainty, the latter system maintenance costs and operation and maintenance of the difficulty will exponentially increase.

4.3 component-based modular design

Micro gateway service is a very important role in the API may be polymeric microspheres and services, a unified service usage EntryPoint as a uniform entrance side, and a shield and hidden internal business logic. The following is a common component types and classification of SIA-GateWay provided.

Currently SIA-GateWay achieved five categories 8 sub-category of public service component by component management mechanism for the business side of use, routing component binding mechanism which allows the business side of providing flexibility to decide whether or not to implement the relevant components at runtime logic.

Micro Services and gateway technology (SIA-GateWay)

4.4 decentralized to the gateway architecture design

An important feature of the micro-architecture service architecture is to go to the center of the design ideas, SIA-GateWay adds a "gateway group" of abstraction in the software design level, a gateway group corresponds to a separate business area. The concept of the gateway group also fit some idea of ​​micro-service architecture: business systems rely on micro-services gateways provide clear and precise service boundary; business system of external exposure standard service interfaces through micro-business service gateway.

From the implementation level, SIA-GateWay full advantage combined with container automated deployment of technology in addressing the issue of the final kilometer, the gateway to the way the clouds container resources to deliver them to multiple parties, deployment package by sharing Gateway SDK way gateway service sink to the implementation and execution of the container, so did time and space flexibility and flexible delivery system. At the same time centralized management capabilities gave the user with different privileges gateway gateway node can be maintained while under their respective gateway group is made easier.

Micro Services and gateway technology (SIA-GateWay)

The figure shows that the center of the SIA-GateWay to the gateway architecture. Of course, in addition to micro-services gateway mode, the current next-generation micro-architecture ServiceMesh service technology is also typical decentralized architecture, ServiceMesh from SideCar sidecar model evolved, is a sink by way of business service management capabilities to the node, separating communication service implemented faster and easier, the intelligent control plane (control plane) and the plane data (data plane) of the decoupling process.

But now, technically and in practice the major companies, ServiceMesh there are many complex and not controllable in terms of landing, operation and maintenance of this model will bring great cost, if rashly use would this to bring more complexity and difficulty of complex distributed systems. The Gateway GateWay mode can be adjusted on organizational size, more simple and controllable way in the realization, is the micro-service architecture more suitable for the model adopted.

How to ensure high availability Gateway 4.5

As a micro-services gateway system, because all traffic through the gateway, the gateway must become a high-availability middleware services, the stability and availability of the gateway system directly determines the stability of the downstream services used. Therefore SIA-GateWay in architectural design made the following main points:

1) cluster

In a production environment, the use of a gateway node to ensure that there are at least two cluster nodes at the same time providing services, the SIA-GateWay mainly used container deployment within the company, to avoid a single point of failure.

2) health check

In the container environment, SIA-GateWay will expose a HTTP health check interface through health check mechanism Kubernetes, regular checks HTTP access is available, if not available, use service orchestration capabilities Kubernetes can do to switch the container; in Zstack environment start a Crontab by the state as a background daemon process checks to ensure the stability of the available mechanisms and processes to restart the gateway.

3) backup mechanism

SIA-GateWay gateway provides a backup mechanism in the Zstack will start a backup gateway API-GATEWAY-CORE, all gateway nodes start in a container environment (Kubernetes), the city will own routing information synchronization to a backup gateway.

Further, the use of high availability and Nginx health check mechanism, when the cluster Kubernetes problems, not all of the containers in response to the flow rate, the flow rate will be automatically switched to Nginx API-GATEWAY-CORE backup node. API-GATEWAY-CORE will trigger alert at work, suggesting that there are K8s gateway node is unavailable.

4.6 provides a mechanism rather than policy

Unix programming philosophy, an important concept is: "mentioned mechanism rather than policy," the popular talk "mechanism" is the interface, "strategy" is the concrete implementation. Component integration capabilities provided by SIA-GateWay is based on this concept.

SIA-GateWay scalability of the architecture as an important foreign output capacity, the main third-party plug-in mechanism to support dynamic loading mechanism JAVA language Filter components. Filter mechanism JAVA engineer is most familiar standard components, so for business Fang Jicheng own business logic provides a great convenience, third-party business components loaded into the gateway platform generally have the following steps:

  • According to the template class and comment SIA-GateWay provided, dynamic business logic.
  • We will achieve good dynamic components packaged by Maven.
  • In the component management interface, component by component upload button to upload Admin- Component Manager.
  • Component manager performs a logical file is stored.
  • Issued operation in performing component manager component, the distribution component to the corresponding gateway group.
  • ClassLoader gateway node by parsing component reflected and dynamically loaded into memory.
  • Gateway node in response to the loaded state by an asynchronous component semaphore mechanism.
  • Component Manager Plugin sync plug state.

The figure is a logic diagram of the implementation of SIA-GateWay loading mechanism components:

Micro Services and gateway technology (SIA-GateWay)

4.7 Visualization and strengthen micro-governance services

As the saying goes pipeline architecture, iron monitoring software to monitor any infrastructure needs. Micro-service application itself RPC interact brings the monitoring system to understand the system running problems. SIA-GateWay micro-service monitoring made the following main aspects enhancements:

1) global view of the cluster state and container state DashBoard statistics.

Micro Services and gateway technology (SIA-GateWay)

2) real-time gateway routing topology and topological relations and call status display. Real-time routing topology is as follows:

Micro Services and gateway technology (SIA-GateWay)

3) Gateway cluster topology management interface, includes real-time log, real-time monitoring Hystix, JVM configuration.

Micro Services and gateway technology (SIA-GateWay)

4) Management interface visual components.

Micro Services and gateway technology (SIA-GateWay)

5) Log back by EKK architecture for log imputation to log viewing.

Micro Services and gateway technology (SIA-GateWay)

6) Classification and wrong fuse management Stacktrace view.

Micro Services and gateway technology (SIA-GateWay)

7) URL fine-grained monitoring of statistical functions (default is not open, you need to bind the routing monitoring component), including the URL of the delay statistics, call counts and other indicators.

Micro Services and gateway technology (SIA-GateWay)

V. Summary

Software engineering is no silver bullet, the entire life cycle of the uncertainty and complexity of software systems through software engineering, it is to reduce the complexity of the system by a hierarchical decoupling micro-service architecture and nature, where communication organization, corporate culture team learning technology will have a major impact on the micro-services architecture floor.

Identification of core competence of business systems and business insight borders is an important part of the system micro Services Architecture landing; micro-services infrastructure technology selection should take into account the business technology system used by the system, choose a mature ecosystem and appropriate technology programs conducive to the promotion and ongoing technical evolution of the micro-service architecture; SIA-GATEWAY as micro-services infrastructure to fully take into account the maturity and ecological compatibility and related technology business systems.

Finally, in the micro-service architecture, service with the expansion of micro-scale, distributed transactions will inevitably bring about consistency, response networks, fault tolerance and so on, so the micro-management services is the difficulty of micro-services architecture to ensure high availability of micro Services Architecture and scalability needed to add more technical inputs and technical support at the infrastructure level, so as to allow business to better focus on business implementation, agile development, sustained and rapid service delivery.

SIA Related Links open source products

Author: Wangpei Hua

Guess you like

Origin blog.51cto.com/14159827/2428776