A SIP dynamic load balancing method, system, device and storage medium

By monitoring and updating microservice information in mariadb database, Opensips is dynamically triggered to update load balancing routes, solving the problem that traditional SIP load balancing cannot update routes in real time in cloud-native environments, and improving system reliability and adaptability.

CN115714778BActive Publication Date: 2024-11-15CHINA TELECOM DIGITAL INTELLIGENCE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211220660.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-08
Publication Date
2024-11-15
Estimated Expiration
2042-10-08

AI Technical Summary

Technical Problem

Traditional SIP load balancing cannot update routes dynamically in real time in the cloud native environment, resulting in microservice errors or capacity expansion and shrinking, resulting in link failure and manual modification delays and errors.

Method used

By reading Opensips' IP address and mariadb service name, obtaining password to connect to the database, starting kubernetes controller to monitor endpoints changes, matching and updating workQueue tasks, resolving update types, sending HTTP messages to trigger Opensips to update load balancing routes, dynamically adapting to microservice expansion and shrinking Allow.

Benefits of technology

It realizes dynamic load balancing routing awareness of Opensips microservices in cloud-native environments, reduces manual operations, and improves system reliability and adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115714778B_ABST
    Figure CN115714778B_ABST
Patent Text Reader

Abstract

The present invention provides a SIP dynamic load balancing method, system, device and storage medium, wherein the method includes reading the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored; obtaining the password of mariadb; connecting to the mariadb database according to the password of mariadb; starting the kubernetescontroller monitoring service to monitor the changes of all endpoints; if any endpoint change is monitored, matching the changed endpoint with the microservice name in the configuration; obtaining the endpoint pointer of the successfully matched microservice and appending it to the end of the workQueue work queue; parsing the microservice endpoint information in the task of the workQueue. The present invention can enable the Opensips microservice in the cloud native environment to perceive the changes of the load balancing route in a timely and dynamic manner without manual operation; at the same time, the present invention dynamically adapts to the expansion and contraction of the SIP microservice, thereby improving the reliability and adaptability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of communication technology, and in particular relates to a SIP dynamic load balancing method, system, device and storage medium. Background Art

[0002] SIP (Session Initiation Protocol) is a text-based application layer signaling control protocol for multi-party multimedia communications. SIP is independent of the underlying transport protocol and is used to establish, modify, and terminate two-party or multi-party multimedia sessions on an IP network. It is a signaling protocol for implementing real-time communication applications in an IP-based network. There are two types of SIP messages: client-to-server requests and server-to-client responses.

[0003] In the client-to-server request, when the mobile phone sends a message, the SIP load balancing service Opensips receives the message through the SIP access module and other modules, and distributes different message types and load balancing to the corresponding service modules for processing. Traditional Opensips provides load balancing capabilities for microservices based on routing scripts, but in a cloud-native environment, the signaling layer message receiving microservice needs to follow the 12-factors methodology and use the stateless type deployment of Deployment. It is not feasible to rely on unchanging routing scripts. There are two main reasons: 1. After an error occurs in the microservice or it is manually restarted, the IP and pod name in the microservice k8s cluster change. Failure to manually update the Opensips routing script in time will cause link failure; 2. When the microservice is expanded or reduced in capacity, it needs to be modified manually, and manual modification has delay problems and the possibility of errors. Therefore, it is urgent to solve the problem that traditional sip load balancing cannot dynamically update routing in real time in a cloud-native environment. Summary of the invention

[0004] The present invention aims at the deficiencies in the prior art and provides a SIP dynamic load balancing method, system, device and storage medium.

[0005] In a first aspect, the present invention provides a SIP dynamic load balancing method, comprising:

[0006] Read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored;

[0007] Get the password of mariadb;

[0008] Connect to the mariadb database according to the mariadb password;

[0009] Start the kubernetes controller monitoring service to monitor changes in all endpoints;

[0010] If any endpoint changes are detected, the changed endpoint is matched with the microservice name in the configuration;

[0011] Get the endpoint pointer of the successfully matched microservice and append it to the end of the workQueue work queue;

[0012] Parse the microservice endpoint information in the workQueue task.

