CN114185691A - Sidecar-based UDP multicast method and system - Google Patents
Sidecar-based UDP multicast method and system Download PDFInfo
- Publication number
- CN114185691A CN114185691A CN202111552119.6A CN202111552119A CN114185691A CN 114185691 A CN114185691 A CN 114185691A CN 202111552119 A CN202111552119 A CN 202111552119A CN 114185691 A CN114185691 A CN 114185691A
- Authority
- CN
- China
- Prior art keywords
- sidecar
- container group
- lock
- shared lock
- sharing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/542—Event management; Broadcasting; Multicasting; Notifications
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a UDP multicast method and a system based on Sidecar, wherein the method comprises the following steps: deploying a Sidecar process in a container group of a service instance, wherein the Sidecar process and the container group share network resources; the Sidecar process participates in the election sharing lock; judging whether the Sidecar process obtains a sharing lock; if yes, deploying the container group of the Sidecar process as a main container group, and releasing the outlet flow of the main container group based on UDP multicast; if not, the container group of the Sidecar process is deployed as the container group, and the outlet flow of the container group is intercepted. The main container group which acquires the sharing lock is transmitted to other services or instances through UDP broadcast outlet flow, and meanwhile, the information synchronization of multiple instances of the same service is realized; a container group without a sharing lock is used as a redundant example, only UDP broadcast information is received, and the flow of an outlet is not transmitted; by means of deploying the Sidecar process, migration and transformation of the original service application are achieved under the condition that the original service code is changed slightly.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a UDP multicast method and a system based on Sidecar.
Background
With the development of cloud technology, the migration of business applications to cloud platforms becomes an irreversible trend. However, the environment of the cloud platform is different from that of the original service application, and the service application is often required to be modified or redeveloped, so that the migration cost is high. Users expect that the service application can be completed in the cloud in the migration process with little or even no change to the original service code. The current application has a plurality of services, a cache is arranged in the services, and the result of the cache is calculated by an upstream service; in order to ensure high availability and reliability of a single service, multiple instances are generally deployed in one service, cache coherence is realized among the instances, and when one instance fails, another instance of the service is switched to for a certain period of time so as to support the whole application. High availability is achieved.
Taking UDP multicast communication as an example, only the instance providing the service performs communication (read-write operation), and other instances maintain data synchronization with the instance. At present, the communication and memory sharing between the instances are generally realized, but the method increases the cost and complexity of application capacity expansion.
Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides a method and a system for UDP multicast based on Sidecr, which modify the network flow rule through the injected Sidecr process, ensure that only one instance provides service to the outside and simultaneously keep the information synchronization between the instances.
The invention discloses a UDP multicast method based on Sidecar, which comprises the following steps: deploying a Sidecar process in a container group of a service instance, wherein the Sidecar process and the container group share network resources; the Sidecar process participates in the election sharing lock; judging whether the Sidecar process obtains a sharing lock; if yes, deploying the container group of the Sidecar process as a main container group, and releasing the outlet flow of the main container group based on UDP multicast; if not, the container group of the Sidecar process is deployed as the container group, and the outlet flow of the container group is intercepted.
Preferably, the service includes a plurality of container groups, and the plurality of container groups perform information synchronization through UDP; the shared lock is a distributed shared lock based on the Etcd.
Preferably, the shared lock renewal lease method comprises the following steps:
the method comprises the steps that a Sidecar process of a shared lock is obtained, and lease renewal is carried out on the shared lock within lease time of the shared lock;
the Sidecar process, which did not acquire the shared lock, again attempts to acquire the shared lock after a retry time.
Preferably, the lease time of the shared lock is 1/3-1/2 of fault tolerance time, and the lease renewal time is 1/4-1/2 of fault tolerance time;
wherein the expected maximum failure time is lease duration + retry time.
Preferably, the method for processing the failure of the main container group comprises the following steps:
judging whether the current sharing lock is expired;
if yes, the slave container group participates in the election sharing lock;
and obtaining a slave container group of the sharing lock as a master container group, modifying a network flow rule, and releasing the outlet flow based on UDP multicast.
Preferably, the failed master container group or the slave container group is restarted, and the restarted master container group loses the shared lock as the slave container group.
Preferably, the method for monitoring the sidecar process comprises the following steps:
monitoring the sidecar process or the container group through a dial test probe;
judging whether the sidecar process or the container runs normally or is healthy;
if not, restarting the container group or sidecar process.
The invention also provides a system for realizing the UDP multicast method, which comprises an injection module and a sharing lock management module;
the injection module is used for injecting the Sidecar process into the container group of the service instance;
the sharing lock management module is used for distributing a sharing lock for the sidecar processes participating in the election;
the Sidecar process is used for modifying a network flow rule and releasing the exit flow based on UDP multicast when a sharing lock is obtained; and when the sharing lock is not obtained, modifying the network traffic rule and intercepting the outlet traffic.
Preferably, the system further comprises a monitoring module, the monitoring module is used for monitoring the health state of the container group through the dial-up probe, and the dial-up probe comprises a survival probe and a ready probe.
Preferably, the main container group renews renting within the validity period of the shared lock;
the slave bank attempting to acquire a shared lock after a retry time;
and the shared lock management module is used for renewing the lease of the shared lock and reallocating the shared lock after the lease period of the shared lock is over.
Compared with the prior art, the invention has the beneficial effects that: the main container group which acquires the sharing lock is transmitted to other services or instances through UDP broadcast outlet flow, and meanwhile, the information synchronization of multiple instances of the same service is realized; a container group without a sharing lock is used as a redundant example, only UDP broadcast information is received, and the flow of an outlet is not transmitted; by means of deploying the Sidecar process, migration and transformation of the original service application are achieved under the condition that the original service code is changed slightly.
Drawings
FIG. 1 is a flow chart of the method for multicast over UDP based on Sidecar according to the present invention;
FIG. 2 is a schematic view of inter-service UDP multicast according to the present invention;
FIG. 3 is a logical block diagram of the system of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
The invention is described in further detail below with reference to the attached drawing figures:
a UDP multicast method based on sidecar, as shown in fig. 1, the method comprising:
step 101: in a container group of a service instance, a Sidecar process is deployed, the Sidecar process sharing network resources with the container group.
The Sidecar process may be deployed simultaneously with the group of containers or may be deployed by injection. Manual and automatic ways of injecting the Sidecar are provided in the isti and will not be described in detail in this application. The Sidecar process is a separate process running alongside an application instance, and may add many functions to the application without adding additional third party components to the application or modifying the code or configuration of the application. Wherein the group of containers may operate in kubernets. The shared network resource includes a network stack.
Step 102: the Sidecar process participates in the election sharing lock. Wherein, the sharing lock is a distributed sharing lock based on the Etcd.
Step 103: and judging whether the Sidecar process acquires a sharing lock.
If yes, go to step 104: and deploying the container group of the Sidecar process as a main container group, and releasing the outlet flow of the main container group based on UDP multicast. This may be achieved by the Sidecar process modifying the network traffic rules (iptables).
If not, go to step 105: and deploying the container group of the Sidecar process as a container group, and intercepting the outlet traffic of the container group based on UDP multicast.
As shown in fig. 2, the master container group that obtains the shared lock broadcasts egress traffic via UDP to other services or instances, such as services B and C, while achieving information synchronization with multiple instances within the service; and the container group without the shared lock is used as a redundant example, only receives UDP broadcast information, and does not transmit the outlet flow. By means of deploying the Sidecar process, migration and transformation of the original service application are achieved under the condition that the original service code is changed slightly. In FIG. 2, the darkened sidecar indicates acquisition of a shared lock.
The sdesich process of the main container group renews the lease on the shared lock within the lease time of the shared lock; the sidecar process for the bank of containers, after a retry time (RetryPeriod), again attempts to acquire a shared lock.
In one embodiment, the shared lock lease (LeaseDuration) is 1/3 to 1/2 of the fault tolerance time, and the lease renewal (renewdedine) is 1/4 to 1/2 of the fault tolerance time, so as to prevent the influence on the service when the main container group fails. In the case of neglecting the time consumption of the shared lock acquisition process, the expected maximum failure time is the lease duration + retry time.
The main container group failure processing process is as follows:
step 201: it is determined whether the current share lock is expired. When the main container fails, the shared lock cannot be continued, and the shared lock fails after the main container is expired.
If yes, go to step 202: the slave container group participates in the election sharing lock.
Step 203: and obtaining a slave container group of the sharing lock as a master container group, modifying a network flow rule, and releasing the outlet flow based on UDP multicast.
If not, waiting for the lease period of the sharing lock to expire.
Restarting the failed master container or slave container, wherein the shared lock is lost as a group of containers after the master group of containers is restarted.
Wherein, can detect the container group trouble through the mode of listening:
step 301: and monitoring the Sidecar process or the container group through a dial-up probe. The dial-up probes include a survival probe (livenessProbe) and a ready probe (readesseprobe).
Step 302: and judging whether the Sidecar process or the container runs normally or is healthy.
If not, go to step 303: restart the bank of containers or sidecar process.
If yes, the monitoring is continued. And the influence of the death of the sidecar process on the service application is avoided by monitoring the dial-up probe.
The present invention also provides a system for implementing the UDP multicast method, as shown in fig. 3, including an injection module 1 and a shared lock management module 2,
the injection module 1 is used for injecting the Sidecar process in the container group of the service instance;
the shared lock management module 2 is used for distributing a shared lock for Sidecar processes participating in the election;
the Sidecar process is used for modifying a network flow rule and releasing the exit flow based on UDP multicast when a sharing lock is obtained; and when the sharing lock is not obtained, modifying the network traffic rule and intercepting the outlet traffic.
The system of the invention also comprises a monitoring module 3 which is used for monitoring the health state of the container group through the dial-up probes, wherein the dial-up probes comprise survival probes and ready probes.
The main container group renews renting within the validity period of the shared lock;
the slave bank attempting to acquire a shared lock after a retry time;
and the shared lock management module 2 is used for renewing the lease of the shared lock and reallocating the shared lock after the lease period of the shared lock is over.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A sdudp multicast method based on Sidecar, the method comprising:
deploying a Sidecar process in a container group of a service instance, wherein the Sidecar process and the container group share network resources;
the Sidecar process participates in the election sharing lock;
judging whether the Sidecar process obtains a sharing lock;
if yes, deploying the container group of the Sidecar process as a main container group, and releasing the outlet flow of the main container group based on UDP multicast;
if not, the container group of the Sidecar process is deployed as the container group, and the outlet flow of the container group is intercepted.
2. The UDP multicast method according to claim 1, wherein the service includes a plurality of container groups, and the plurality of container groups perform information synchronization through UDP;
the shared lock is a distributed shared lock based on the Etcd.
3. The UDP multicast method according to claim 1, further comprising a method of sharing a lock renewal lease:
the method comprises the steps that a Sidecar process of a shared lock is obtained, and lease renewal is carried out on the shared lock within lease time of the shared lock;
the Sidecar process, which did not acquire the shared lock, again attempts to acquire the shared lock after a retry time.
4. The UDP multicast method according to claim 3, wherein the shared lock lease is 1/3 to 1/2 of fault tolerance time, and the lease renewal time is 1/4 to 1/2 of fault tolerance time;
wherein the expected maximum failure time is lease duration + retry time.
5. The UDP multicast method according to claim 3, further comprising a method of handling a failure of the main container group:
judging whether the current sharing lock is expired;
if yes, the slave container group participates in the election sharing lock;
and obtaining a slave container group of the sharing lock as a master container group, modifying a network flow rule, and releasing the outlet flow based on UDP multicast.
6. The UDP multicast method according to claim 5, wherein the failed master or slave group is restarted, and the restarted master group loses the shared lock as the slave group.
7. The UDP multicast method according to claim 3, further comprising a method of listening to a sidecar process:
monitoring the sidecar process or the container group through a dial test probe;
judging whether the sidecar process or the container runs normally or is healthy;
if not, restarting the container group or sidecar process.
8. A system for implementing the UDP multicast method according to any one of claims 1 to 7, comprising an injection module and a shared lock management module;
the injection module is used for injecting the Sidecar process into the container group of the service instance;
the sharing lock management module is used for distributing a sharing lock for the sidecar processes participating in the election;
the Sidecar process is used for modifying a network flow rule and releasing the exit flow based on UDP multicast when a sharing lock is obtained; and when the sharing lock is not obtained, modifying the network traffic rule and intercepting the outlet traffic.
9. The system of claim 8, further comprising a monitoring module configured to monitor a health status of the group of containers via a dial-up probe, the dial-up probe including a survival probe and a ready probe.
10. The system of claim 8, wherein the master group of containers renews renting within a shared lock validity period;
the slave bank attempting to acquire a shared lock after a retry time;
and the shared lock management module is used for renewing the lease of the shared lock and reallocating the shared lock after the lease period of the shared lock is over.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111552119.6A CN114185691A (en) | 2021-12-17 | 2021-12-17 | Sidecar-based UDP multicast method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111552119.6A CN114185691A (en) | 2021-12-17 | 2021-12-17 | Sidecar-based UDP multicast method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114185691A true CN114185691A (en) | 2022-03-15 |
Family
ID=80605497
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111552119.6A Pending CN114185691A (en) | 2021-12-17 | 2021-12-17 | Sidecar-based UDP multicast method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114185691A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114826906A (en) * | 2022-04-13 | 2022-07-29 | 北京奇艺世纪科技有限公司 | Flow control method and device, electronic equipment and storage medium |
-
2021
- 2021-12-17 CN CN202111552119.6A patent/CN114185691A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114826906A (en) * | 2022-04-13 | 2022-07-29 | 北京奇艺世纪科技有限公司 | Flow control method and device, electronic equipment and storage medium |
CN114826906B (en) * | 2022-04-13 | 2023-09-22 | 北京奇艺世纪科技有限公司 | Flow control method, device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107295080B (en) | Data storage method applied to distributed server cluster and server | |
EP3210367B1 (en) | System and method for disaster recovery of cloud applications | |
KR102024694B1 (en) | Decentralized service platform using multiple service nodes based on block chain | |
KR20010072379A (en) | Fault tolerant computer system | |
CN112955874A (en) | System and method for self-healing in decentralized model building using machine learning of blockchains | |
CN112558997A (en) | Method and device for deploying applications | |
CN110990200A (en) | Flow switching method and device based on multi-activity data center | |
CN108418859B (en) | Method and device for writing data | |
CN108600284B (en) | Ceph-based virtual machine high-availability implementation method and system | |
CN111147274A (en) | System and method for creating a highly available arbitration set for a cluster solution | |
CN114185558A (en) | Native application master selection method and device based on K8s and storage medium | |
CN114185691A (en) | Sidecar-based UDP multicast method and system | |
CN104753987A (en) | Distributed session management method and system | |
WO1997049034A1 (en) | Job taking-over system | |
CN111241200B (en) | Master-slave synchronous processing method and device based on SQLite database | |
CN108241616B (en) | Message pushing method and device | |
CN112052127A (en) | Data synchronization method and device for dual-computer hot standby environment | |
CN111338848B (en) | Failure application copy processing method and device, computer equipment and storage medium | |
CN110502460B (en) | Data processing method and node | |
CN114915545B (en) | Application scheduling deployment management method based on DHCP network cluster | |
CN103546569A (en) | Service processing method based on strategy sharing, nodes and system | |
CN116827966B (en) | Data processing method and system | |
CN110991676B (en) | Operation and maintenance management platform based on modularized design | |
CN115643237B (en) | Data processing system for conference | |
CN115134220B (en) | Master-slave server switching method and device, computing equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |