A method and related apparatus for managing session connections

By using master process parsing and consistent hashing algorithms to distribute session connections in cloud video scenarios to target execution processes, the problem of inaccurate binding of multiple connections is solved, efficient session connection management is achieved, and the stability and performance of cloud video services are improved.

CN116567053BActive Publication Date: 2025-11-14TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210111694.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2025-11-14
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

In cloud video scenarios, due to the randomness of lock contention during multi-connection distribution, it is impossible to guarantee that multiple connections of the same session will be bound to the same process, affecting the accuracy of session connection distribution.

Method used

The main control process detects multiple session connections, parses their feature information and calculates feature hash values, and uses a consistent hashing algorithm to distribute the session connections to the target execution process. Combined with business layering and functional division, it achieves precise binding of multiple connections within a session.

Benefits of technology

It improves the accuracy of session connection distribution, optimizes resource utilization, reduces resource waste in shared memory management and inter-worker communication, and enhances service performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116567053B_ABST
    Figure CN116567053B_ABST
Patent Text Reader

Abstract

This application discloses a method and related apparatus for managing session connections. The method involves acquiring multiple session connections detected by a master control process; then, the master control process parses the feature information of the session connections to determine the feature hash value corresponding to each session connection; and further, by parsing the feature hash value, the master control process distributes multiple target connections belonging to a target session to a target execution process. The target execution process then receives business data transmitted through the target connections and executes the target session based on the business data. This constructs a management architecture that utilizes the master control process for connection distribution management and the execution processes for business processing. By matching connections based on their feature information, the method accurately implements the binding process of multiple connections within a session, improving the accuracy of session connection distribution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for managing session connections. Background Technology

[0002] With the advent of the big data era, the use of various types of data is becoming increasingly widespread. Taking cloud video as an example, cloud video content is integrated in cloud video servers, which then provide video services to users' terminal devices, such as video-on-demand, live streaming, video calls, and cloud gaming.

[0003] In cloud video scenarios, multiple connections need to be distributed to the same session. This can be achieved by having multiple execution processes jointly detect the same port and establish connections by competing for a lock.

[0004] However, in scenarios involving multiple connection distribution, a large number of connections need to be processed by the execution process, and due to the randomness of lock contention, it is impossible to guarantee that multiple connections of the same session will be bound to the same process, affecting the accuracy of session connection distribution. Summary of the Invention

[0005] In view of this, this application provides a session connection management method that can effectively improve the accuracy of session distribution.

[0006] The first aspect of this application provides a session connection management method, which can be applied to a system or program in a terminal device that includes session connection management functions, specifically including:

[0007] Acquire multiple session connections detected by the main control process;

[0008] The main control process parses the feature information of the session connection to determine the feature hash value corresponding to the session connection;

[0009] The main control process parses the feature hash value, collects multiple target connections belonging to the target session in the session connection, and distributes the target connections to the target execution process corresponding to the target session;

[0010] The target execution process receives the service data transmitted by the target connection to execute the target session based on the service data.

[0011] Optionally, in some possible implementations of this application, the step of parsing the feature hash value through the main control process and distributing the target connection in the session connection to the target execution process includes:

[0012] The main control process parses the feature hash value and uses at least two session connections as data nodes to form a consistent hash node ring.

[0013] The target position on the consistent hash node ring corresponding to the target session is calculated according to the consistent hash algorithm.

[0014] Starting from the target location, search along the consistent hash node ring, and associate the encountered data nodes to determine the target connection corresponding to the target session;

[0015] The target connection is distributed to the target execution process corresponding to the target session.

[0016] Optionally, in some possible implementations of this application, the step of receiving service data transmitted by the target connection based on the target execution process, and executing the target session according to the service data, includes:

[0017] Determine the initial connection associated with the target connection;

[0018] The socket corresponding to the initial connection is parsed to obtain the port descriptor corresponding to the initial connection;

[0019] The data address is determined based on the port descriptor;

[0020] Data migration is performed based on the data address, so as to receive the business data transmitted by the target connection based on the target execution process;

[0021] The target session is executed based on the business data.

[0022] Optionally, in some possible implementations of this application, the method further includes:

[0023] Determine the protocol type corresponding to the initial connection;

[0024] If the protocol type indicates that the socket corresponding to the initial connection has connection characteristics, then the socket corresponding to the initial connection is parsed to obtain the double-ended quadruple information corresponding to the initial connection.

[0025] Data migration is performed based on the dual-end quadruple information so that the target execution process can receive the business data transmitted by the target connection.

[0026] The target session is executed based on the business data.

[0027] Optionally, in some possible implementations of this application, the method further includes:

[0028] If the protocol type indicates that the initial connection has a connectionless characteristic, then the double-ended quadruple information corresponding to the initial connection is bound in the main control process;

[0029] In response to the determination of the target session, the dual-end quadruple information corresponding to the initial connection is extracted from the master control process;

[0030] Data migration is performed based on the dual-end quadruple information corresponding to the initial connection, so as to receive the service data transmitted by the target connection based on the target execution process;

[0031] The target session is executed based on the business data.

[0032] Optionally, in some possible implementations of this application, the step of receiving service data transmitted by the target connection based on the target execution process, and executing the target session according to the service data, includes:

