CN119299455A - A device and method for call transaction load balancing based on 5G new calls - Google Patents
A device and method for call transaction load balancing based on 5G new calls Download PDFInfo
- Publication number
- CN119299455A CN119299455A CN202411363382.4A CN202411363382A CN119299455A CN 119299455 A CN119299455 A CN 119299455A CN 202411363382 A CN202411363382 A CN 202411363382A CN 119299455 A CN119299455 A CN 119299455A
- Authority
- CN
- China
- Prior art keywords
- http
- transaction
- transaction identifier
- upstream
- call
- 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
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000011144 upstream manufacturing Methods 0.000 claims abstract description 80
- 230000004044 response Effects 0.000 claims abstract description 12
- 230000011664 signaling Effects 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 10
- 238000004891 communication Methods 0.000 claims description 7
- 230000006870 function Effects 0.000 claims description 3
- 230000009191 jumping Effects 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000010295 mobile communication Methods 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 2
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 2
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 2
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 2
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 230000005856 abnormality Effects 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/08—Load balancing or load distribution
- H04W28/09—Management thereof
- H04W28/0925—Management thereof using policies
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及一种基于5G新通话的呼叫事务负载均衡的装置和方法。The present invention relates to a device and method for call transaction load balancing based on 5G new calls.
背景技术Background Art
本发明的技术背景主要围绕5G新通话大区之间呼叫事务负载均衡展开。大区之间数据不共享,一个呼叫可能包含多条信令消息,如果将信令消息1,发送到大区1,而信令消息2发送到大区2,大区2是无法处理的,最终会导致呼叫异常。目前,开源负载均衡器如Nginx不支持事务级别的负载均衡,它只能进行消息级别的负载均衡。The technical background of the present invention mainly revolves around the call transaction load balancing between 5G new call zones. Data between zones is not shared, and a call may contain multiple signaling messages. If signaling message 1 is sent to zone 1, and signaling message 2 is sent to zone 2, zone 2 cannot process it, which will eventually cause call abnormality. At present, open source load balancers such as Nginx do not support transaction-level load balancing, and can only perform message-level load balancing.
针对上述问题,本发明通过JSONPATH获取HTTP/2请求报文中的呼叫标识来关联上游,将相同呼叫标识的信令消息,转发到同一个上游。In view of the above problem, the present invention obtains the call identifier in the HTTP/2 request message through JSONPATH to associate the upstream, and forwards the signaling message with the same call identifier to the same upstream.
发明内容Summary of the invention
针对现有技术中存在的问题,本发明的目的在于提供一种基于5G新通话的呼叫事务负载均衡的装置和方法的技术方案,以实现5G新通话大区之间呼叫事务负载均衡为解决目标。In view of the problems existing in the prior art, the purpose of the present invention is to provide a technical solution of a device and method for call transaction load balancing based on 5G new calls, so as to achieve call transaction load balancing between 5G new call areas.
所述的一种基于5G新通话的呼叫事务负载均衡的装置,其特征在于包括:The device for call transaction load balancing based on 5G new calls is characterized by comprising:
配置模块:负责对配置数据进行处理;Configuration module: responsible for processing configuration data;
负载模块:负责接收用户发送的HTTP/2请求报文,然后解析所述HTTP/2请求报文,再获取事务标识并根据所述事务标识将所述HTTP/2请求报文转发到上游,最后将上游的HTTP/2应答报文转发给用户。Load module: responsible for receiving the HTTP/2 request message sent by the user, then parsing the HTTP/2 request message, obtaining the transaction identifier and forwarding the HTTP/2 request message to the upstream according to the transaction identifier, and finally forwarding the upstream HTTP/2 response message to the user.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在包括如下步骤:The method for call transaction load balancing based on 5G new calls is characterized in that it includes the following steps:
步骤S101:配置模块对配置数据进行处理;Step S101: The configuration module processes the configuration data;
步骤S102:负载模块接收用户发送的HTTP/2请求报文;Step S102: The load module receives the HTTP/2 request message sent by the user;
步骤S103:负载模块解析所述HTTP/2请求报文;Step S103: the load module parses the HTTP/2 request message;
步骤S104:负载模块获取事务标识并根据所述事务标识将所述HTTP/2请求报文转发到上游;Step S104: the load module obtains the transaction identifier and forwards the HTTP/2 request message to the upstream according to the transaction identifier;
步骤S105:负载模块将上游的HTTP/2应答报文转发给用户。Step S105: The load module forwards the upstream HTTP/2 response message to the user.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述步骤S101的具体实施过程如下:The method for call transaction load balancing based on 5G new calls is characterized in that the specific implementation process of step S101 is as follows:
步骤S1011,配置文件解析;Step S1011, parsing the configuration file;
配置文件解析通过定时5s重复获取配置文件中的配置,解析后生成事务标识获取策略、HTTP/2连接池,其中配置文件的格式为YAML;Configuration file parsing repeatedly obtains the configuration in the configuration file every 5 seconds, and generates transaction identifier acquisition strategy and HTTP/2 connection pool after parsing. The format of the configuration file is YAML.
步骤S1012,事务标识获取策略保存到内存;Step S1012, the transaction identifier acquisition strategy is saved in the memory;
事务标识获取策略根据配置文件中的identityPolicies进行处理获得,在内存中以List存储,值为JSONPATH字符串;The transaction identity acquisition policy is obtained by processing the identityPolicies in the configuration file and stored in the memory as a List, with the value being a JSONPATH string.
步骤S1013,根据上游信息创建HTTP/2连接对象;Step S1013, creating an HTTP/2 connection object according to the upstream information;
HTTP/2连接对象是指通过IP和端口创建的HTTP/2会话在代码中的对象;HTTP/2 connection object refers to the object in the code of HTTP/2 session created by IP and port;
上游信息根据配置文件中的upstreams进行处理获得,获取所有上游信息后,分别创建HTTP/2的连接并获得HTTP/2连接对象;The upstream information is obtained by processing the upstreams in the configuration file. After obtaining all the upstream information, HTTP/2 connections are created and HTTP/2 connection objects are obtained.
步骤S1014,HTTP/2连接对象保存到连接池;Step S1014, the HTTP/2 connection object is saved to the connection pool;
HTTP/2连接池根据步骤S1013获得所有HTTP/2连接对象处理获得,在内存中以HashMap存储,其中HashMap的键为上游信息,值为HTTP/2连接对象;The HTTP/2 connection pool obtains all HTTP/2 connection objects according to step S1013 and stores them in a HashMap in memory, wherein the key of the HashMap is the upstream information and the value is the HTTP/2 connection object;
步骤S1015,HTTP/2连接池保存到内存。Step S1015: The HTTP/2 connection pool is saved to the memory.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述步骤S103中,负载模块解析HTTP/2请求报文,解析HTTP/2请求报文是指获取HTTP/2请求报文的请求体,然后将请求体转换成JSON对象,JSON对象是指JSON字符串反序列化后在代码中的对象。The method for call transaction load balancing based on 5G new calls is characterized in that in step S103, the load module parses the HTTP/2 request message. Parsing the HTTP/2 request message refers to obtaining the request body of the HTTP/2 request message, and then converting the request body into a JSON object. The JSON object refers to the object in the code after the JSON string is deserialized.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述步骤S104中负载模块根据事务标识获取策略获取事务标识,并根据事务标识实现负载均衡,具体实施过程如下:The method for call transaction load balancing based on 5G new calls is characterized in that in step S104, the load module obtains the transaction identifier according to the transaction identifier acquisition strategy, and implements load balancing according to the transaction identifier. The specific implementation process is as follows:
步骤S1041,根据事务标识获取策略获取事务标识;Step S1041, obtaining a transaction identifier according to a transaction identifier obtaining strategy;
根据事务标识获取策略获取事务标识指遍历内存中的事务标识获取策略获取JSONPATH字符串,然后使用JSONPATH去匹配步骤S103获得JSON对象,如果匹配则跳出循环,并返回事务标识,如果未匹配则继续遍历,如果均未匹配,则结束;Acquiring the transaction identifier according to the transaction identifier acquisition strategy refers to traversing the transaction identifier acquisition strategy in the memory to obtain the JSONPATH string, and then using the JSONPATH to match the JSON object obtained in step S103, if it matches, jumping out of the loop and returning the transaction identifier, if it does not match, continuing to traverse, if it does not match, then ending;
步骤S1042,是否获取到事务标识,如果否则进入步骤S1043,如果是则进入步骤S1044;Step S1042, whether the transaction identifier is obtained, if not, proceed to step S1043, if yes, proceed to step S1044;
步骤S1043,从HTTP/2连接池随机获取HTTP/2连接对象;Step S1043, randomly obtaining an HTTP/2 connection object from the HTTP/2 connection pool;
从HTTP/2连接池随机获取HTTP/2连接对象指遍历内存中的HTTP/2连接池获得所有的上游信息,并将所有上游信息加入到一个List,List进行随机打乱后,获取List的第一个上游信息,然后根据上游信息从内存中的HTTP/2连接池中获得HTTP/2连接对象;Randomly obtaining an HTTP/2 connection object from the HTTP/2 connection pool means traversing the HTTP/2 connection pool in memory to obtain all upstream information, adding all upstream information to a List, randomly shuffling the List, obtaining the first upstream information in the List, and then obtaining the HTTP/2 connection object from the HTTP/2 connection pool in memory based on the upstream information;
步骤S1044,以事务标识为主键从事务缓存中获取HTTP/2连接对象;Step S1044, obtaining the HTTP/2 connection object from the transaction cache using the transaction identifier as the primary key;
事务缓存在内存中以HashMap存储,其中HashMap的键为事务标识,值为HTTP/2连接对象;The transaction cache is stored in memory as a HashMap, where the key of the HashMap is the transaction identifier and the value is the HTTP/2 connection object;
步骤S1045,是否获取到HTTP/2连接对象,如果否则进入步骤S1046,如果是则进入步骤S1048;Step S1045, whether the HTTP/2 connection object is obtained, if not, proceed to step S1046, if yes, proceed to step S1048;
步骤S1046,从HTTP/2连接池随机获取HTTP/2连接对象;Step S1046, randomly obtaining an HTTP/2 connection object from the HTTP/2 connection pool;
步骤S1047,以事务标识为主键,HTTP/2连接对象为值保存到事务缓存;Step S1047, using the transaction identifier as the primary key and the HTTP/2 connection object as the value to save to the transaction cache;
步骤S1048,转发HTTP/2请求报文到对应上游,对应上游指使用步骤S1043获得的上游信息对应的上游;Step S1048, forwarding the HTTP/2 request message to the corresponding upstream, where the corresponding upstream refers to the upstream corresponding to the upstream information obtained in step S1043;
步骤S1049,接收上游的HTTP/2应答报文。Step S1049, receiving the upstream HTTP/2 response message.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述步骤S101独立于呼叫事务请求负载过程,步骤S101的主要作用是将配置文件转换为步骤S104执行时所需的数据,所述呼叫事务请求负载过程是指步骤S102负载模块接收用户发送的HTTP/2请求报文。The method for call transaction load balancing based on 5G new calls is characterized in that step S101 is independent of the call transaction request load process, and the main function of step S101 is to convert the configuration file into the data required for the execution of step S104. The call transaction request load process refers to step S102 in which the load module receives the HTTP/2 request message sent by the user.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述步骤S101中配置模块对配置数据进行处理,所述配置数据进行处理实现在配置模块用于定时获取配置文件中的配置,生成事务标识获取策略、HTTP/2连接池后,存储到本装置内存,事务标识获取策略、HTTP/2连接池数据均来源于配置文件。The method for call transaction load balancing based on 5G new calls is characterized in that the configuration module in step S101 processes the configuration data, and the configuration data is processed to implement the configuration module for periodically obtaining the configuration in the configuration file, generating the transaction identifier acquisition strategy and HTTP/2 connection pool, and storing them in the memory of the device. The transaction identifier acquisition strategy and HTTP/2 connection pool data are both derived from the configuration file.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述事务标识获取策略负责从HTTP/2请求报文中获取事务标识的策略的配置,根据配置文件处理获得;The method for call transaction load balancing based on 5G new calls is characterized in that the transaction identifier acquisition strategy is responsible for configuring a strategy for acquiring a transaction identifier from an HTTP/2 request message, and is obtained according to a configuration file;
所述事务标识是指一个呼叫的唯一标识,一个呼叫包含多条信令消息并使用事务标识来进行关联;The transaction identifier is a unique identifier of a call. A call includes multiple signaling messages and uses the transaction identifier to associate them.
所述HTTP/2连接池负责HTTP/2连接池的管理,在配置文件处理获得所有上游信息之后,创建获得。The HTTP/2 connection pool is responsible for the management of the HTTP/2 connection pool and is created after the configuration file is processed to obtain all upstream information.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述信令消息是指在通信系统中用于控制和管理通信会话的消息.The method for call transaction load balancing based on 5G new calls is characterized in that the signaling message refers to a message used to control and manage communication sessions in a communication system.
所述的一种基于5G新通话的呼叫事务负载均衡的方法,其特征在于所述上游信息指访问上游的URL。The method for call transaction load balancing based on 5G new calls is characterized in that the upstream information refers to the URL for accessing the upstream.
本发明通过JSONPATH获取HTTP/2请求报文中的呼叫标识来关联上游,将相同呼叫标识的信令消息,转发到同一个上游。The present invention obtains the call identifier in the HTTP/2 request message through JSONPATH to associate the upstream, and forwards the signaling message with the same call identifier to the same upstream.
本发明围绕5G新通话大区之间呼叫事务负载均衡展开,通过JSONPATH获取HTTP/2请求报文中的呼叫标识来关联上游,将相同呼叫标识的信令消息,转发到同一个上游作为创新点,实现了5G新通话大区之间呼叫事务的负载均衡。The present invention revolves around the load balancing of call transactions between 5G new call areas. It obtains the call identifier in the HTTP/2 request message through JSONPATH to associate the upstream, and forwards the signaling messages with the same call identifier to the same upstream as the innovation point, thereby realizing the load balancing of call transactions between 5G new call areas.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本发明负载均衡装置的结构图;FIG1 is a structural diagram of a load balancing device of the present invention;
图2为本发明的流程图;Fig. 2 is a flow chart of the present invention;
图3为配置模块处理流程图;FIG3 is a flow chart of the configuration module processing;
图4为负载模块获取事务标识并根据事务标识将HTTP/2请求报文转发到上游的流程图。FIG4 is a flow chart showing the load module obtaining a transaction identifier and forwarding an HTTP/2 request message to an upstream according to the transaction identifier.
具体实施方式DETAILED DESCRIPTION
下面结合说明书附图对本发明作进一步说明:The present invention will be further described below in conjunction with the accompanying drawings:
本发明为基于5G新通话的呼叫事务负载均衡的装置和方法,主要为了解决现有负载均衡器不支持将相同呼叫标识的信令消息,转发到同一个上游的问题。The present invention provides a device and method for call transaction load balancing based on 5G new calls, which is mainly intended to solve the problem that the existing load balancer does not support forwarding signaling messages with the same call identifier to the same upstream.
此外,下面所描述的本发明各个实施方式中所涉及到的技术特征只要彼此之间未构成冲突就可以相互组合。In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
实施例一Embodiment 1
根据本发明实施例,提供一种基于5G新通话的呼叫事务负载均衡的方法。本发明的方法应用在本发明所述基于5G新通话的呼叫事务负载均衡的装置。According to an embodiment of the present invention, a method for call transaction load balancing based on 5G new calls is provided. The method of the present invention is applied to the device for call transaction load balancing based on 5G new calls described in the present invention.
图2所示是本发明实施例一提供的一种基于5G新通话的呼叫事务负载均衡的方法流程图,所述方法应用与基于5G新通话的呼叫事务负载均衡的装置。FIG2 is a flow chart of a method for call transaction load balancing based on 5G new calls provided in Embodiment 1 of the present invention. The method is applied to a device for call transaction load balancing based on 5G new calls.
本发明的实现方法详见下述S101-S105,具体为:The implementation method of the present invention is detailed in the following S101-S105, specifically:
步骤S101,配置模块对配置数据进行处理。Step S101: the configuration module processes the configuration data.
步骤S101独立于呼叫事务请求负载过程,它的主要作用是将配置文件转换为步骤S104执行时所需的数据。Step S101 is independent of the call transaction request load process, and its main function is to convert the configuration file into the data required for the execution of step S104.
呼叫事务请求负载过程指的步骤S102负载模块接收用户发送的HTTP/2请求报文;步骤S103负载模块解析所述HTTP/2请求报文;步骤S104负载模块获取事务标识并根据所述事务标识将所述HTTP/2请求报文转发到上游;步骤S105负载模块将上游的HTTP/2应答报文转发给用户的过程。The call transaction request load process refers to the process in which the load module receives the HTTP/2 request message sent by the user in step S102; the load module parses the HTTP/2 request message in step S103; the load module obtains the transaction identifier and forwards the HTTP/2 request message to the upstream according to the transaction identifier in step S104; and the load module forwards the upstream HTTP/2 response message to the user in step S105.
在本实施例中配置数据进行处理实现在配置模块用于定时获取配置文件中的配置,生成事务标识获取策略、HTTP/2连接池后,存储到本装置内存。In this embodiment, the configuration data is processed and implemented in the configuration module for periodically obtaining the configuration in the configuration file, generating a transaction identifier acquisition strategy and an HTTP/2 connection pool, and then storing them in the memory of the device.
事务标识获取策略、HTTP/2连接池数据均来源于配置文件。The transaction identifier acquisition strategy and HTTP/2 connection pool data are both derived from the configuration file.
其中,事务标识获取策略负责从HTTP/2请求报文中获取事务标识的策略的配置,根据配置文件处理获得。The transaction identifier acquisition strategy is responsible for configuring the strategy for acquiring the transaction identifier from the HTTP/2 request message, which is obtained according to the configuration file.
事务标识指的一个呼叫的唯一标识,一个呼叫包含多条信令消息并使用事务标识来进行关联。A transaction identifier is a unique identifier of a call. A call contains multiple signaling messages and is associated using the transaction identifier.
信令消息指在通信系统中用于控制和管理通信会话的消息。Signaling messages refer to messages used in a communication system to control and manage communication sessions.
HTTP/2连接池负责HTTP/2连接池的管理,在配置文件处理获得所有上游信息之后,创建获得。The HTTP/2 connection pool is responsible for the management of the HTTP/2 connection pool, which is created after the configuration file processes all upstream information.
上游信息指访问上游的URL,比如https://10.0.0.10:8080。Upstream information refers to the URL for accessing the upstream, such as https://10.0.0.10:8080.
步骤S101具体实施过程如图3所示。The specific implementation process of step S101 is shown in FIG3 .
步骤S1011,配置文件解析:Step S1011, configuration file parsing:
配置文件解析通过定时5s重复获取配置文件中的配置,解析后生成事务标识获取策略、HTTP/2连接池,其中配置文件的格式为YAML。Configuration file parsing repeatedly obtains the configuration in the configuration file every 5 seconds, and generates a transaction identifier acquisition strategy and HTTP/2 connection pool after parsing. The format of the configuration file is YAML.
步骤S1012,事务标识获取策略保存到内存:Step S1012: The transaction identification acquisition strategy is saved to the memory:
事务标识获取策略根据配置文件中的identityPolicies进行处理获得,在内存中以List存储,值为JSONPATH字符串。The transaction identity acquisition policy is obtained by processing the identityPolicies in the configuration file and stored in the memory as a List, with the value being a JSONPATH string.
步骤S1013,根据上游信息创建HTTP/2连接对象:Step S1013, create an HTTP/2 connection object according to the upstream information:
HTTP/2连接对象指的通过IP和端口创建的HTTP/2会话在代码中的对象;The HTTP/2 connection object refers to the object in the code of the HTTP/2 session created by IP and port;
上游信息根据配置文件中的upstreams进行处理获得,获取所有上游信息后,分别创建HTTP/2的连接并获得HTTP/2连接对象。The upstream information is obtained by processing the upstreams in the configuration file. After obtaining all the upstream information, HTTP/2 connections are created and HTTP/2 connection objects are obtained.
步骤S1014,HTTP/2连接对象保存到连接池:Step S1014, the HTTP/2 connection object is saved to the connection pool:
HTTP/2连接池根据步骤S1013获得所有HTTP/2连接对象处理获得,在内存中以HashMap存储,其中HashMap的键为上游信息,值为HTTP/2连接对象。The HTTP/2 connection pool obtains all HTTP/2 connection objects according to step S1013 and stores them in a HashMap in the memory, wherein the key of the HashMap is the upstream information and the value is the HTTP/2 connection object.
步骤S1015,HTTP/2连接池保存到内存。Step S1015: The HTTP/2 connection pool is saved to the memory.
步骤S102,负载模块接收用户发送的HTTP/2请求报文。Step S102: The load module receives an HTTP/2 request message sent by a user.
步骤S103,负载模块解析HTTP/2请求报文。Step S103: the load module parses the HTTP/2 request message.
解析HTTP/2请求报文指获取HTTP/2请求报文的请求体,然后将请求体转换成JSON对象,Parsing HTTP/2 request messages means obtaining the request body of HTTP/2 request messages and then converting the request body into a JSON object.
JSON对象指的JSON字符串反序列化后在代码中的对象。JSON object refers to the object in the code after the JSON string is deserialized.
步骤S104,负载模块获取事务标识并根据事务标识将HTTP/2请求报文转发到上游。Step S104: The load module obtains the transaction identifier and forwards the HTTP/2 request message to the upstream according to the transaction identifier.
步骤S104负载模块根据事务标识获取策略获取事务标识,并根据事务标识实现负载均衡,具体实施过程如图4:Step S104: The load module obtains the transaction identifier according to the transaction identifier acquisition strategy, and implements load balancing according to the transaction identifier. The specific implementation process is shown in FIG4 :
步骤S1041,根据事务标识获取策略获取事务标识:Step S1041, obtaining a transaction identifier according to a transaction identifier obtaining strategy:
根据事务标识获取策略获取事务标识指遍历内存中的事务标识获取策略获取JSONPATH字符串,然后使用JSONPATH去匹配步骤S103获得JSON对象,如果匹配则跳出循环,并返回事务标识,如果未匹配则继续遍历,如果均未匹配,则结束;Acquiring the transaction identifier according to the transaction identifier acquisition strategy refers to traversing the transaction identifier acquisition strategy in the memory to obtain the JSONPATH string, and then using the JSONPATH to match the JSON object obtained in step S103, if it matches, jumping out of the loop and returning the transaction identifier, if it does not match, continuing to traverse, if it does not match, then ending;
步骤S1042,是否获取到事务标识,如果否则进入步骤S1043,如果是则进入步骤S1044;Step S1042, whether the transaction identifier is obtained, if not, proceed to step S1043, if yes, proceed to step S1044;
步骤S1043,从HTTP/2连接池随机获取HTTP/2连接对象;Step S1043, randomly obtaining an HTTP/2 connection object from the HTTP/2 connection pool;
从HTTP/2连接池随机获取HTTP/2连接对象指遍历内存中的HTTP/2连接池获得所有的上游信息,并将所有上游信息加入到一个List,List进行随机打乱后,获取List的第一个上游信息,然后根据上游信息从内存中的HTTP/2连接池中获得HTTP/2连接对象;Randomly obtaining an HTTP/2 connection object from the HTTP/2 connection pool means traversing the HTTP/2 connection pool in memory to obtain all upstream information, adding all upstream information to a List, randomly shuffling the List, obtaining the first upstream information in the List, and then obtaining the HTTP/2 connection object from the HTTP/2 connection pool in memory based on the upstream information;
步骤S1044,以事务标识为主键从事务缓存中获取HTTP/2连接对象;Step S1044, obtaining the HTTP/2 connection object from the transaction cache using the transaction identifier as the primary key;
事务缓存在内存中以HashMap存储,其中HashMap的键为事务标识,值为HTTP/2连接对象;The transaction cache is stored in memory as a HashMap, where the key of the HashMap is the transaction identifier and the value is the HTTP/2 connection object;
步骤S1045,是否获取到HTTP/2连接对象,如果否则进入步骤S1046,如果是则进入步骤S1048;Step S1045, whether the HTTP/2 connection object is obtained, if not, proceed to step S1046, if yes, proceed to step S1048;
步骤S1046,从HTTP/2连接池随机获取HTTP/2连接对象;步骤S1046与步骤S1043相同;Step S1046, randomly obtaining an HTTP/2 connection object from the HTTP/2 connection pool; Step S1046 is the same as step S1043;
步骤S1047,以事务标识为主键,HTTP/2连接对象为值保存到事务缓存;Step S1047, using the transaction identifier as the primary key and the HTTP/2 connection object as the value to save to the transaction cache;
步骤S1048,转发HTTP/2请求报文到对应上游;Step S1048, forwarding the HTTP/2 request message to the corresponding upstream;
对应上游指使用步骤S1043获得的上游信息对应的上游;The corresponding upstream refers to the upstream corresponding to the upstream information obtained in step S1043;
步骤S1049,接收上游的HTTP/2应答报文;Step S1049, receiving an upstream HTTP/2 response message;
步骤S105,负载模块将上游的HTTP/2应答报文转发给用户。Step S105: The load module forwards the upstream HTTP/2 response message to the user.
实施例二Embodiment 2
根据本发明实施例,提供一种基于5G新通话的呼叫事务负载均衡的装置,如图1所示,包括配置模块、负载模块。According to an embodiment of the present invention, a device for call transaction load balancing based on 5G new calls is provided, as shown in FIG1 , including a configuration module and a load module.
配置模块:负责对配置数据进行处理;Configuration module: responsible for processing configuration data;
负载模块:负责根接收用户发送的HTTP/2请求报文,然后解析HTTP/2请求报文,再获取事务标识并根据事务标识将HTTP/2请求报文转发到上游,最后将上游的HTTP/2应答报文转发给用户。Load module: responsible for receiving the HTTP/2 request message sent by the user, parsing the HTTP/2 request message, obtaining the transaction identifier and forwarding the HTTP/2 request message to the upstream according to the transaction identifier, and finally forwarding the upstream HTTP/2 response message to the user.
本发明支持对呼叫事务级别的负载均衡,支持同一个呼叫的所有信令消息发送到同一个上游,参阅实施例一中呼叫事务请求负载过程的描述,参阅步骤S102至步骤S105。The present invention supports load balancing at the call transaction level, and supports sending all signaling messages of the same call to the same upstream. Please refer to the description of the call transaction load request process in the first embodiment, and refer to steps S102 to S105.
现有开源的负载均衡器比如Nginx不支持事务级别的负载均衡,它只能进行消息级别的负载均衡,无法将同一个呼叫的信令消息发送到同一个上游。本发明的装置及方法被主要用于接收用户发出的HTTP/2请求,并根据JSONPATH获取请求报文中的事务标识将这些请求转发给上游,实现同一个呼叫的信令消息发送到同一个上游,能够有效地解决开源的负载均衡器在不支持事务级别负载的问题。Existing open source load balancers such as Nginx do not support transaction-level load balancing. They can only perform message-level load balancing and cannot send signaling messages of the same call to the same upstream. The device and method of the present invention are mainly used to receive HTTP/2 requests issued by users, and forward these requests to the upstream according to the transaction identifier in the request message obtained by JSONPATH, so as to send signaling messages of the same call to the same upstream, which can effectively solve the problem that open source load balancers do not support transaction-level load balancing.
注释:Notes:
5G(第五代移动通信技术)是最新一代的移动通信技术,相较于前一代 4G(LTE),5G 提供了更快的数据传输速度、更低的延迟和更高的连接密度。5G 技术的设计目标是支持未来的移动通信需求,包括物联网(IoT)、增强现实(AR)、虚拟现实(VR)、自动驾驶等应用。5G (fifth generation mobile communication technology) is the latest generation of mobile communication technology. Compared with the previous generation 4G (LTE), 5G provides faster data transmission speeds, lower latency and higher connection density. The design goal of 5G technology is to support future mobile communication needs, including the Internet of Things (IoT), augmented reality (AR), virtual reality (VR), autonomous driving and other applications.
YAML(YAML Ain’t Markup Language)是一种人类可读的数据序列化格式。YAML (YAML Ain’t Markup Language) is a human-readable data serialization format.
HashMap是一种存储键值对的数据结构,它通过将键映射到值来实现快速的数据查找。HashMap is a data structure that stores key-value pairs and enables fast data lookup by mapping keys to values.
JSON是一种轻量级的数据交换格式,全称为JavaScript Object Notation(JavaScript对象表示法)。JSON is a lightweight data exchange format, the full name is JavaScript Object Notation.
JSONPATH是一种用于解析和查询 JSON 数据的工具,类似于 XPath 用于 XML。JsonPath 允许通过一种简洁的语法来提取 JSON 文档中的数据。JSONPATH is a tool for parsing and querying JSON data, similar to XPath for XML. JsonPath allows extracting data from JSON documents through a concise syntax.
URL(Uniform Resource Locator,统一资源定位符)是指用于在互联网或其他网络中定位资源的地址。它是一个特定格式的字符串,包含了访问资源所需的信息。URL 通常用于访问网页、文件、图像、视频等各种类型的资源。URL (Uniform Resource Locator) is an address used to locate resources on the Internet or other networks. It is a string in a specific format that contains the information needed to access resources. URLs are usually used to access various types of resources such as web pages, files, images, videos, etc.
List是一种线性数据结构,用于存储一组有序的元素。List is a linear data structure used to store an ordered set of elements.
HTTP/2(Hypertext Transfer Protocol version 2)是HTTP协议的第二个主要版本。HTTP/2 (Hypertext Transfer Protocol version 2) is the second major version of the HTTP protocol.
IP(Internet Protocol)是互联网协议的缩写,它是互联网上的一种网络协议,用于在网络中传输数据包。IP协议定义了网络设备之间的通信规则和地址分配方式。IP (Internet Protocol) is the abbreviation of Internet Protocol. It is a network protocol on the Internet, used to transmit data packets in the network. The IP protocol defines the communication rules and address allocation method between network devices.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411363382.4A CN119299455A (en) | 2024-09-27 | 2024-09-27 | A device and method for call transaction load balancing based on 5G new calls |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411363382.4A CN119299455A (en) | 2024-09-27 | 2024-09-27 | A device and method for call transaction load balancing based on 5G new calls |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN119299455A true CN119299455A (en) | 2025-01-10 |
Family
ID=94159059
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411363382.4A Pending CN119299455A (en) | 2024-09-27 | 2024-09-27 | A device and method for call transaction load balancing based on 5G new calls |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119299455A (en) |
-
2024
- 2024-09-27 CN CN202411363382.4A patent/CN119299455A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109067914B (en) | web service proxy method, device, equipment and storage medium | |
| JP6915027B2 (en) | Livestreaming segmentation methods, equipment and systems | |
| US8898336B2 (en) | Content conversion system and content conversion server | |
| US8938502B2 (en) | Subscriber device and subscription management that supports real-time communication | |
| JP4312962B2 (en) | Internet client server multiplexer | |
| CN107231402A (en) | HTTP request processing method, apparatus and system | |
| CN110413418B (en) | Cache synchronization device and method, cache synchronization system and electronic equipment | |
| US7509422B2 (en) | System and method for locating web services | |
| CN101207568A (en) | Multi-protocol adapter and method for implementing adaptation processing for various services | |
| Heinzl et al. | Flex-swa: Flexible exchange of binary data based on soap messages with attachments | |
| CN115242882A (en) | A method and device for accessing k8s container environment based on transport layer routing | |
| US11516280B2 (en) | Configuration change processing for content request handling | |
| CN101902458B (en) | Interprocess communication method across host machine, device thereof and system thereof | |
| CN113810464B (en) | Access method, web cache proxy system and electronic device | |
| US11929933B2 (en) | Ephemeral data stream routing service | |
| CN114189358B (en) | Service security policy management method based on private cloud | |
| CN114025005B (en) | Data communication method, system, electronic equipment and storage medium | |
| US7861001B2 (en) | Transport independent redirection | |
| JP2014010703A (en) | System that supports cooperation of information processing systems, device, and cooperation method | |
| CN119299455A (en) | A device and method for call transaction load balancing based on 5G new calls | |
| CN117579288A (en) | Handshake multiplexing method, device and computer readable medium | |
| CN119484631B (en) | Resource acquisition method and equipment | |
| Heinzl et al. | A web service communication policy for describing non-standard application requirements | |
| CN113760445B (en) | A service switching method and device | |
| CN117041340B (en) | Signaling negotiation, data communication method and device, electronic 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 |