[0013] Furthermore, before starting the kubernetes controller monitoring service to monitor changes of all endpoints, the kubernetes controller module is initialized.

[0014] Furthermore, the microservice endpoint information in the task of parsing the workQueue includes:

[0015] Determine the type of current update;

[0016] If the current update type is to add or update an endpoint, the IP information of the newly added or updated endpoint is updated and the status is enable;

[0017] If the newly added or updated endpoint does not have updated IP information, or the status is not enabled, continue to process the next task;

[0018] If the current update type is to delete the endpoint, connect to the MariaDB database and delete the routing information of the corresponding microservice;

[0019] Add new entries in the mariadb database and record the IP and port information of the endpoint;

[0020] Send HTTP messages to trigger Opensips to update the load balancing route;

[0021] If the current update type is another unsupported type, proceed to the next task.

[0022] Furthermore, if the current update type is to add or update an endpoint, the IP information of the newly added or updated endpoint is updated, and the state is enable, including:

[0023] Connect to the mariadb database and delete the routing information of the corresponding microservice;

[0024] In the mariadb database, add a new entry and record the IP and port information of the endpoint;

[0025] Send HTTP messages to trigger Opensips to update load balancing routing information.

[0026] In a second aspect, the present invention provides a SIP dynamic load balancing system, comprising:

[0027] The reading module is used to read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored;

[0028] The first acquisition module is used to obtain the password of mariadb;

[0029] The connection module is used to connect to the mariadb database according to the mariadb password;

[0030] The monitoring startup module is used to start the Kubernetes controller monitoring service to monitor changes in all endpoints.

[0031] The name matching module is used to match the changed endpoint with the microservice name in the configuration when the monitoring startup module detects any changes in the endpoint;

[0032] The second acquisition module is used to obtain the endpoint pointer of the successfully matched microservice and append it to the end of the workQueue work queue;

[0033] The parsing module is used to parse the microservice endpoint information in the workQueue task.

[0034] Furthermore, the SIP dynamic load balancing system also includes an initialization module for initializing the kubernetescontroller module.

[0035] Furthermore, the parsing module includes:

[0036] A determination unit, used to determine the type of current update;

[0037] An updating unit, configured to update the IP information of the newly added or updated endpoint when the judging unit determines that the current update type is to add or update the endpoint, and the state is enabled;

[0038] The first task processing unit is used to continue processing the next task when the update unit does not update the IP information of the newly added or updated endpoint or the status is not enabled;

[0039] The deletion unit is used to connect to the MariaDB database and delete the routing information of the corresponding microservice when the judgment unit determines that the current update type is to delete the endpoint;

[0040] Add a unit to add new entries in the mariadb database and record the IP and port information of the endpoint;

[0041] A sending unit, used for sending HTTP messages to trigger Opensips to update the load balancing route;

[0042] The second task processing unit is used to continue processing the next task when the judgment unit determines that the type of the current update is other unsupported types.

[0043] Furthermore, the updating unit comprises:

[0044] The deletion device is used to connect to the mariadb database and delete the routing information of the corresponding microservice;

[0045] Add a device to add new entries in the mariadb database and record the IP and port information of the endpoint;

[0046] The sending device is used to send HTTP messages to trigger Opensips to update the load balancing routing information.

[0047] In a third aspect, the present invention provides a computer device, comprising a processor and a memory; wherein the processor implements the steps of the SIP dynamic load balancing method described in the first aspect when executing a computer program stored in the memory.

[0048] In a fourth aspect, the present invention provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the steps of the SIP dynamic load balancing method described in the first aspect are implemented.

[0049] The present invention provides a SIP dynamic load balancing method, system, device and storage medium, wherein the method includes reading the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored; obtaining the password of mariadb; connecting to the mariadb database according to the password of mariadb; starting the kubernetes controller monitoring service to monitor the changes of all endpoints; if any endpoint change is monitored, matching the changed endpoint with the microservice name in the configuration; obtaining the endpoint pointer of the successfully matched microservice and appending it to the end of the workQueue work queue; parsing the microservice endpoint information in the task of the workQueue. The present invention can enable the Opensips microservice in the cloud native environment to perceive the changes of the load balancing route in a timely and dynamic manner without manual operation; at the same time, the present invention dynamically adapts to the expansion and contraction of the SIP microservice, thereby improving the reliability and adaptability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0051] Figure 1 A flow chart of a SIP dynamic load balancing method provided by an embodiment of the present invention;

