Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Micro Services and Gateway Technology (SIA-GateWay)

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

I. Background

Software architecture is always evolving...

Back twenty years ago, the C/S model was mainly respected in enterprise R & D, and development software such as PB and Delphi was the mainstream of enterprise application development. Over time, browser-based B/S architectures have become popular. At the beginning, ASP also occupied a lot of advantages in Web development, but the pre-compiled mode of JSP greatly improved performance, and then J2EE architecture based on JAVA language became more and more popular.

Early software architectures were basically monolithic, and systems often did not need to interact, which also led to the development of data silos and ETL tools. With more and more enterprise applications, the relationship between each other is closer, and real-time interactive access between applications is urgently needed. Subsequently, XML-based heterogeneous system integration and data interaction technologies are adopted by many companies, the concept of SOA is proposed, and web service is gradually popular.

In the Internet era, in order to adapt to more flexible business requirements, many companies based on HTTP protocol and Restful architecture style and concise and clear structure of JSON language become the best practice of enterprise development, in SOA architecture, enterprise service bus technology ESB exposed by the disadvantages of centralized architecture let developers understand that based on registration and discovery of distributed architecture is the key solution to the problem. As a result, microservices architecture began to prevail.

How to define a microservice in Microservice Design is to use the loose coupling & high cohesion principle to group things that change due to the same factors and separate things that change due to different factors.

II. Microservice architecture characteristics

Microservices is actually an architectural style...

2.1 heterogeneous

Different services have different best fit technologies, and microservices can help us easily adopt different technologies and understand the benefits of these new technologies. There are risks associated with trying new technologies, but for microservices systems, there are always places where you can choose the least risky service to adopt the new technology and reduce the risk.

2.2 isolation

Microservice architecture decomposes the system into independent operation units, which brings better isolation to the system. Independent microservices are easier to locate and isolate problems when exceptions occur. Isolation is also the basis of service scalability.

2.3 extended

A large monolithic service can only be scaled as a whole, and even if only a small part of the system has performance problems, the entire system needs to be scaled. Microservices architecture can scale horizontally to different modules according to performance needs, and the elasticity of microservices can also handle service unavailability and functional degradation well.

2.4 simple deployment

In a microservices architecture, individual services are deployed independently so that specific sections of code can be deployed faster. Service problems are also easier to roll back quickly, while agile delivery and deployment lead to a better business requirements response experience.

2.5 flexible

In a microservices architecture, the system opens up many interfaces for external use, and applications can be built in different ways when circumstances change. Holistic applications can only provide a very coarse-grained interface for external consumption. Decomposing a single application into multiple microservices can achieve the purpose of multiplexing and compositing.

Microservices and Gateway Technology

The following diagram shows a typical microservice architecture for reference only.

3.1 What is Microservices Gateway?

A microservices gateway is a key role in the microservices architecture to protect, enhance, and control access to microservices. A microservices gateway is a system in front of an application or service to manage authorization, access control, and traffic restrictions, so that microservices are protected by the microservices gateway and transparent to all callers. As a result, business systems hidden behind microservices gateways can focus more on the business itself.

3.2 Classification of Microservices Gateways

Common microservice gateways are roughly divided into traffic gateways and service gateways according to their usage characteristics. The two gateways have different concerns. The following figure summarizes the characteristics of the two gateway types:

3.3 The role of microservices gateway

As a middleware system connecting service consumers and service providers, the microservice gateway naturally isolates the evolution and development of their respective business systems, making the business systems more focused on the business services themselves. Meanwhile, the microservice gateway can also provide and precipitate more additional functions for services. The main functions of the microservice gateway are as follows:

SIA-GateWay

SIA-GATEWAY is a distributed microservices gateway system developed under the SpringCloud microservices ecosystem. Features such as simplicity, visualization, high scalability, and high availability provide cloud-native, complete, and mature access service solutions.

4.1 Key features are simple to use and support rapid deployment and delivery of Docker container-based solutions. Good compatibility, compatible with SpringBoot microservices and traditional HTTP-URL Load Balancer and routing services. High extensibility, support for Java language-based third-party plug-in extension features and dynamic loading mechanism. Support multi-tenant, multi-user role gateway split management. Visual management, providing real-time route topology and gateway cluster topology display function. Service governance, support gateway cluster Dashboard, real-time log, historical log query, fuse management, early warning management and other functions. Multi-registry support, providing handover management function for multi-registry cluster under distributed gateway cluster. Dynamic routing component binding mechanism provides common service components including URL statistics, logs, gray publishing, current limiting, security, etc.

