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

The key of ServiceMesh is how to understand the side car mode.

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

The main content of this article is to explain "how to understand the side car mode of ServiceMesh". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to understand the side car mode is the key to ServiceMesh".

Upgrade step by step

Note: the following are all side cars, but some of them are really crude.

As we all know, micro-services are complex and introduce a series of problems, and service governance is particularly important. Such as log collection, service monitoring, service governance and so on.

For example, in the figure above, we deployed four processes on a Linux server. Among them, the web service is the main process, and the other processes are only deployed as additional functions.

In fact, these three circles are the function of the side car. As long as it is mounted, the above service will have these functions.

However, the configuration of these three components is quite complex. We need a lot of repetitive work.

The figure above further enhances immutability by packaging the Web application with our auxiliary application. With the blessing of the container, we can rely on conventions to simplify packaging and distribution operations. For example, the above components can communicate directly through localhost.

Unfortunately, our auxiliary programs are started as processes in the docker container. This rich container model has many defects and does not conform to the concept of immutable infrastructure, so it is not recommended.

The Pod of K8s is further abstracted based on the container. A Pod can contain multiple containers. As shown in the figure below, basic services and Web services can be built separately, and finally, with Pod as the carrier, you can hitchhike.

To see this process more prominently, the following diagram takes log collection as an example and introduces the topology diagram of two pod, the same log collection docker container.

We can see from the above evolution. The side car is just an auxiliary or basic program. But how to easily manage these additional procedures, we have different ways of organization. Only with a high level of abstraction can we carry out convenient assembly and design.

At this point, we can take a look at the two classic pictures of ServiceMesh.

We abstract Web applications (business services) into green squares. Then the auxiliary components (sidecar) are abstracted into blue squares. In a relatively simple environment, our deployment is as follows.

Since auxiliary components cannot exist alone, they are all attached to green services.

If we pull the flesh and blood of the service cluster (Web service) and leave only its sidecar, we can get the following picture, which is ServiceMesh. We can see that the connection lines inside are very complex and cannot be completed manually, so we can only rely on the platform to manage them.

As long as anything goes up in scale, it reflects its complexity. This is just a topology diagram with only 36 service nodes.

Don't underestimate this little blue square. It can be not only an auxiliary program, but also an infrastructure. Now the typical service mesh is divided into `data plane 'and `control plane'. Most enterprises that land on the ground use proxy to implement the data plane, but the implementation of the control plane is limited.

Like the popular Istio, through load balancing, inter-service authentication, monitoring and other methods, it can easily create a network where the service has been deployed, while the code of the service needs little or no change. Add Istio support to services by deploying a special sidecar agent throughout the environment, while the agent intercepts all network traffic between microservices, and then uses its control plane capabilities to configure and manage Istio.

Let's take a look at its official functional description:

Automatic load balancing for HTTP, gRPC, WebSocket, and TCP traffic.

Fine-grained control of traffic behavior through rich routing rules, retry, failover, and fault injection.

Pluggable policy layer and configuration API to support access control, rate limiting, and quotas.

Automated measurement, logging, and tracking of all traffic within the cluster (including ingress and egress of the cluster).

Secure communication between services in a cluster with strong authentication and authorization.

It can be said that ServiceMesh has stripped off the business attributes, leaving only a large network, covering all the work of operation and peacekeeping basic services.

It cannot be said to be cost-free to use it. There are two more important points:

Network packets pass through layers of proxy and forwarding (Ambassador mode), which makes it less efficient and more difficult to troubleshoot.

The grid needs to be modified according to the specification, that is, to write a bunch of adapters (Adapter pattern).

Sidecar of SpringCloud

When it comes to adapters, I can't help thinking of SpringCloud's Sidecar.

When it comes to playing with new concepts in Java, how can there be less Spring family? SpringCloud also has a component of sidecar, and its maven coordinates are as follows.

Org.springframework.cloud spring-cloud-netflix-sidecar

What it does is more like an adapter. It can disguise a normal php or nodejs service as a normal SpringCloud service.

Through simple configuration, we can add some Web applications developed in other languages to the SpringCloud system.

It is relatively simple to use and will not be introduced too much here.

At this point, I believe you have a deeper understanding of "the key to ServiceMesh how to understand the side car mode". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report