WO2024074091A1 - 一种sip动态负载均衡方法、系统、设备和存储介质 - Google Patents

一种sip动态负载均衡方法、系统、设备和存储介质 Download PDF

Info

Publication number
WO2024074091A1
WO2024074091A1 PCT/CN2023/119011 CN2023119011W WO2024074091A1 WO 2024074091 A1 WO2024074091 A1 WO 2024074091A1 CN 2023119011 W CN2023119011 W CN 2023119011W WO 2024074091 A1 WO2024074091 A1 WO 2024074091A1
Authority
WO
WIPO (PCT)
Prior art keywords
endpoint
mariadb
load balancing
sip
microservice
Prior art date
Application number
PCT/CN2023/119011
Other languages
English (en)
French (fr)
Inventor
颜凤辉
王斌
杨戉
夏增武
夏建明
盛振明
刘毅
Original Assignee
中电信数智科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中电信数智科技有限公司 filed Critical 中电信数智科技有限公司
Publication of WO2024074091A1 publication Critical patent/WO2024074091A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1101Session protocols
    • H04L65/1104Session initiation protocol [SIP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1025Dynamic adaptation of the criteria on which the server selection is based
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Definitions

  • 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.
  • SIP Session Initiation Protocol
  • SIP Session Initiation Protocol
  • IP IP Multimedia Subsystem
  • 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.
  • the present invention aims at the deficiencies in the prior art and provides a SIP dynamic load balancing method, system, device and storage medium.
  • the present invention provides a SIP dynamic load balancing method, comprising:
  • the starting of the kubernetes controller monitoring service to monitor changes in all endpoints includes initializing the kubernetes controller module.
  • microservice endpoint information in the task of parsing the workQueue includes:
  • the IP information of the newly added or updated endpoint is updated and the status is enable;
  • the IP information of the newly added or updated endpoint is updated, and the state is enabled, including:
  • the present invention provides a SIP dynamic load balancing system, comprising:
  • 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
  • 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 detects any changes in the endpoint;
  • 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.
  • the SIP dynamic load balancing system also includes an initialization module for initializing the kubernetes controller module.
  • parsing module includes:
  • 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;
  • 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.
  • the updating unit comprises:
  • the deletion device is used to connect to the mariadb database and delete the routing information of the corresponding microservice
  • the sending device is used to send HTTP messages to trigger Opensips to update the load balancing routing information.
  • 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.
  • 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.
  • 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 changes in 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 workQueue task.
  • the present invention can enable the Opensips microservice in a cloud native environment to perceive changes in load balancing routes 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.
  • FIG1 is a flow chart of a SIP dynamic load balancing method provided by an embodiment of the present invention.
  • FIG2 is a structural diagram of a SIP uplink load balancing process in a cloud native environment provided by an embodiment of the present invention
  • FIG3 is a flow chart of SIP dynamic load balancing monitoring provided by an embodiment of the present invention.
  • FIG4 is a flowchart of a SIP dynamic load balancing task processing according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of the structure of a SIP dynamic load balancing system provided by an embodiment of the present invention.
  • the SIP load balancing service Opensips receives the message through the SIP access module, and the different message types and load balancing are processed by the corresponding service module.
  • 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 an unchanged routing script. There are mainly two reasons: 1. After an error occurs in the microservice or it is manually restarted, the IP and pod names in the microservice k8s cluster are changed.
  • an embodiment of the present invention provides a SIP dynamic load balancing method, including:
  • Step 101 read the IP address of Opensips, the service name of the database mariadb, and the names of all microservices to be monitored.
  • Step 102 obtain the password of mariadb.
  • Step 103 connect to the mariadb database according to the mariadb password.
  • Step 104 start the kubernetes controller monitoring service to monitor changes in all endpoints.
  • the kubernetes controller module is initialized. Changes in endpoints, whether they are added, deleted, or updated in status or IP, will be monitored.
  • Step 105 If any endpoint change is monitored, the changed endpoint is matched with the microservice name in the configuration.
  • 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.
  • Step 107 parse the microservice endpoint information in the workQueue task.
  • the type of the current update is determined.
  • the IP information of the newly added or updated endpoint is updated and the status is enable.
  • Steps 101-107 are to deploy a cloud native microservice sip-endpoint-watcher in the cluster.
  • the IP and pod name of the message receiving microservice are changed, the only thing that remains unchanged is the name of the service endpoint.
  • the service status list includes the message type, IP address, and working status of the SIP microservice. If any changes in any 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 routing to achieve the effect of dynamic load balancing.
  • the sip-endpoint-watcher module in the present invention is written in G0 language, calls the Client-go library, and customizes a Kubernetes controller to monitor kubernetes resources.
  • the Kubernetes controller is mainly composed of five parts: Clients, Informer, callback, WorkQueue, and worker.
  • 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.
  • 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.
  • 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.
  • a SIP dynamic load balancing system provided by an embodiment of the present invention, as shown in FIG5 , includes:
  • 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.
  • the first acquisition module 20 is used to obtain the password of mariadb.
  • the connection module 30 is used to connect to the mariadb database according to the mariadb password.
  • the monitoring startup module 40 is used to start the kubernetes controller monitoring service to monitor changes in all endpoints.
  • 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.
  • 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.
  • the parsing module 70 is used to parse the microservice endpoint information in the task of the workQueue.
  • the SIP dynamic load balancing system also includes an initialization module for initializing the kubernetes controller module.
  • the parsing module includes:
  • the determination unit is used to determine the type of the 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.
  • the sending unit is used to send 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.
  • the updating unit includes:
  • the deletion device is used to connect to the mariadb database and delete the routing information of the corresponding microservice.
  • the sending device is used to send HTTP messages to trigger Opensips to update the load balancing routing information.
  • 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.
  • 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 disclosed SIP dynamic load balancing method is implemented.
  • 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.
  • the description is relatively simple, and the relevant parts can be referred to the method part.
  • the computer software product can be stored in a storage medium, such as ROM/RAM, a disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention or certain parts of the embodiments.
  • a computer device which can be a personal computer, a server, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Telephonic Communication Services (AREA)

Abstract

本发明提供一种SIP动态负载均衡方法、系统、设备和存储介质,其中方法包括读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称;获取mariadb的密码;根据mariadb的密码连接mariadb数据库;启动kubernetes controller监控业务以监控所有endpoints的变化;如果监控到任何endpoint的变化,则将变化的endpoint与配置中的微服务名称进行匹配;获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部;解析workQueue的任务中微服务endpoint信息。本发明可以使云原生环境下的Opensips微服务及时、动态地感知负载均衡路由的变化,且无需手工操作;同时本发明动态适应SIP微服务的扩容和缩容,从而提高系统的可靠性、自适应性。

Description

一种SIP动态负载均衡方法、系统、设备和存储介质 技术领域
本发明属于通信技术领域,尤其涉及一种SIP动态负载均衡方法、系统、设备和存储介质。
背景技术
SIP(Session Initiation Protocol,会话初始协议)是一个基于文本的,用于多方多媒体通信的应用层信令控制协议。SIP独立于底层传输协议,用于建立、修改和终止IP网上的双方或多方多媒体会话,是在基于IP的网络中,实现实时通信应用的一种信令协议。SIP消息有两种:客户端到服务器的请求和服务器到客户端的响应。
客户端到服务器的请求中,当手机端发来消息时,经由SIP接入等模块,SIP负载均衡服务Opensips接收消息,并将不同的消息类型和负载均衡给对应的服务模块处理。传统的Opensips是根据路由脚本为微服务提供负载均衡能力,但在云原生环境下,信令层消息接收微服务需要遵循12-factors方法论,采用Deployment的无状态类型部署,依赖不变的路由脚本是不可行的,主要有以下两点原因:1.微服务发生错误或手动重启后,微服务k8s集群中的IP和pod名字是变化的,不能及时手动更新Opensips路由脚本会造成链路失败;2.当微服务扩容、缩容时,需手动修改,手动修改存在延时的问题和错误的可能性。因此,亟需解决传统sip负载均衡在云原生环境中不能实时动态地更新路由的问题。
发明内容
本发明针对现有技术中的不足,提供一种SIP动态负载均衡方法、系统、设备和存储介质。
第一方面,本发明提供一种SIP动态负载均衡方法,包括:
读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称;
获取mariadb的密码;
根据mariadb的密码连接mariadb数据库;
启动kubernetes controller监控业务以监控所有endpoints的变化;
如果监控到任何endpoint的变化,则将变化的endpoint与配置中的微服务名称进行匹配;
获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部;
解析workQueue的任务中微服务endpoint信息。
进一步地,所述启动kubernetes controller监控业务以监控所有endpoints的变化之前包括初始化kubernetes controller模块。
进一步地,所述解析workQueue的任务中微服务endpoint信息,包括:
判断当前更新的类型;
如果当前更新的类型为增加或更新endpoint,则更新新增加或更新的endpoint的IP信息,并且状态enable;
如果新增加或更新的endpoint没有更新IP信息,或状态非enable,继续处理下一个任务;
如果当前更新的类型为删除endpoint,则连接mariadb数据库,删除对应微服务的路由信息;
在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息;
发送HTTP消息以触发Opensips更新负载均衡路由;
如果当前更新的类型为不支持的其他类型,继续处理下一个任务。
进一步地,所述如果当前更新的类型为增加或更新endpoint,则更新新增加或更新的endpoint的IP信息,并且状态enable,包括:
连接mariadb数据库,删除对应微服务的路由信息;
在mariadb数据库中,添加新增条目并记录endpoint的IP、端口信息;
发送HTTP消息以触发Opensips更新负载均衡路由信息。
第二方面,本发明提供一种SIP动态负载均衡系统,包括:
读取模块,用于读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称;
第一获取模块,用于获取mariadb的密码;
连接模块,用于根据mariadb的密码连接mariadb数据库;
监控启动模块,用于启动kubernetes controller监控业务以监控所有endpoints的变化;
名称匹配模块,用于在监控启动模块监控到任何endpoint的变化的情况下,将变化的endpoint与配置中的微服务名称进行匹配;
第二获取模块,用于获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部;
解析模块,用于解析workQueue的任务中微服务endpoint信息。
进一步地,所述SIP动态负载均衡系统还包括初始化模块,用于初始化kubernetes controller模块。
进一步地,所述解析模块包括:
判断单元,用于判断当前更新的类型;
更新单元,用于在判断单元确定当前更新的类型为增加或更新endpoint的情况下,更新新增加或更新的endpoint的IP信息,并且状态enable;
第一任务处理单元,用于在更新单元没有更新新增加或更新的endpoint的IP信息,或状态非enable的情况下,继续处理下一个任务;
删除单元,用于在判断单元确定当前更新的类型为删除endpoint的情况下,连接mariadb数据库,删除对应微服务的路由信息;
添加单元,用于在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息;
发送单元,用于发送HTTP消息以触发Opensips更新负载均衡路由;
第二任务处理单元,用于在判断单元确定当前更新的类型为不支持的其他类型,继续处理下一个任务。
进一步地,所述更新单元包括:
删除装置,用于连接mariadb数据库,删除对应微服务的路由信息;
添加装置,用于在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息;
发送装置,用于发送HTTP消息以触发Opensips更新负载均衡路由信息。
第三方面,本发明提供一种计算机设备,包括处理器和存储器;其中,处理器执行存储器中保存的计算机程序时实现第一方面所述的SIP动态负载均衡方法的步骤。
第四方面,本发明提供计算机可读存储介质,用于存储计算机程序;计算机程序被处理器执行时实现第一方面所述的SIP动态负载均衡方法的步骤。
本发明提供一种SIP动态负载均衡方法、系统、设备和存储介质,其中方法包括读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称;获取mariadb的密码;根据mariadb的密码连接mariadb数据库;启动kubernetes controller监控业务以监控所有endpoints的变化;如果监控到任何endpoint的变化,则将变化的endpoint与配置中的微服务名称进行匹配;获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部;解析workQueue的任务中微服务endpoint信息。本发明可以使云原生环境下的Opensips微服务及时、动态地感知负载均衡路由的变化,且无需手工操作; 同时本发明动态适应SIP微服务的扩容和缩容,从而提高系统的可靠性、自适应性。
附图说明
为了更清楚地说明本发明的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种SIP动态负载均衡方法的流程图;
图2为本发明实施例提供的云原生环境下sip上行负载均衡流程结构图;
图3为本发明实施例提供的SIP动态负载均衡监控流程图;
图4为本发明实施例提供的SIP动态负载均衡任务处理流程图;
图5为本发明实施例提供的一种SIP动态负载均衡系统的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整的描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
如背景技术中所述,如图2所示,客户端到服务器的请求中,当手机端发来消息时,经由SIP接入等模块,SIP负载均衡服务Opensips接收消息,并将不同的消息类型和负载均衡给对应的服务模块处理。传统的Opensips是根据路由脚本为微服务提供负载均衡能力,但在云原生环境下,信令层消息接收微服务需要遵循12-factors方法论,采用Deployment的无状态类型部署,依赖不变的路由脚本是不可行的,主要有以下两点原因:1.微服务发生错误或手动重启后,微服务k8s集群中的IP和pod名字是变化的,不能及时手动更新Opensips路由脚本会造成链路失败;2.当微服务扩容、缩容时,需手动修改,手动修改存在延时的问题和错误的可能性。因此,亟需解决传统sip负载均衡在云原生环境中不能实时动态地更新路由的问题。
因此为了解决上述问题,在一实施例中,如图1和图3所示,本发明实施例提供一种SIP动态负载均衡方法,包括:
步骤101,读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称。
步骤102,获取mariadb的密码。
步骤103,根据mariadb的密码连接mariadb数据库。
步骤104,启动kubernetes controller监控业务以监控所有endpoints的变化。
在本步骤之前还包括初始化kubernetes controller模块。endpoints的变化无论是endpoint的增加、删除、或者是状态、IP等的更新,都会监控到。
步骤105,如果监控到任何endpoint的变化,则将变化的endpoint与配置中的微服务名称进行匹配。
步骤106,获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部,以保证有序性。如果没有匹配成功,则继续监控。
步骤107,解析workQueue的任务中微服务endpoint信息。
如图4所示,本步骤中,判断当前更新的类型。
如果当前更新的类型为增加或更新endpoint,则更新新增加或更新的endpoint的IP信息,并且状态enable。
连接mariadb数据库,删除对应微服务的路由信息;在mariadb数据库中,添加新增条目并记录endpoint的IP、端口信息;发送HTTP消息以触发Opensips更新负载均衡路由信息。
如果新增加或更新的endpoint没有更新IP信息,或状态非enable,继续处理下一个任务。
如果当前更新的类型为删除endpoint,则连接mariadb数据库,删除对应微服务的路由信息。
在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息。
如下为mariadb数据库存储的路由数据:
发送HTTP消息以触发Opensips更新负载均衡路由。
如果当前更新的类型为不支持的其他类型,继续处理下一个任务。
步骤101-107,是在集群中部署一个云原生微服务sip-endpoint-watcher。虽然消息接收微服务的IP和pod名称都是变化的,唯一不变的是服务endpoint的名称。本发明可以动 态监控SIP消息接收微服务endpoint资源的变化情况,在mariadb数据库中维护一个当前的SIP消息接收微服务状态列表,以供Opensips负载均衡路由使用。所述服务状态列表包括SIP微服务所属的消息类型、IP地址、工作状态。若监控到任何相关微服务的变化,进行业务逻辑的判断,若影响当前负载均衡的路由配置,更新数据库成功后,立即发HTTP消息给Opensips,触发Opensips进行路由重载,以达到动态负载均衡的效果。
本发明中的sip-endpoint-watcher模块由G0语言编写,调用Client-go库,定制一个Kubernetes controller,用以监控kubernetes资源,Kubernetes controller主要由Clients,Informer,callback,WorkQueue,worker,这五部分组成。本发明根据sip负载均衡在云原生环境中的实际业务逻辑,应用了整套的kubernetes controller逻辑,定制化业务和配置,并加入了更新mariadb数据库和发送HTTP消息触发Opensips更新。
本发明提供的动态负载均衡方法应当是一种动态监控及更新方法,不与SIP,Opensips、数据库mariadb服务绑定,可根据云原生环境下具体需求按需选择。
基于同一发明构思,本发明实施例还提供了一种SIP动态负载均衡系统,由于该系统解决问题的原理与前述一种SIP动态负载均衡方法相似,因此该系统的实施可以参见SIP动态负载均衡方法的实施,重复之处不再赘述。
在另一实施例中,本发明一个实施例提供的SIP动态负载均衡系统,如图5所示,包括:
读取模块10,用于读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称。
第一获取模块20,用于获取mariadb的密码。
连接模块30,用于根据mariadb的密码连接mariadb数据库。
监控启动模块40,用于启动kubernetes controller监控业务以监控所有endpoints的变化。
名称匹配模块50,用于在监控启动模块监控到任何endpoint的变化的情况下,将变化的endpoint与配置中的微服务名称进行匹配。
第二获取模块60,用于获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部。
解析模块70,用于解析workQueue的任务中微服务endpoint信息。
可选地,所述SIP动态负载均衡系统还包括初始化模块,用于初始化kubernetes controller模块。
可选地,所述解析模块包括:
判断单元,用于判断当前更新的类型。
更新单元,用于在判断单元确定当前更新的类型为增加或更新endpoint的情况下,更新新增加或更新的endpoint的IP信息,并且状态enable。
第一任务处理单元,用于在更新单元没有更新新增加或更新的endpoint的IP信息,或状态非enable的情况下,继续处理下一个任务。
删除单元,用于在判断单元确定当前更新的类型为删除endpoint的情况下,连接mariadb数据库,删除对应微服务的路由信息。
添加单元,用于在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息。
发送单元,用于发送HTTP消息以触发Opensips更新负载均衡路由。
第二任务处理单元,用于在判断单元确定当前更新的类型为不支持的其他类型,继续处理下一个任务。
可选地,所述更新单元包括:
删除装置,用于连接mariadb数据库,删除对应微服务的路由信息。
添加装置,用于在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息。
发送装置,用于发送HTTP消息以触发Opensips更新负载均衡路由信息。
关于上述各个模块更加具体的工作过程可以参考前述实施例公开的相应内容,在此不再进行赘述。
在另一实施例中,本发明实施例还提供了一种计算机设备,包括处理器和存储器;其中,处理器执行存储器中保存的计算机程序时实现前述实施例公开的SIP动态负载均衡方法。
关于上述方法更加具体的过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。
在另一实施例中,本发明实施例还提供一种计算机可读存储介质,用于存储计算机程序;计算机程序被处理器执行时实现前述公开的SIP动态负载均衡方法。
关于上述方法更加具体的过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的系统、设备、存储介质而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件加必需的通用硬 件平台的方式来实现。基于这样的理解,本发明实施例中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。
以上结合具体实施方式和范例性实例对本发明进行了详细说明,不过这些说明并不能理解为对本发明的限制。本领域技术人员理解,在不偏离本发明精神和范围的情况下,可以对本发明技术方案及其实施方式进行多种等价替换、修饰或改进,这些均落入本发明的范围内。本发明的保护范围以所附权利要求为准。

Claims (10)

  1. 一种SIP动态负载均衡方法,其特征在于,包括:
    读取Opensips的IP地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称;
    获取mariadb的密码;
    根据mariadb的密码连接mariadb数据库;
    启动kubernetes controller监控业务以监控所有endpoints的变化;
    如果监控到任何endpoint的变化,则将变化的endpoint与配置中的微服务名称进行匹配;
    获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部;
    解析workQueue的任务中微服务endpoint信息。
  2. 根据权利要求1所述的SIP动态负载均衡方法,其特征在于,所述启动kubernetes controller监控业务以监控所有endpoints的变化之前包括初始化kubernetes controller模块。
  3. 根据权利要求1所述的SIP动态负载均衡方法,其特征在于,所述解析workQueue的任务中微服务endpoint信息,包括:
    判断当前更新的类型;
    如果当前更新的类型为增加或更新endpoint,则更新新增加或更新的endpoint的IP信息,并且状态enable;
    如果新增加或更新的endpoint没有更新IP信息,或状态非enable,继续处理下一个任务;
    如果当前更新的类型为删除endpoint,则连接mariadb数据库,删除对应微服务的路由信息;
    在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息;
    发送HTTP消息以触发Opensips更新负载均衡路由;
    如果当前更新的类型为不支持的其他类型,继续处理下一个任务。
  4. 根据权利要求3所述的SIP动态负载均衡方法,其特征在于,所述如果当前更新的类型为增加或更新endpoint,则更新新增加或更新的endpoint的IP信息,并且状态enable,包括:
    连接mariadb数据库,删除对应微服务的路由信息;
    在mariadb数据库中,添加新增条目并记录endpoint的IP、端口信息;
    发送HTTP消息以触发Opensips更新负载均衡路由信息。
  5. 一种SIP动态负载均衡系统,其特征在于,包括:
    读取模块,用于读取Opensips的1P地址、数据库mariadb的服务名称、以及要监控的所有微服务的名称;
    第一获取模块,用于获取mariadb的密码;
    连接模块,用于根据mariadb的密码连接mariadb数据库;
    监控启动模块,用于启动kubernetes controller监控业务以监控所有endpoints的变化;
    名称匹配模块,用于在监控启动模块监控到任何endpoint的变化的情况下,将变化的endpoint与配置中的微服务名称进行匹配;
    第二获取模块,用于获取匹配成功的微服务的endpoint指针并追加至workQueue工作队列尾部;
    解析模块,用于解析workQueue的任务中微服务endpoint信息。
  6. 根据权利要求5所述的SIP动态负载均衡系统,其特征在于,还包括初始化模块,用于初始化kubernetes controller模块。
  7. 根据权利要求5所述的SIP动态负载均衡系统,其特征在于,所述解析模块包括:
    判断单元,用于判断当前更新的类型;
    更新单元,用于在判断单元确定当前更新的类型为增加或更新endpoint的情况下,更新新增加或更新的endpoint的IP信息,并且状态enable;
    第一任务处理单元,用于在更新单元没有更新新增加或更新的endpoint的IP信息,或状态非enable的情况下,继续处理下一个任务;
    删除单元,用于在判断单元确定当前更新的类型为删除endpoint的情况下,连接mariadb数据库,删除对应微服务的路由信息;
    添加单元,用于在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息;
    发送单元,用于发送HTTP消息以触发Opensips更新负载均衡路由;
    第二任务处理单元,用于在判断单元确定当前更新的类型为不支持的其他类型,继续处理下一个任务。
  8. 根据权利要求7所述的SIP动态负载均衡系统,其特征在于,所述更新单元包括:
    删除装置,用于连接mariadb数据库,删除对应微服务的路由信息;
    添加装置,用于在mariadb数据库中添加新增条目并记录endpoint的IP、端口信息;
    发送装置,用于发送HTTP消息以触发Opensips更新负载均衡路由信息。
  9. 一种计算机设备,其特征在于,包括处理器和存储器;其中,处理器执行存储器中保存的计算机程序时实现权利要求1-4任一项所述的SIP动态负载均衡方法的步骤。
  10. 一种计算机可读存储介质,其特征在于,用于存储计算机程序;计算机程序被处理器执行时实现权利要求1-4任一项所述的SIP动态负载均衡方法的步骤。
PCT/CN2023/119011 2022-10-08 2023-09-15 一种sip动态负载均衡方法、系统、设备和存储介质 WO2024074091A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211220660.1 2022-10-08
CN202211220660.1A CN115714778A (zh) 2022-10-08 2022-10-08 一种sip动态负载均衡方法、系统、设备和存储介质

Publications (1)

Publication Number Publication Date
WO2024074091A1 true WO2024074091A1 (zh) 2024-04-11

Family

ID=85231039

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/119011 WO2024074091A1 (zh) 2022-10-08 2023-09-15 一种sip动态负载均衡方法、系统、设备和存储介质

Country Status (2)

Country Link
CN (1) CN115714778A (zh)
WO (1) WO2024074091A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115714778A (zh) * 2022-10-08 2023-02-24 中电信数智科技有限公司 一种sip动态负载均衡方法、系统、设备和存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106464685A (zh) * 2014-11-04 2017-02-22 华为技术有限公司 服务器资源的自适应分配
US20180146068A1 (en) * 2016-11-23 2018-05-24 Level 3 Communications, Llc Micro-services in a telecommunications network
CN109962904A (zh) * 2017-12-26 2019-07-02 中国移动通信集团公司 一种基于Kubernetes的IMS系统
CN112000448A (zh) * 2020-07-17 2020-11-27 北京计算机技术及应用研究所 基于微服务架构的应用管理方法
US20220094743A1 (en) * 2020-09-22 2022-03-24 Ribbon Communications Operating Company, Inc. Methods, apparatus and systems for cloud native application multi-factor load balancing
WO2022128165A1 (en) * 2020-12-16 2022-06-23 Telefonaktiebolaget Lm Ericsson (Publ) First ims node, second server, subscriber server and methods in a communications network
CN115714778A (zh) * 2022-10-08 2023-02-24 中电信数智科技有限公司 一种sip动态负载均衡方法、系统、设备和存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106464685A (zh) * 2014-11-04 2017-02-22 华为技术有限公司 服务器资源的自适应分配
US20180146068A1 (en) * 2016-11-23 2018-05-24 Level 3 Communications, Llc Micro-services in a telecommunications network
CN109962904A (zh) * 2017-12-26 2019-07-02 中国移动通信集团公司 一种基于Kubernetes的IMS系统
CN112000448A (zh) * 2020-07-17 2020-11-27 北京计算机技术及应用研究所 基于微服务架构的应用管理方法
US20220094743A1 (en) * 2020-09-22 2022-03-24 Ribbon Communications Operating Company, Inc. Methods, apparatus and systems for cloud native application multi-factor load balancing
WO2022128165A1 (en) * 2020-12-16 2022-06-23 Telefonaktiebolaget Lm Ericsson (Publ) First ims node, second server, subscriber server and methods in a communications network
CN115714778A (zh) * 2022-10-08 2023-02-24 中电信数智科技有限公司 一种sip动态负载均衡方法、系统、设备和存储介质

Also Published As

Publication number Publication date
CN115714778A (zh) 2023-02-24

Similar Documents

Publication Publication Date Title
US9912538B2 (en) Synchronization of configuration file of virtual application distribution chassis
US8713365B2 (en) Re-establishing push notification channels via user identifiers
US20180213031A1 (en) System and method to balance servers based on server load status
US10313452B2 (en) Migrating a chat message service provided by a chat server to a new chat server
US20090100289A1 (en) Method and System for Handling Failover in a Distributed Environment that Uses Session Affinity
RU2608469C2 (ru) Способ и устройство высокоэффективной доставки уведомлений в реальном времени с малым временем задержки
WO2024074091A1 (zh) 一种sip动态负载均衡方法、系统、设备和存储介质
US10320951B2 (en) Systems and methods for establishing a virtual local area network
US10044766B2 (en) Managing mid-dialog session initiation protocol (SIP) messages
US20090106260A1 (en) Method and System for Transferring Files
CN113810349B (zh) 数据传输方法、装置、计算机设备和存储介质
US20150271273A1 (en) System for Using a Device as a Side Car
CN113992738A (zh) 基于微服务网关的反向代理方法、装置、设备及存储介质
US11973824B2 (en) Method for data transmission of audio and video in end-to-end system
CN111327680B (zh) 认证数据同步方法、装置、系统、计算机设备和存储介质
WO2019242279A1 (zh) 一种消息处理方法及装置
CN113612811B (zh) 一种在多通道中客户端挂载的方法、系统、设备及介质
CN112468886B (zh) 组播数据转发方法、装置、设备及可读存储介质
CN110519397B (zh) 一种基于nginx的sip终端接入的负载均衡系统及方法
CN113746851A (zh) 一种支持实时解析grpc请求的代理系统和方法
EP3618349A1 (en) Conference cascading method based on software media server, and server and storage medium
JP7424494B2 (ja) リクエスト配送装置、リクエスト配送方法、および、リクエスト配送プログラム
WO2024082882A1 (zh) 多媒体内容的传输方法、装置、设备及存储介质
CN117615057B (zh) 故障检测方法、装置、系统、计算机设备和存储介质
JP4893464B2 (ja) コネクション強制解放装置、コネクション強制解放方法及びコネクション強制解放プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23874283

Country of ref document: EP

Kind code of ref document: A1