The following figure is the overall architecture diagram of SIA-GATEWAY. The architecture consists of CORE and Admin Cluster, where:

CORE is the main service node that carries HTTP requests from gateways. CORE nodes can automatically register with Admin according to the gateway group information to which they belong. Admin is the management background of gateway cluster, composed of Admin, Service, Stream, Monitor and other services.

The overall deployment architecture of the gateway is shown in the following figure:

4.2 Microservice Gateway for Business System

A microservices gateway system is a system that is part of an application or service (Providing REST API interface services) Before the middleware system, SIA-GateWay fully considered that the technology solution used should be compatible with the technology stack and technology system used by the backend proxy service system at the initial stage of construction. Therefore, we used Netflix's ZUUL as the gateway system technology stack. We simply talked about how powerful a certain gateway function is from the use scenario. Follow-up will bring more trouble to the use of business parties.

More specifically, if the technology stack used by most business systems is JAVA system, it is not recommended to use gateway systems such as Nginx, Kong or OpenResty, which is mainly due to software engineering considerations.

For example, the business side needs to integrate a common component into the microservice gateway through the Plugin mechanism. If Lua script files or other scripting languages are used, the complexity brought by introducing a new language technology stack will bring more uncertainty to the business system, and the maintenance cost and operation difficulty of the system will increase exponentially.

4.3 Modular design based on components

A very important role of the microservice gateway is to aggregate the APIs of microservices, provide a unified EntryPoint as a unified entry for business consumers, and shield and hide the internal logic of the business. The following are the common component types and categories provided by SIA-GateWay.

At present, SIA-GateWay implements common service components of 5 major categories and 8 sub-categories through component management mechanism for service parties to use. The routing component binding mechanism provided allows service parties to flexibly decide whether to execute related component logic at runtime.

4.4 Decentralized Gateway Architecture Design

An important feature of microservice architecture is decentralized architecture design thinking. SIA-GateWay adds an abstract concept of "gateway group" at the software design level, and one gateway group corresponds to an independent business domain. The concept of gateway group also fits into some concepts in microservice architecture: business systems rely on microservice gateways to provide clear service boundaries; business systems expose standard service interfaces of services to the outside world through microservice gateways.

From the implementation level, SIA-GateWay makes full use of and combines the deployment technology of container automation. In solving the last kilometer problem, the gateway is delivered to different business parties in the form of cloud container resources, and the gateway services are sunk into the container for implementation and execution by sharing the gateway SDK deployment package, thus achieving the flexibility and flexible delivery of the system in time and space. At the same time, the centralized management capability brings convenience for users with different permissions to maintain gateway nodes under their respective gateway groups at the same time.

The figure above shows the SIA-GateWay decentralized gateway architecture. Of course, in addition to the micro-service gateway mode, the current next-generation micro-service architecture ServiceMesh technology is also a typical decentralized architecture. ServiceMesh is evolved from the SideCar mode. It is a way to sink service governance capabilities to service nodes. Through the decoupling of control plane and data plane, service communication is faster, more convenient and intelligent.

However, at present, from the technical point of view and the practice of major companies, ServiceMesh still has a lot of complexity and uncontrollability in terms of landing. This mode will bring great cost to operation and maintenance, and if it is used rashly, it will bring more complexity and difficulty to the already complex distributed system. The GateWay gateway mode can be adjusted in terms of organization granularity, and is simpler and more controllable in implementation mode. It is a more suitable mode in the current microservice architecture.

4.5 How does the gateway guarantee high availability

As a microservice gateway system, because all traffic will pass through the gateway, the gateway must become a highly available middleware service. The stability and availability of the gateway system directly determine the stability of the downstream services used. Therefore, SIA-GateWay has mainly done the following points in the architecture design:

1) Clustering

In the production environment, at least two gateway nodes are guaranteed to form a cluster and provide services at the same time. Currently, SIA-GateWay mainly uses containerized deployment within the company to avoid single point of failure.

2) Health check