[0033] The target execution process receives the service data transmitted by the target connection and determines the order information of the target connection for the target session.

[0034] If the order information indicates that the target connection is the first connection, then the target session is created;

[0035] The target session is executed based on the business data.

[0036] Optionally, in some possible implementations of this application, the network resource management method is applied to a blockchain device, where the blockchain device is a node in the blockchain.

[0037] A second aspect of this application provides a session connection management device, comprising:

[0038] The acquisition unit is used to acquire multiple session connections detected by the main control process.

[0039] The determining unit is used to parse the feature information of the session connection through the main control process and determine the feature hash value corresponding to the session connection;

[0040] The determining unit is further configured to parse the feature hash value through the main control process, collect multiple target connections belonging to the target session in the session connection, and distribute the target connections to the target execution process corresponding to the target session;

[0041] The management unit is used to receive business data corresponding to the target session based on the target execution process, so as to execute the target session according to the business data.

[0042] Optionally, in some possible implementations of this application, the determining unit is specifically used to parse the feature hash value through the main control process, and to form a consistent hash node ring with at least two session connections as data nodes;

[0043] The determining unit is specifically used to calculate the target position on the consistent hash node ring corresponding to the target session according to the consistent hash algorithm.

[0044] The determining unit is specifically used to search along the consistent hash node ring starting from the target location, and to associate the encountered data nodes to determine the target connection corresponding to the target session.

[0045] The determining unit is specifically used to distribute the target connection to the target execution process corresponding to the target session.

[0046] Optionally, in some possible implementations of this application, the management unit is specifically used to determine the initial connection associated with the target connection;

[0047] The management unit is specifically used to parse the socket corresponding to the initial connection to obtain the port descriptor corresponding to the initial connection;

[0048] The management unit is specifically used to determine the data address based on the port descriptor;

[0049] The management unit is specifically used to perform data migration based on the data address, so as to receive the business data transmitted by the target connection based on the target execution process;

[0050] The management unit is specifically used to execute the target session based on the business data.

[0051] Optionally, in some possible implementations of this application, the management unit is specifically used to determine the protocol type corresponding to the initial connection;

[0052] The management unit is specifically used to parse the socket corresponding to the initial connection if the protocol type indicates that the socket corresponding to the initial connection has connection characteristics, so as to obtain the double-ended quad tuple information corresponding to the initial connection.

[0053] The management unit is specifically used to perform data migration based on the dual-end quadruple information, so as to receive the business data transmitted by the target connection through the target execution process;

[0054] The management unit is specifically used to execute the target session based on the business data.

[0055] Optionally, in some possible implementations of this application, the management unit is specifically used to bind the double-ended quadruple information corresponding to the initial connection in the main control process if the protocol type indicates that the initial connection has no connection characteristics;

[0056] The management unit is specifically used to extract the dual-end quadruple information corresponding to the initial connection from the main control process in response to the determination of the target session;

[0057] The management unit is specifically used to perform data migration based on the dual-end quadruple information corresponding to the initial connection, so as to receive the service data transmitted by the target connection based on the target execution process;

[0058] The management unit is specifically used to execute the target session based on the business data.

[0059] Optionally, in some possible implementations of this application, the management unit is specifically used to receive the service data transmitted by the target connection based on the target execution process, and to determine the order information of the target connection for the target session;

[0060] The management unit is specifically configured to create the target session if the sequence information indicates that the target connection is the first connection.

[0061] The management unit is specifically used to execute the target session based on the business data.

[0062] A third aspect of this application provides a computer device, comprising: a memory, a processor, and a bus system; the memory is used to store program code; the processor is used to execute the session connection management method described in the first aspect or any one of the first aspects according to instructions in the program code.

[0063] A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the session connection management method described in the first aspect or any one of the first aspects.

[0064] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the session connection management method provided in the first aspect or various optional implementations thereof.

[0065] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0066] By acquiring multiple session connections detected by the main control process, parsing the characteristic information of the session connections to determine the corresponding characteristic hash value, and then parsing the characteristic hash value to collect multiple target connections belonging to the target session, the main control process collects these target connections and distributes them to the target execution process corresponding to the target session. The target execution process then receives the business data transmitted by the target connection and executes the target session based on the business data. This constructs a management architecture that uses the main control process for connection distribution management and the execution process for business processing. By matching connections based on their characteristic information, the system accurately implements the process of binding multiple connections within a session, improving the accuracy of session connection distribution. Attached Figure Description

[0067] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0068] Figure 1 A network architecture diagram for the management system running on session connections;

[0069] Figure 2 A flowchart illustrating the management process of a session connection is provided in this application embodiment.

[0070] Figure 3 A flowchart illustrating a session connection management method provided in an embodiment of this application;

[0071] Figure 4 A schematic diagram illustrating a scenario for a session connection management method provided in an embodiment of this application;

[0072] Figure 5 A schematic diagram illustrating a scenario for another session connection management method provided in an embodiment of this application;

[0073] Figure 6 A flowchart illustrating another session connection management method provided in this application embodiment;

[0074] Figure 7 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application;

[0075] Figure 8 This application provides a schematic diagram of the structure of a server according to an embodiment of the present application.

[0076] Figure 9AA data sharing system provided in this application embodiment;

[0077] Figure 9B This application provides an embodiment of a blockchain block composition;