[0052] Figure 2 A structural diagram of the sip uplink load balancing process in a cloud native environment provided by an embodiment of the present invention;

[0053] Figure 3 A flow chart of SIP dynamic load balancing monitoring provided by an embodiment of the present invention;

[0054] Figure 4 A flow chart of the SIP dynamic load balancing task processing provided by an embodiment of the present invention;

[0055] Figure 5 A structural diagram of a SIP dynamic load balancing system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] As described in the background technology, Figure 2 As shown in the figure, in the request from the client to the server, when the mobile phone sends a message, the SIP load balancing service Opensips receives the message through the SIP access module and other modules, and distributes different message types and load balancing to the corresponding service modules for processing. Traditional Opensips provides load balancing capabilities for microservices based on routing scripts, but in a cloud-native environment, the signaling layer message receiving microservice needs to follow the 12-factors methodology and use the stateless type deployment of Deployment. It is not feasible to rely on the unchanged routing script. There are two main reasons: 1. After an error occurs in the microservice or it is manually restarted, the IP and pod name in the microservice k8s cluster change. Failure to manually update the Opensips routing script in time will cause link failure; 2. When the microservice is expanded or reduced in capacity, it needs to be modified manually, and manual modification has the problem of delay and the possibility of error. Therefore, it is urgent to solve the problem that traditional sip load balancing cannot dynamically update routing in real time in a cloud-native environment.

[0058] Therefore, in order to solve the above problem, in one embodiment, Figure 1 and Figure 3 As shown, an embodiment of the present invention provides a SIP dynamic load balancing method, including:

[0059] Step 101, read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored.

[0060] Step 102, obtain the password of mariadb.

[0061] Step 103, connect to the mariadb database according to the mariadb password.

[0062] Step 104: Start the Kubernetes controller monitoring service to monitor changes in all endpoints.

[0063] Before this step, the kubernetes controller module is initialized. Changes in endpoints, whether they are additions, deletions, or updates to status, IP, etc., are monitored.

[0064] Step 105: If any endpoint change is monitored, the changed endpoint is matched with the microservice name in the configuration.

[0065] Step 106, obtain the endpoint pointer of the successfully matched microservice and append it to the end of the workQueue work queue to ensure orderliness. If no match is successful, continue monitoring.

[0066] Step 107, parse the microservice endpoint information in the workQueue task.

[0067] like Figure 4 As shown, in this step, the type of the current update is determined.

[0068] If the current update type is to add or update an endpoint, the IP information of the newly added or updated endpoint is updated and the status is enable.

[0069] Connect to the mariadb database and delete the routing information of the corresponding microservice; in the mariadb database, add new entries and record the IP and port information of the endpoint; send HTTP messages to trigger Opensips to update the load balancing routing information.

[0070] If the newly added or updated endpoint does not have updated IP information, or the status is not enable, continue to process the next task.

[0071] If the current update type is to delete the endpoint, connect to the mariadb database and delete the routing information of the corresponding microservice.

[0072] Add a new entry in the mariadb database and record the IP and port information of the endpoint.

[0073] The following is the routing data stored in the mariadb database:

[0074]

[0075] Send HTTP messages to trigger Opensips to update the load balancing routes.

[0076] If the current update type is another unsupported type, proceed to the next task.

[0077] Steps 101-107 are to deploy a cloud native microservice sip-endpoint-watcher in the cluster. Although the IP and pod name of the message receiving microservice are changing, the only thing that remains unchanged is the name of the service endpoint. The present invention can dynamically monitor the changes in the endpoint resources of the SIP message receiving microservice, and maintain a current SIP message receiving microservice status list in the mariadb database for use by Opensips load balancing routing. The service status list includes the message type, IP address, and working status of the SIP microservice. If any changes in related microservices are monitored, the business logic is judged. If it affects the current load balancing routing configuration, after the database is successfully updated, an HTTP message is immediately sent to Opensips to trigger Opensips to reload the route to achieve the effect of dynamic load balancing.

[0078] The sip-endpoint-watcher module in the present invention is written in GO language, calls the Client-go library, and customizes a Kubernetes controller to monitor kubernetes resources. The Kubernetes controller mainly consists of five parts: Clients, Informer, callback, WorkQueue, and worker. According to the actual business logic of sip load balancing in a cloud native environment, the present invention applies a complete set of kubernetes controller logic, customized business and configuration, and adds updating the mariadb database and sending HTTP messages to trigger Opensips updates.

[0079] The dynamic load balancing method provided by the present invention should be a dynamic monitoring and updating method, which is not bound to SIP, Opensips, or database mariadb services, and can be selected on demand according to specific needs in a cloud native environment.

[0080] Based on the same inventive concept, an embodiment of the present invention further provides a SIP dynamic load balancing system. Since the principle of solving the problem by the system is similar to that of the aforementioned SIP dynamic load balancing method, the implementation of the system can refer to the implementation of the SIP dynamic load balancing method, and the repeated parts will not be repeated.

[0081] In another embodiment, a SIP dynamic load balancing system provided by an embodiment of the present invention is as follows: Figure 5 As shown, including:

[0082] The reading module 10 is used to read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored.

[0083] The first acquisition module 20 is used to acquire the password of mariadb.

[0084] The connection module 30 is used to connect to the mariadb database according to the mariadb password.

[0085] The monitoring startup module 40 is used to start the Kubernetes controller monitoring service to monitor changes of all endpoints.

[0086] The name matching module 50 is used to match the changed endpoint with the microservice name in the configuration when the monitoring startup module monitors any endpoint change.

[0087] The second acquisition module 60 is used to obtain the endpoint pointer of the successfully matched microservice and append it to the end of the workQueue work queue.

[0088] The parsing module 70 is used to parse the microservice endpoint information in the task of the workQueue.

[0089] Optionally, the SIP dynamic load balancing system further includes an initialization module for initializing a kubernetescontroller module.

[0090] Optionally, the parsing module includes:

[0091] The determination unit is used to determine the type of the current update.

[0092] The updating unit is used to update the IP information of the newly added or updated endpoint when the judging unit determines that the current update type is to add or update the endpoint, and the state is enabled.

[0093] The first task processing unit is used to continue processing the next task when the update unit does not update the IP information of the newly added or updated endpoint or the status is not enabled.

[0094] The deletion unit is used to connect to the MariaDB database and delete the routing information of the corresponding microservice when the judgment unit determines that the current update type is to delete the endpoint.

[0095] Add a unit to add new entries in the mariadb database and record the IP and port information of the endpoint.

[0096] The sending unit is used to send HTTP messages to trigger Opensips to update the load balancing route.

[0097] The second task processing unit is used to continue processing the next task when the judgment unit determines that the type of the current update is other unsupported types.

[0098] Optionally, the updating unit includes:

[0099] The deletion device is used to connect to the mariadb database and delete the routing information of the corresponding microservice.

[0100] Add a device to add new entries in the mariadb database and record the IP and port information of the endpoint.

[0101] The sending device is used to send HTTP messages to trigger Opensips to update the load balancing routing information.

[0102] For more specific working processes of the above modules, please refer to the corresponding contents disclosed in the above embodiments, which will not be repeated here.

[0103] In another embodiment, the present invention further provides a computer device, including a processor and a memory; wherein the processor implements the SIP dynamic load balancing method disclosed in the above embodiment when executing a computer program stored in the memory.

[0104] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0105] In another embodiment, the present invention further provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the aforementioned SIP dynamic load balancing method is implemented.

[0106] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0107] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the systems, devices, and storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part.

[0108] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.

[0109] The present invention has been described in detail above in conjunction with specific implementations and exemplary examples, but these descriptions cannot be understood as limiting the present invention. Those skilled in the art understand that, without departing from the spirit and scope of the present invention, a variety of equivalent substitutions, modifications or improvements may be made to the technical solution of the present invention and its implementation methods, all of which fall within the scope of the present invention. The scope of protection of the present invention shall be subject to the attached claims.