In the container environment, SIA-GateWay exposes an HTTP health check interface, which regularly checks whether HTTP access is available through Kubernetes 'health check mechanism. If it is unavailable, Kubernetes' service orchestration capability can be used to switch containers. In the Zstack environment, a Crontab is started in the background as a daemon process to check the status of the process, ensuring the stable availability of the gateway and the process restart mechanism.

3) Backup mechanism

SIA-GateWay provides a backup gateway mechanism. A backup gateway API-GATEWAY-CORE will be started on Zstack. All gateway nodes started in Kubernetes will synchronize their routing information to the backup gateway.

In addition, using Nginx's high availability and health check mechanism, when Kubernetes cluster has problems and all container traffic cannot respond, the traffic on Nginx will be automatically switched to API-GATEWAY-CORE backup node. API-GATEWAY-CORE will also trigger an alert when working, indicating that there is currently an unavailable K8s gateway node.

4.6 Provide mechanisms rather than strategies

In Unix programming philosophy, an important concept is: "mention mechanism rather than policy", colloquially speaking,"mechanism" is the interface,"policy" is the concrete implementation. The component integration capabilities offered by SIA-GateWay are based on this philosophy.

SIA-GateWay regards the extensibility of architecture as an important external output capability, and the third-party plug-in mechanism mainly supports the dynamic loading mechanism of Filter component of JAVA language. Filter mechanism is a standard component that JAVA engineers are most familiar with, so it provides great convenience for business parties to integrate their own business logic. There are several steps for loading third-party business components into the gateway platform:

According to template class and annotation provided by SIA-GateWay, realize dynamic service logic. Package the implemented dynamic components through Maven. In the Component Management interface, upload the component to Admin-Component Manager via the Component Upload button. Component Manager performs file storage logic. The component manager executes the component delivery operation to distribute the component to the corresponding gateway group. Gateway nodes reflect parsing components through ClassLoader and load them dynamically into memory. Gateway nodes respond to component loading states through asynchronous semaphore mechanisms. Component Manager synchronizes Plugin status.

The following figure is the execution logic diagram of the SIA-GateWay component loading mechanism:

4.7 Strengthen visualization and microservice governance capabilities

As the saying goes, the structure of the flow, the monitoring of iron, any structure needs software monitoring. The RPC interaction mode of microservice application itself brings difficulties to the monitoring system to understand the running state of the system. SIA-GateWay mainly enhances microservice monitoring in the following aspects:

1) Global cluster status view and container status DashBoard statistics.

2) Real-time routing topology and gateway topology invocation relationship and status display. The real-time routing topology diagram is as follows:

3) Gateway cluster topology management interface, including real-time logs, real-time Hystix monitoring, JVM configuration, etc.

4) Visual component management interface.

5) Log backtracking, using EKK architecture to achieve log collection to log viewing function.

6) Classification and error Stacktrace view of fuse management.

7) Fine-grained monitoring statistics function of URL (not enabled by default, route binding monitoring component is required), including URL delay statistics, call count and other indicators.

V. Summary

There is no silver bullet in software engineering. The uncertainty and complexity of software system run through the whole life cycle of software engineering. Microservice architecture essentially reduces the complexity of system through layering and decoupling. Here, the communication mode of organization, enterprise culture and team technology learning ability will have an important impact on the landing of microservice architecture.

Insight into core capabilities of business systems and identification of business boundaries are important links in the implementation of system microservice architecture; technology selection of microservice infrastructure should take into account the technology system used by business systems, and selecting mature ecosystems and appropriate technical solutions is conducive to the promotion of microservice architecture and continuous technology evolution;SIA-GATEWAY as microservice infrastructure fully considers compatibility with business systems and maturity of related technology ecosystems.

Finally, under the microservice architecture, with the expansion of microservice scale, it will inevitably bring distributed transaction consistency, network response, fault tolerance and other problems, so microservice governance is the difficulty of microservice architecture. To ensure the high availability and high scalability of microservice architecture, more technical investment and technical support need to be added at the infrastructure level, so that the business can better focus on business realization, agile development, and sustained and rapid service delivery.

SIA related open source product links Microservices Task Scheduling Framework: https://github.com/siaorg/sia-task Microservices Routing Gateway

: https://github.com/siaorg/sia-gatewayRabbitmq Queue Service PLUS: https://github.com/siaorg/sia-rabbitmq-plus

Author: Wang Peihua

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report