[0078] Figure 9C This application provides input information for a blockchain node in an embodiment. Detailed Implementation

[0079] This application provides a method and related apparatus for managing session connections, which can be applied to systems or programs in terminal devices that include session connection management functions. The method involves acquiring multiple session connections detected by a main control process; then, the main control process parses the feature information of the session connections to determine the feature hash value corresponding to each session connection; further, the main control process parses the feature hash value and distributes the target connection within the session connection to a target execution process. The target execution process is associated with the target session, and the target connection belongs to the target session. Subsequently, the target execution process receives the business data transmitted by the target connection and executes the target session according to the business data. This constructs a management architecture that utilizes the main control process for connection distribution management and the execution processes for business processing. By matching connections through their feature information, the method accurately realizes the binding of multiple connections within a session, improving the accuracy of session connection distribution.

[0080] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding to,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0081] First, some terms that may appear in the embodiments of this application will be explained.

[0082] Cloud video: Video streaming services with content integrated in the cloud, such as video-on-demand, live streaming, video calls, cloud gaming, etc.

[0083] Cloud video server: A server built in the cloud and used to transmit cloud video.

[0084] Session: Represents a user-level management unit. One user corresponds to one session, or multiple transport connections.

[0085] Transmission connection: At the transport layer, an end-to-end connection is established and acknowledged by both ends. It is the fundamental guarantee of reliable data transmission, such as a TCP connection.

[0086] Multiple connections: refers to the simultaneous creation of transport connections using transport protocols such as TCP and UDP to jointly ensure business operations.

[0087] Multi-connection distribution: refers to mapping multiple connections created within a user to the same user session to ensure transmission.

[0088] A socket is an abstraction of an endpoint for bidirectional communication between application processes on different hosts on a network. A socket represents one end of inter-process communication on the network, providing a mechanism for application-layer processes to exchange data using network protocols. In terms of its position, a socket connects to the application process above and the network protocol stack below; it is the interface through which applications communicate via network protocols and interact with the network protocol root.

[0089] It should be understood that the session connection management method provided in this application can be applied to systems or programs in terminal devices that include session connection management functions, such as connection management. Specifically, the session connection management system can run in systems such as... Figure 1 In the network architecture shown, such as Figure 1 The diagram shown illustrates the network architecture of the session connection management system. As can be seen, the system can manage session connections to multiple information sources, meaning that multiple connections are distributed on the server through triggering operations on the terminal side. This implies that... Figure 1 The document illustrates various terminal devices, which can be computer devices. In real-world scenarios, more or fewer types of terminal devices may participate in the session connection management process. The specific number and types depend on the actual scenario and are not limited here. Figure 1 The example shows one server, but in real-world scenarios, multiple servers can be involved, especially in scenarios involving multi-model training and interaction. The specific number of servers depends on the actual scenario.

[0090] In this embodiment, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, and the terminal and server can be connected to form a blockchain network; this application does not impose any restrictions.

[0091] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Based on the cloud computing business model, cloud technology encompasses network technology, information technology, integration technology, management platform technology, and application technology. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.

[0092] It is understood that the aforementioned session connection management system can run on a personal mobile terminal, such as as a connection management application, or it can run on a server, or it can run on a third-party device to provide session connection management in order to obtain the session connection management and processing results of the information source. Specifically, the session connection management system can run as a program on the aforementioned device, or it can run as a system component of the aforementioned device, or it can run as a cloud service program. The specific operating mode depends on the actual scenario and is not limited here.

[0093] With the advent of the big data era, the use of various types of data is becoming increasingly widespread. Taking cloud video as an example, cloud video content is integrated in cloud video servers, which then provide video services to users' terminal devices, such as video-on-demand, live streaming, video calls, and cloud gaming.

[0094] In cloud video scenarios, multiple connections need to be distributed to the same session. This can be achieved by having multiple execution processes jointly detect the same port and establish connections by competing for a lock.

[0095] However, in scenarios involving multiple connection distribution, a large number of connections need to be processed by the execution process, and due to the randomness of lock contention, it is impossible to guarantee that multiple connections of the same session will be bound to the same process, affecting the accuracy of session connection distribution.

[0096] Specifically, in native Nginx, the Master process is primarily responsible for synchronizing information between Worker processes, such as synchronizing Worker creation and destruction information to other normal Workers, and has spare processing power. Worker processes, on the other hand, are mainly responsible for connection acquisition and data forwarding. Therefore, the Master process is generally relatively idle, and already has domain sockets for communication with each Worker process. It is evident that, based on the native Nginx connection distribution framework, both shared memory and Worker-to-Worker communication methods are post-processing "patches," essentially adding server-side logic to the normal business logic, which impacts high-performance forwarding. Examples include shared memory synchronization, message synchronization when there are many Workers, and message processing issues. Meanwhile, the Master process is still responsible for simple synchronization with other processes, remaining relatively idle, which is a waste of resources.

[0097] In this embodiment, by optimizing resource utilization and modifying the native Nginx architecture, a novel architecture is proposed that fully utilizes the Master process for connection distribution and management, while the Worker process handles business processing. Through business layering and functional division, reasonable and efficient connection distribution is achieved without adding a large amount of additional server-side business. Based on object characteristic information, it efficiently binds multiple connections within a session to a unified process.