Claims

1. A SIP dynamic load balancing method, characterized in that: include: Read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored; Get the password of mariadb; Connect to the mariadb database according to the mariadb password; Start the kubernetes controller monitoring service to monitor changes in all endpoints; If any endpoint changes are detected, the changed endpoint is matched with the microservice name in the configuration; Get the endpoint pointer of the successfully matched microservice and append it to the end of the workQueue work queue; Parse the microservice endpoint information in the workQueue task.

2. The SIP dynamic load balancing method according to claim 1, characterized in that: Before starting the kubernetescontroller monitoring service to monitor changes in all endpoints, the kubernetescontroller module is initialized.

3. The SIP dynamic load balancing method according to claim 1, characterized in that: The microservice endpoint information in the task of parsing the workQueue includes: Determine the type of current update; If the current update type is to add or update an endpoint, the IP information of the newly added or updated endpoint is updated and the status is enable; If the newly added or updated endpoint does not have updated IP information, or the status is not enabled, continue to process the next task; If the current update type is to delete the endpoint, connect to the MariaDB database and delete the routing information of the corresponding microservice; Add new entries in the mariadb database and record the IP and port information of the endpoint; Send HTTP messages to trigger Opensips to update the load balancing route; If the current update type is another unsupported type, proceed to the next task.

4. The SIP dynamic load balancing method according to claim 3, characterized in that: If the current update type is to add or update an endpoint, the IP information of the newly added or updated endpoint is updated, and the status is enable, including: Connect to the mariadb database and delete the routing information of the corresponding microservice; In the mariadb database, add a new entry and record the IP and port information of the endpoint; Send HTTP messages to trigger Opensips to update load balancing routing information.

5. A SIP dynamic load balancing system, characterized in that: include: The reading module is used to read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored; The first acquisition module is used to obtain the password of mariadb; The connection module is used to connect to the mariadb database according to the mariadb password; The monitoring startup module is used to start the Kubernetes controller monitoring service to monitor changes in all endpoints; The name matching module is used to match the changed endpoint with the microservice name in the configuration when the monitoring startup module monitors any endpoint changes; The second acquisition module is used to obtain the endpoint pointer of the successfully matched microservice and append it to the end of the workQueue work queue; The parsing module is used to parse the microservice endpoint information in the workQueue task.

6. The SIP dynamic load balancing system according to claim 5, characterized in that: It also includes an initialization module for initializing the kubernetes controller module.

7. The SIP dynamic load balancing system according to claim 5, characterized in that: The parsing module comprises: A determination unit, used to determine the type of current update; The updating unit is used to update the IP information of the newly added or updated endpoint when the judging unit determines that the current update type is to add or update the endpoint, and the state is enabled; The first task processing unit is used to continue processing the next task when the update unit does not update the IP information of the newly added or updated endpoint or the status is not enabled; The deletion unit is used to connect to the MariaDB database and delete the routing information of the corresponding microservice when the judgment unit determines that the current update type is to delete the endpoint; Add a unit to add new entries in the mariadb database and record the IP and port information of the endpoint; A sending unit, used for sending HTTP messages to trigger Opensips to update the load balancing route; The second task processing unit is used to continue processing the next task when the judgment unit determines that the type of the current update is other unsupported types.

8. The SIP dynamic load balancing system according to claim 7, characterized in that: The updating unit comprises: The deletion device is used to connect to the mariadb database and delete the routing information of the corresponding microservice; Add a device to add new entries in the mariadb database and record the IP and port information of the endpoint; The sending device is used to send HTTP messages to trigger Opensips to update the load balancing routing information.

9. A computer device, characterized in that: The method comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the steps of the SIP dynamic load balancing method according to any one of claims 1 to 4 are implemented.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; when the computer programs are executed by a processor, the steps of the SIP dynamic load balancing method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • SIP-based load balancing apparatus and method

    US20040088424A1

  • Load balancing among VOIP server groups

    US20110271005A1

  • Methods And Systems For Controlling SIP Overload

    US20120008495A1

  • Load Balancing for SIP Services

    US20130054806A1