[0098] Specifically applied to, for example Figure 2 In the process framework for managing session connections shown, such as Figure 2 The diagram illustrates a session connection management process architecture provided in this embodiment of the application. It uses Nginx as a high-performance forwarding server and describes how multiple transmission connections are mapped to sessions during multi-channel transmission. On the video server, by modifying Nginx's native connection allocation method and combining it with the characteristic information of multi-channel users, information verification is uniformly performed in the Master process. Based on the verification results, different connections under the same user session are assigned to the same Worker process. This approach ensures that multiple connections within the same session correspond to the same process, avoiding the additional shared memory management and signal synchronization processes required when connections cross processes, thus improving the forwarding service performance under multi-channel conditions.

[0099] This embodiment can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, assisted driving, and vehicle networking (audio and video). User terminals using this embodiment in specific application scenarios include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, and in-vehicle terminals.

[0100] It is understood that the method provided in this application can be a program written as processing logic in a hardware system, or it can be a session connection management device, implemented in an integrated or external manner to achieve the aforementioned processing logic. As one implementation, the session connection management device acquires multiple session connections detected by the main control process; then, the main control process parses the characteristic information of the session connections to determine the characteristic hash value corresponding to the session connection; further, the main control process parses the characteristic hash value to distribute the target connection in the session connection to the target execution process. The target execution process is associated with the target session, and the target connection belongs to the target session; then, the target execution process receives the business data transmitted by the target connection to execute the target session according to the business data. This constructs a management architecture that utilizes the main control process for connection distribution management and the execution process for business processing, and accurately implements the process of binding multiple connections within a session by matching connections through their characteristic information, thus improving the accuracy of session connection distribution.

[0101] Based on the above process architecture, the session connection management method in this application will be described below. Please refer to [link / reference]. Figure 3 , Figure 3 The flowchart illustrates a session connection management method provided in this application embodiment. This management method can be executed by a participant, and this application embodiment includes at least the following steps:

[0102] 301. Obtain multiple session connections detected by the main control process.

[0103] In this embodiment, the master process is the main control process. In native Nginx, the master process is mainly responsible for synchronizing information between execution processes (Workers), such as synchronizing the creation and destruction information of Workers to other normal Workers, as well as some signal processing. This embodiment can be applied to cloud video scenarios and is a modification of the native Nginx connection distribution framework. That is, the master is used as a connection distribution master node to distribute multiple connections. The specific distribution process is described below.

[0104] Specifically, from an application scenario perspective, this embodiment can be applied to cloud video services, such as interactive live streaming and cloud gaming based on video streaming. Cloud video services have very high requirements for service quality. This embodiment can also be applied to cloud gaming, which requires both high bitrate and ultra-low latency in order to bring players a streaming game service with high-quality visuals and a good operating feel.

[0105] Considering that data packet transmission is not guaranteed, network jitter or sudden contention in public network data streams often leads to increased packet loss rates and packet queuing delays. If network jitter is considered a random event, then multiple transmission paths are undoubtedly more stable than a single path. This is because the probability of multiple paths encountering jitter simultaneously is always lower than the probability of a single path experiencing jitter. Specific network scenarios include... Figure 4 As shown, Figure 4 This is a schematic diagram illustrating a scenario for a session connection management method provided in an embodiment of this application. Specifically, for a cloud video server, using multiple connections can improve video smoothness, increase loading speed, and reduce stuttering. Connections are established through different communication protocols, and multiple session connections are bound to the same execution process in the cloud server.

[0106] Understandably, the multiple session connections detected by the main control process are the set of session connections corresponding to multiple cloud services on the cloud server, and the connections in the session connection set need to be bound to the sessions of the corresponding business.

[0107] 302. The main control process parses the characteristic information of the session connection to determine the characteristic hash value corresponding to the session connection.

[0108] In this embodiment, the characteristic information of the session connection includes features that indicate the object identification in the connection, such as the requester's IP, the requested service name, and the user ID. Specifically, the characteristic information can also be information obtained by numerically combining the above features, such as a string formed by the requested service name according to the parameter list. The specific form of the feature depends on the actual scenario.

[0109] It is understandable that determining the characteristic hash value corresponding to a session connection, in this embodiment, involves using a consistent hashing algorithm to map multiple session connections to the execution process. Specifically, the consistent hashing algorithm maps each object to a point on the edge of a ring, and the system then maps available node machines to different positions on the ring. When looking up the machine corresponding to an object, the consistent hashing algorithm is used to calculate the position of the object on the edge of the ring, and the search continues along the edge of the ring until a node machine is encountered; this machine is the location where the object should be stored. When a node machine is deleted, all objects stored on that machine are moved to the next machine. When a machine is added to a point on the edge of the ring, the next machine to that point needs to move the objects corresponding to that node to the new machine. Changing the distribution of objects on node machines can be achieved by adjusting the positions of the node machines; the consistent hashing algorithm has advantages such as low redundancy, load balancing, smooth transition, balanced storage, and monotonic keywords. By expressing session connections using characteristic hash values, they can be categorized using the consistent hashing algorithm.

[0110] 303. The main control process parses the feature hash value, collects multiple target connections belonging to the target session in the session connection, and distributes the target connections to the target execution process corresponding to the target session.

[0111] In this embodiment, the target session is the client service being executed, such as a voice session in a cloud game; the corresponding target connection is the multiple connections configured for this service, meaning that one cloud game session can correspond to multiple connections to ensure the stability of the cloud game session. Furthermore, the target execution process (worker) is the process allocated to execute this service; for example, if the target session is a voice session in a cloud game, then the target execution process is the process serving the voice session.

[0112] Specifically, this embodiment uses a consistent hashing algorithm to determine the affiliation of the target connection. First, the main control process parses the feature hash value and uses at least two session connections as data nodes to form a consistent hashing node ring. This is because the consistent hashing algorithm organizes the entire hash value space into a virtual ring. For example, assuming that the value space of a certain hash function H is 0 to (2^32-1) (i.e., the hash value is a 32-bit unsigned integer), the entire space is organized in a clockwise direction, and 0 and 2^32-1 coincide at the zero point. Then, the target position on the consistent hashing node ring corresponding to the target session is calculated according to the consistent hashing algorithm. Then, starting from the target position, the search is performed along the consistent hashing node ring, and the data nodes encountered are associated to determine the target connection corresponding to the target session.

[0113] Furthermore, since the target connection is associated with the corresponding worker (target execution process), the collected target connections can be distributed to the target execution process corresponding to the target session, thereby realizing the distribution process of multiple connections.

[0114] 304. Receive business data transmitted by the target connection based on the target execution process, and execute the target session according to the business data.

[0115] In this embodiment, the Master acts as a central control node for connection distribution, while the Workers are responsible for forwarding services. This, combined with business layering, functional division, and resource allocation, enables the distribution of multiple connections. Specifically, the distribution architecture of this application is as follows: Figure 5 As shown, Figure 5 This is a schematic diagram illustrating another session connection management method provided in this application embodiment. In the scenario shown, the Master process represents the logic executed by the core layer of Nginx, which involves receiving multiple session connections, parsing and layering them, and then migrating the data.

[0116] Specifically, the process of transferring connections after determining the target Worker process is a data migration process. For connection transfer, the initial connection associated with the target connection is first determined; then, the socket corresponding to the initial connection is parsed to obtain the port descriptor; and the data address is determined based on the port descriptor; subsequently, data migration is performed based on the data address so that the target execution process receives the business data transferred by the target connection; and the target session is executed based on the business data. This is achieved by customizing the existing inter-process communication methods of native Nginx, namely, setting up domain socket communication that can carry socket descriptors, thereby enabling connection migration between different processes, since a connection is essentially bound to a descriptor of IP and PORT.

[0117] Furthermore, since the initial connection contains different connection types, this embodiment supports both TCP and UDP connection types. Considering the specific differences between TCP and UDP sockets, the protocol type corresponding to the initial connection can be determined. If the protocol type indicates that the socket corresponding to the initial connection has connection characteristics (TCP), then the socket corresponding to the initial connection is parsed to obtain the double-ended four-tuple information corresponding to the initial connection. Then, data migration is performed based on the double-ended four-tuple information to receive the business data transmitted by the target connection based on the target execution process. Finally, the target session is executed according to the business data. This is because TCP is a connection-oriented socket and comes with its own connection double-ended four-tuple information.

[0118] For UDP connections, due to their inherent connectionless nature, the corresponding four-tuple information needs to be pre-bound on the Master process before connection migration. This ensures that the Worker, upon receiving the migrated connection, can obtain the peer's IP and PORT information. Specifically, if the protocol type indicates that the initial connection is connectionless, the corresponding end-to-end four-tuple information is bound in the Master process. Then, in response to the determination of the target session, the end-to-end four-tuple information corresponding to the initial connection is extracted from the Master process. Data migration is then performed based on this end-to-end four-tuple information to receive business data transmitted through the target connection in the target execution process, and the target session is executed based on the business data.

[0119] This embodiment modifies the Nginx distribution architecture, thereby eliminating cumbersome shared memory synchronization and complex inter-worker communication, achieving maximum benefit with minimal cost. Furthermore, it is not limited to cloud video scenarios and supports multi-channel scenarios.

[0120] As described in the above embodiments, the process involves acquiring multiple session connections detected by the main control process; then, the main control process parses the feature information of the session connections to determine the feature hash value corresponding to each session connection; and further, by parsing the feature hash value, the main control process collects multiple target connections belonging to the target session and distributes them to the target execution process corresponding to the target session. Subsequently, the target execution process receives the business data transmitted by the target connection and executes the target session based on the business data. This constructs a management architecture that utilizes the main control process for connection distribution management and the execution process for business processing. By matching connections using their feature information, the process accurately achieves the binding of multiple connections within a session, improving the accuracy of session connection distribution.

[0121] The following examples illustrate cloud gaming. Please refer to [link / reference]. Figure 6 , Figure 6 This is a flowchart of another session connection management method provided in an embodiment of this application. The embodiment of this application includes a main control process execution part 601 and an execution process execution part 602.

[0122] For the 601 execution part of the master process, the master process first performs session connection detection (masterlisten), and then extracts feature information from the detected session connection. The features include the name of the cloud game, user ID, user IP, game configuration information, etc. Then, based on the feature information, it determines the corresponding cloud game execution process Worker, and then performs data migration.

[0123] Specifically, the session connection detection process can involve specific identification of game streaming media data, i.e., detecting the game streaming media to trigger the distribution of multiple connections. This is because cloud gaming, also known as game on demand, is a gaming method based on cloud computing technology. Cloud gaming enables lightweight devices with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, all cloud game instances do not run on the user's terminal, but rather on the cloud gaming server; the cloud gaming server compresses and encodes the game visuals and audio from the cloud game instance into a media stream, and then transmits the media stream to the user's terminal via the network. The media stream can include video and audio streams; that is, by identifying the media stream, the effect of session detection can be achieved.

[0124] In addition, video and audio streams for cloud gaming can be connected and distributed separately, as video and audio may have different requirements, thereby improving the performance of business operations after connection and distribution.

[0125] For execution part 602 corresponding to the execution process, the execution process receives migration data corresponding to the session connection allocated by the main control process, and determines whether the session connection is the first connection (order information) of the cloud gaming session, such as the creation connection of a voice channel; specifically, it includes receiving business data transmitted by the target connection based on the target execution process, and determining the order information of the target connection in relation to the target session; if the order information indicates that the target connection is the first connection, then the target session is created; and then the target session is executed according to the business data. In the game scenario, if it is the first connection, a game session is created, and other user access connections are bound based on the game session; if it is not the first connection, it is connected to an existing game session, thereby completing the multi-connection distribution process.

[0126] It is understandable that, since cloud gaming servers allow multiple clients to access and operate the same cloud gaming instance, in the connection distribution process of this embodiment, the connections of multiple clients can be distributed separately, or the connection distribution can be based on the cloud gaming instance, that is, the connections of multiple clients are processed together.

[0127] This embodiment modifies the Nginx distribution architecture, thereby eliminating the cumbersome shared memory synchronization and complex inter-worker communication methods, and efficiently and accurately accessing the game session, thus improving the efficiency of game session access.

[0128] To better implement the above-described solutions of the embodiments of this application, related apparatus for implementing the above solutions is also provided below. Please refer to... Figure 7 , Figure 7 This is a schematic diagram of the structure of a session connection management device provided in an embodiment of this application. The session connection management device 700 includes:

[0129] Acquisition unit 701 is used to acquire multiple session connections detected by the main control process;

[0130] The determining unit 702 is used to parse the feature information of the session connection through the main control process and determine the feature hash value corresponding to the session connection;

[0131] The determining unit 702 is further configured to parse the feature hash value through the main control process, collect multiple target connections belonging to the target session in the session connection, and distribute the target connections to the target execution process corresponding to the target session;

[0132] The management unit 703 is used to receive business data corresponding to the target session based on the target execution process, so as to execute the target session according to the business data.

[0133] Optionally, in some possible implementations of this application, the determining unit 702 is specifically used to parse the feature hash value through the main control process, and to form a consistent hash node ring with at least two session connections as data nodes;

[0134] The determining unit 702 is specifically used to calculate the target position on the consistent hash node ring corresponding to the target session according to the consistent hash algorithm.

[0135] The determining unit 702 is specifically used to search along the consistent hash node ring starting from the target location, and to associate the encountered data nodes to determine the target connection corresponding to the target session.

[0136] The determining unit 702 is specifically used to distribute the target connection to the target execution process corresponding to the target session.

[0137] Optionally, in some possible implementations of this application, the management unit 703 is specifically used to determine the initial connection associated with the target connection;

[0138] The management unit 703 is specifically used to parse the socket corresponding to the initial connection to obtain the port descriptor corresponding to the initial connection;

[0139] The management unit 703 is specifically used to determine the data address based on the port descriptor;

[0140] The management unit 703 is specifically used to perform data migration based on the data address, so as to receive the business data transmitted by the target connection based on the target execution process;

[0141] The management unit 703 is specifically used to execute the target session based on the business data.

[0142] Optionally, in some possible implementations of this application, the management unit 703 is specifically used to determine the protocol type corresponding to the initial connection;

[0143] The management unit 703 is specifically used to parse the socket corresponding to the initial connection if the protocol type indicates that the socket corresponding to the initial connection has connection characteristics, so as to obtain the double-ended quad tuple information corresponding to the initial connection.

[0144] The management unit 703 is specifically used to perform data migration based on the dual-end quadruple information, so as to receive the business data transmitted by the target connection through the target execution process;

[0145] The management unit 703 is specifically used to execute the target session based on the business data.

[0146] Optionally, in some possible implementations of this application, the management unit 703 is specifically used to bind the double-ended quadruple information corresponding to the initial connection in the main control process if the protocol type indicates that the initial connection has no connection characteristics.

[0147] The management unit 703 is specifically used to extract the dual-end quadruple information corresponding to the initial connection from the main control process in response to the determination of the target session;

[0148] The management unit 703 is specifically used to perform data migration based on the dual-end quadruple information corresponding to the initial connection, so as to receive the service data transmitted by the target connection based on the target execution process;

[0149] The management unit 703 is specifically used to execute the target session based on the business data.

[0150] Optionally, in some possible implementations of this application, the management unit 703 is specifically used to receive the service data transmitted by the target connection based on the target execution process, and determine the order information of the target connection for the target session;

[0151] The management unit 703 is specifically used to create the target session if the sequence information indicates that the target connection is the first connection;

[0152] The management unit 703 is specifically used to execute the target session based on the business data.

[0153] By acquiring multiple session connections detected by the main control process, parsing the characteristic information of the session connections to determine the corresponding characteristic hash value, and then parsing the characteristic hash value to collect multiple target connections belonging to the target session, the main control process collects these target connections and distributes them to the target execution process corresponding to the target session. The target execution process then receives the business data transmitted by the target connection and executes the target session based on the business data. This constructs a management architecture that uses the main control process for connection distribution management and the execution process for business processing. By matching connections based on their characteristic information, the system accurately implements the process of binding multiple connections within a session, improving the accuracy of session connection distribution.

[0154] This application also provides a server; please refer to [link / reference]. Figure 8 , Figure 8This is a schematic diagram of a server structure provided in an embodiment of this application. The server 800 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 822 (e.g., one or more processors) and a memory 832, and one or more storage media 830 (e.g., one or more mass storage devices) for storing application programs 842 or data 844. The memory 832 and storage media 830 can be temporary or persistent storage. The program stored in the storage media 830 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 822 may be configured to communicate with the storage media 830 and execute the series of instruction operations stored in the storage media 830 on the server 800.

[0155] Server 800 may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input / output interfaces 858, and / or one or more operating systems 841, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0156] The steps performed by the management device in the above embodiments can be based on this Figure 8 The server structure shown.

[0157] This application also provides a computer-readable storage medium storing session connection management instructions, which, when executed on a computer, cause the computer to perform the aforementioned actions. Figures 3 to 6 The steps performed by the session connection management device in the method described in the illustrated embodiment.

[0158] This application also provides a computer program product including session connection management instructions, which, when run on a computer, causes the computer to perform the aforementioned... Figures 3 to 6 The steps performed by the session connection management device in the method described in the illustrated embodiment.

[0159] This application also provides a session connection management system, which may include... Figure 7 The session connection management device in the described embodiments, or Figure 8 The server described.

[0160] In one possible scenario, the network resource management method of this application is applied to a blockchain device, i.e., the authoritative DNS, LDNS, or terminal is a blockchain device, and this blockchain device is a node in the blockchain. This is described below with reference to the accompanying drawings; see also... Figure 9A The data sharing system 900 shown refers to a system for data sharing between nodes. This system may include multiple nodes 901, which can refer to various clients within the system. Each node 901, during normal operation, receives input information and maintains the shared data within the system based on this information. To ensure interoperability within the system, information connections exist between each node, enabling information transmission. For example, when any node in the system receives input information, other nodes retrieve this information according to a consensus algorithm and store it as part of the shared data, ensuring data consistency across all nodes.

[0161] Each node in the data sharing system has a corresponding node identifier, and each node can also store the node identifiers of other nodes in the data sharing system. This allows for the subsequent broadcasting of generated blocks to other nodes in the data sharing system based on their node identifiers. Each node can maintain a node identifier list as shown in the table below, storing the node name and node identifier in this list. The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify the node. Table 1 only uses IP addresses as an example.

[0162] Table 1. Correspondence between node names and node identifiers

[0163] Node Name Node identifier Node 1 117.114.151.174 Node 2 117.116.189.145 ... … Node N 119.123.789.258

[0164] Each node in the data-sharing system stores the same blockchain. A blockchain consists of multiple blocks; see [link to blockchain documentation]. Figure 9BA blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores input information feature values, version number, timestamp, and difficulty value, while the block body stores the input information. The next block after the genesis block takes the genesis block as its parent block. The next block also includes a block header and a block body. The block header stores the input information feature values ​​of the current block, the block header feature values ​​of the parent block, version number, timestamp, and difficulty value, and so on. This ensures that the block data stored in each block is related to the block data stored in the parent block, guaranteeing the security of the input information in the blocks.

[0165] When generating the individual blocks in the blockchain, see Figure 9C When a node in the blockchain receives input information, it verifies the input information. After verification, it stores the input information in a memory pool and updates its hash tree used to record the input information. Then, it updates the timestamp to the time the input information was received and tries different random numbers multiple times to calculate the feature value, ensuring that the calculated feature value satisfies the following formula:

[0166] SHA256(SH256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET

[0167] Wherein, SHA256 is the feature value algorithm used to calculate the feature value; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header feature value of the parent block of the current block; merkle_root is the feature value of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value for a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the feature value threshold, which can be determined based on nbits.

[0168] Thus, when a random number satisfying the above formula is calculated, the information can be stored accordingly, generating a block header and a block body to obtain the current block. Subsequently, the node where the blockchain resides sends the newly generated block to other nodes in its data sharing system based on the node identifiers of other nodes in the data sharing system. The other nodes then verify the newly generated block and add it to their stored blockchain after verification.

[0169] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0170] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0171] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0172] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0173] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a session connection management device, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0174] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for managing session connections, characterized in that, This is applied to an Nginx architecture that includes a master process and execution processes. The master process manages connection distribution, while the execution processes handle business logic, including: Acquire multiple session connections detected by the main control process; The main control process parses the feature information of the session connection to determine the feature hash value corresponding to the session connection; The main control process parses the feature hash value, collects multiple target connections belonging to the target session from the session connections, and distributes the target connections to the target execution process corresponding to the target session. This includes: parsing the feature hash value through the main control process; forming a consistent hash node ring with at least two session connections as data nodes; calculating the target position on the consistent hash node ring corresponding to the target session according to the consistent hash algorithm; searching along the consistent hash node ring from the target position, associating with encountered data nodes to determine the target connection corresponding to the target session; and distributing the target connection to the target execution process corresponding to the target session. The main control process acts as a connection distribution control node for distributing multiple connections, and the target execution process is the process allocated for executing business functions. The target execution process receives the service data transmitted by the target connection to execute the target session based on the service data.

2. The method according to claim 1, characterized in that, The step of receiving service data transmitted by the target connection based on the target execution process, and executing the target session according to the service data, includes: Determine the initial connection associated with the target connection; The socket corresponding to the initial connection is parsed to obtain the port descriptor corresponding to the initial connection; The data address is determined based on the port descriptor; Data migration is performed based on the data address, so as to receive the business data transmitted by the target connection based on the target execution process; The target session is executed based on the business data.

3. The method according to claim 2, characterized in that, The method further includes: Determine the protocol type corresponding to the initial connection; If the protocol type indicates that the socket corresponding to the initial connection has connection characteristics, then the socket corresponding to the initial connection is parsed to obtain the double-ended quadruple information corresponding to the initial connection. Data migration is performed based on the dual-end quadruple information so that the target execution process can receive the business data transmitted by the target connection. The target session is executed based on the business data.

4. The method according to claim 3, characterized in that, The method further includes: If the protocol type indicates that the initial connection has a connectionless characteristic, then the double-ended quadruple information corresponding to the initial connection is bound in the main control process; In response to the determination of the target session, the dual-end quadruple information corresponding to the initial connection is extracted from the master control process; Data migration is performed based on the dual-end quadruple information corresponding to the initial connection, so as to receive the service data transmitted by the target connection based on the target execution process; The target session is executed based on the business data.

5. The method according to claim 1, characterized in that, The step of receiving service data transmitted by the target connection based on the target execution process, and executing the target session according to the service data, includes: The target execution process receives the service data transmitted by the target connection and determines the order information of the target connection for the target session. If the order information indicates that the target connection is the first connection, then the target session is created; The target session is executed based on the business data.

6. A session connection management device, characterized in that, This is applied to an Nginx architecture that includes a master process and execution processes. The master process manages connection distribution, while the execution processes handle business logic, including: The acquisition unit is used to acquire multiple session connections detected by the main control process. The determining unit is used to parse the feature information of the session connection through the main control process and determine the feature hash value corresponding to the session connection; The determining unit is further configured to parse the feature hash value through the main control process, collect multiple target connections belonging to the target session in the session connections, and distribute the target connections to the target execution process corresponding to the target session. This includes: parsing the feature hash value through the main control process, forming a consistent hash node ring with at least two session connections as data nodes; calculating the target position on the consistent hash node ring corresponding to the target session according to the consistent hash algorithm; searching along the consistent hash node ring from the target position, associating with encountered data nodes to determine the target connection corresponding to the target session; and distributing the target connection to the target execution process corresponding to the target session. The main control process acts as a connection distribution control node for distributing multiple connections, and the target execution process is the process allocated for executing business operations. The management unit is used to receive business data corresponding to the target session based on the target execution process, so as to execute the target session according to the business data.

7. The apparatus according to claim 6, characterized in that, The management unit is specifically used for: Determine the initial connection associated with the target connection; The socket corresponding to the initial connection is parsed to obtain the port descriptor corresponding to the initial connection; The data address is determined based on the port descriptor; Data migration is performed based on the data address, so as to receive the business data transmitted by the target connection based on the target execution process; The target session is executed based on the business data.

8. The apparatus according to claim 7, characterized in that, The management unit is specifically used for: Determine the protocol type corresponding to the initial connection; If the protocol type indicates that the socket corresponding to the initial connection has connection characteristics, then the socket corresponding to the initial connection is parsed to obtain the double-ended quadruple information corresponding to the initial connection. Data migration is performed based on the dual-end quadruple information so that the target execution process can receive the business data transmitted by the target connection. The target session is executed based on the business data.

9. The apparatus according to claim 8, characterized in that, The management unit is specifically used for: If the protocol type indicates that the initial connection has a connectionless characteristic, then the double-ended quadruple information corresponding to the initial connection is bound in the main control process; In response to the determination of the target session, the dual-end quadruple information corresponding to the initial connection is extracted from the master control process; Data migration is performed based on the dual-end quadruple information corresponding to the initial connection, so as to receive the service data transmitted by the target connection based on the target execution process; The target session is executed based on the business data.

10. The apparatus according to claim 6, characterized in that, The management unit is specifically used for: The target execution process receives the service data transmitted by the target connection and determines the order information of the target connection for the target session. If the order information indicates that the target connection is the first connection, then the target session is created; The target session is executed based on the business data.

11. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code; the processor is used to execute the session connection management method according to any one of claims 1 to 5 according to the instructions in the program code.

12. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the session connection management method according to any one of claims 1 to 5.

13. A computer-readable storage medium storing executable instructions, characterized in that, When the executable instructions are executed by the processor, they implement the session connection management method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data processing method and routing layer device and system

    CN106254240A