Distributed session processing method and device, electronic equipment, storage medium and product

By analyzing business elements in a distributed system and using hash functions to determine the target node to process requests, the session state inconsistency caused by random load balancing is solved, ensuring the consistency and processing efficiency of session state.

CN120583092APending Publication Date: 2025-09-02INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510848434.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-24
Publication Date
2025-09-02

AI Technical Summary

Technical Problem

In a distributed system, when multiple requests are processed in the same session, the random load balancing mechanism causes the request to be distributed to different servers, causing problems of session state splitting and inconsistency.

Method used

By analyzing business elements in the request, using the hash function to calculate the hash value, determine the target node, and process the request on the target node, ensuring the consistency of requests in the same session, and using sticky identifiers to mark the requests to achieve efficient routing.

Benefits of technology

The state consistency of requests in the same session is achieved, which avoids session chain breaks and state inconsistencies, and improves processing efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120583092A_ABST
    Figure CN120583092A_ABST
Patent Text Reader

Abstract

The invention provides a distributed session processing method which can be applied to the field of distributed technologies. The distributed session processing method comprises the following steps: in response to a received target session processing instruction, taking each request in a target session comprising a plurality of requests as a current request in sequence, and executing the following processing steps: analyzing the current request by using an element analyzer to obtain a service element, the service element is a unique identifier of the target session; determining a target node from a plurality of nodes of the distributed cluster according to the service elements; and routing the current request to the target node, and calling the target node to process the current request. The invention further provides a distributed session processing device, electronic equipment, a storage medium and a product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed technology, and specifically to a distributed session processing method, device, electronic device, storage medium and product. Background Art

[0002] In a distributed system, random load balancing is enabled to evenly distribute requests to different servers. When processing multiple requests in the same session, these requests are randomly distributed to different servers. If a server status anomaly occurs, the session state may split, leading to broken session chains or inconsistent session states. Summary of the Invention

[0003] In view of the above problems, the present application provides a distributed session processing method, device, electronic device, storage medium and product.

[0004] According to the first aspect of the present application, a distributed session processing method is provided, comprising: in response to receiving a target session processing instruction, executing the following processing steps in sequence for each request in a target session including multiple requests as a current request: parsing the current request using an element parser to obtain a business element, wherein the business element is a unique identifier of the target session; determining a target node from multiple nodes in a distributed cluster based on the business element; routing the current request to the target node, and calling the target node to process the current request.

[0005] According to an embodiment of the present application, a target node is determined from multiple nodes of a distributed cluster based on a business element, including: calculating a hash value of the business element using a hash function; and determining the target node from multiple nodes of the distributed cluster based on the hash value.

[0006] According to an embodiment of the present application, a target node is determined from multiple nodes of a distributed cluster based on a hash value, including: performing a modulo operation based on the hash value and the number of nodes in the distributed cluster to obtain a modulo result; determining the target node from a node list based on the modulo result; wherein the node list is obtained by arranging multiple nodes in the distributed cluster in ascending order according to IP addresses and port values.

[0007] According to an embodiment of the present application, in response to receiving a target session processing instruction, each request in a target session including multiple requests is sequentially treated as a current request and the following processing steps are performed, including: in response to receiving a target session processing instruction, each request of the target session is marked with a sticking identifier; in response to identifying a request containing a sticking identifier, a processing step is performed on the request.

[0008] According to an embodiment of the present application, the target session includes a first request and a second request located after the first request, and the method also includes: updating the session status of the target node according to the processing result obtained after executing the processing steps for the first request; and calling the target node to process the second request according to the session status.

[0009] According to an embodiment of the present application, the session status of the target node is updated according to the processing result obtained after executing the processing step of the first request, including: if no processing result is returned after executing the processing step in response to the first request, the session status is updated to an abnormal state.

[0010] According to an embodiment of the present application, calling the target node to process the second request according to the session status includes: in response to the session status being an abnormal state, calling the target node refusing to process the second request.

[0011] The second aspect of the present application provides a distributed session processing device, including: an execution module, which is used to respond to receiving a target session processing instruction and take each request in a target session including multiple requests as the current request in turn, and the execution module includes: a parsing unit, which is used to use an element parser to parse the current request to obtain a business element, wherein the business element is a unique identifier of the target session; a determination unit, which is used to determine a target node from multiple nodes of a distributed cluster based on the business element; and a calling unit, which is used to route the current request to the target node and call the target node to process the current request.

[0012] The third aspect of the present application provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0013] The fourth aspect of the present application further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the computer program or instructions are executed by a processor.

[0014] The fifth aspect of the present application further provides a computer program product, comprising a computer program or instructions, which implement the steps of the above method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The above contents and other objects, features and advantages of the present application will become more apparent through the following description of the embodiments of the present application with reference to the accompanying drawings, in which:

[0016] Figure 1 Schematically illustrates an application scenario diagram of a distributed session processing method, apparatus, electronic device, storage medium, and product according to an embodiment of the present application;

[0017] Figure 2 The following schematically shows a flow chart of a distributed session processing method according to an embodiment of the present application;

[0018] Figure 3 The following schematically shows a principle diagram of a distributed session processing method according to an embodiment of the present application;

[0019] Figure 4 A block diagram schematically illustrates a structure of a distributed session processing device according to an embodiment of the present application; and

[0020] Figure 5 A block diagram of an electronic device suitable for implementing a distributed session processing method according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0021] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present application. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present application. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present application.

[0022] The terms used herein are only for describing specific embodiments and are not intended to limit the present application. The terms "comprise," "include," etc. used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0023] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0024] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0025] In some examples, such as banking systems, most systems use a distributed service framework that enables a random load balancing mechanism by default. It randomly selects a server from the provider registration list to initiate a Remote Procedure Call (RPC). This mechanism evenly distributes requests to different servers for processing, which can better utilize server resources.

[0026] However, random load balancing has its drawbacks. When processing multiple requests within the same session, these requests are randomly distributed to different servers, leading to inconsistent session states. For example, a transaction initiated from a channel accesses the backend, first submitting a "pre-query" request and then a "transfer" request. These two requests may access different servers, containers, and clusters. This can lead to situations where the "pre-query" succeeds but the "transfer" request fails due to abnormal status on individual servers.

[0027] It can be seen from this that in a distributed system, when processing multiple requests in the same session, multiple requests are randomly distributed to different servers. When there is an abnormal server status, the session status will be split, causing problems such as session chain breakage or inconsistent session status.

[0028] In view of this, an embodiment of the present application provides a distributed session processing method.

[0029] Figure 1 The application scenario diagram of the distributed session processing method, device, electronic device, storage medium and product according to the embodiments of the present application is schematically shown.

[0030] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a distributed technology field. A network 104 is used as a medium for providing a communication link between a first terminal device 101, a second terminal device 102, a third terminal device 103, and a server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0031] A user may use a first terminal device 101, a second terminal device 102, or a third terminal device 103 to interact with a server 105 via a network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, or the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).

[0032] The first terminal device 101 , the second terminal device 102 , and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0033] The server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal devices.

[0034] It should be noted that the distributed session processing method provided in the embodiment of the present application can generally be executed by the server 105. Accordingly, the distributed session processing device provided in the embodiment of the present application can generally be set in the server 105. The distributed session processing method provided in the embodiment of the present application can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the distributed session processing device provided in the embodiment of the present application can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0036] The following will be based on Figure 1 The scene described by Figures 2 to 5 The distributed session processing method according to the embodiment of the present application is described in detail.

[0037] Figure 2 The flowchart of the distributed session processing method according to an embodiment of the present application is schematically shown.

[0038] like Figure 2 As shown, the distributed session processing method of this embodiment can be executed by a server, and the method includes, in response to receiving a target session processing instruction, sequentially performing the following operations S211-S213 on each request in a target session including multiple requests as a current request.

[0039] In the embodiments of the present application, a target session refers to a logical execution unit consisting of multiple requests triggered by the same business event and with continuous state dependencies. Its core characteristic is that it shares the same business context state. A session maintains global state, while requests modify local state. The state generated by preceding requests constrains the execution of subsequent requests, and the complete session must ensure the order and continuity of requests. A target session includes multiple requests. In response to receiving a target session processing instruction, each request in the target session is sequentially treated as the current request and operations S211-S213 are executed.

[0040] In operation S211 , the current request is parsed using an element parser to obtain a business element, where the business element is a unique identifier of the target session.

[0041] In an embodiment of the present application, a business element is a key data field that is unique, stable, and can identify a complete business life cycle in a specific business scenario. The business elements obtained by parsing each request in the target session using an element parser are the same.

[0042] In financial transaction scenarios, a business element can be a channel event number. The channel event number obtained by parsing each request in a target session using the element resolver is the same. For example, the channel event number might be MOBILE_20240515_0001_CCB, which is derived from the combination of channel type MOBILE, date 20240515, sequence number 0001, and institution number CCB. A business element is a unique identifier for a target session, and the channel event number obtained by parsing multiple requests in the target session is the same.

[0043] In a user session scenario, a business element can be a user's unique identifier. For example, the user's unique identifier is U123456789. The user's unique identifier can be bound to all operations of the same user.

[0044] The business element can be an account combination identifier, for example, "transfer-out account - transfer-in account".

[0045] In the embodiments of this application, the element parser dynamically extracts routing key identifiers by deeply analyzing business messages. The element parser is a business semantic extractor for distributed systems. By intelligently parsing the current request, it translates the original network request into routable semantic identifiers and obtains the business elements corresponding to the current request.

[0046] In operation S212 , a target node is determined from a plurality of nodes in the distributed cluster according to the service element.

[0047] In the embodiments of this application, a node in a distributed cluster refers to the independent computing units that make up the distributed cluster. Each node is typically deployed on an independent physical or virtual server and communicates and collaborates via a network connection. Nodes are the basic components of a distributed system, responsible for performing specific tasks and working together to achieve the overall goals of the system.

[0048] In an embodiment of the present application, a dictionary mapping method can be used to determine a target node from multiple nodes in a distributed cluster based on business elements. For example, a global mapping table is created and the global mapping table is queried based on business elements to obtain the target node.

[0049] In embodiments of the present application, a prediction model can be constructed to determine a target node from multiple nodes in a distributed cluster based on business factors. For example, historical data such as business factors, node load, and response time can be collected, and a prediction model (such as XGBoost) can be trained based on the historical data to predict the optimal node in real time based on the business factors, which will be used as the target node.

[0050] In operation S213 , the current request is routed to a target node, and the target node is called to process the current request.

[0051] In an embodiment of the present application, after the target node is determined, the current request is routed to the target node, and the target node is called to process the current request.

[0052] For example, a transfer session includes a pre-query request and a transfer request. In some examples, if the pre-query request finds node a normal, due to the random load balancing mechanism, the transfer request may be routed to node b, which will process the transfer request. When node b is abnormal, the transfer request may fail. In an embodiment of the present application, by parsing each request in the target session, the business elements corresponding to the target session can be obtained. Each request can determine the same target node based on the same business elements, thereby ensuring that each request in the target session is processed by the target node, ensuring that the nodes processing the pre-query request and the transfer request are consistent. If the pre-query is successful, the transfer request can return the processing result normally, thereby resolving the problem of unknown transactions caused by transfer requests due to back-end device jitter.

[0053] According to the embodiments of the present application, since the business element is a unique identifier for the target session, the business element parsed by the element parser is the same for each request in the target session, and the target node determined from multiple nodes in the distributed cluster based on the business element is also the same. Therefore, multiple requests in the target session are routed to the same target node, and each request is processed by the target node. The distributed session processing method of this embodiment can ensure that each request in the target session is processed by the target node, ensuring the consistency of the session state.

[0054] In some embodiments, determining a target node from multiple nodes of a distributed cluster based on a business element includes: calculating a hash value of the business element using a hash function; and determining the target node from multiple nodes of the distributed cluster based on the hash value.

[0055] In the embodiment of the present application, a hash function is used to calculate the hash value of the business element. The business element can be input into a preset hash function to obtain a fixed-length digital fingerprint (hash value) output by the preset hash function.

[0056] In embodiments of the present application, a consistent hash ring can be used to determine a target node from multiple nodes in a distributed cluster. For example, a hash ring is constructed to create multiple virtual nodes for each node in the distributed cluster. A hash function is used to calculate the hash value of a business element. Based on the hash value of the business element, the nearest virtual node is searched clockwise on the ring. This virtual node is mapped to the corresponding physical node to determine the target node.

[0057] In embodiments of the present application, a target node can be determined from multiple nodes in a distributed cluster using a weighted approach. For example, each node in the distributed cluster is assigned a different weight (0-100), with weights dynamically assigned based on the node's capabilities, with more capable nodes receiving larger weights. A hash function is used to calculate the hash value of a business element, which is then mapped to a range of 0-100. The corresponding target node is then selected based on the weight range within which the value falls.

[0058] Figure 3 The schematic diagram shows a principle diagram of a distributed session processing method according to an embodiment of the present application.

[0059] like Figure 3 As shown in , after determining the target node in the node list from multiple nodes in the distributed cluster based on the hash value, the current request is routed to the target node through the routing layer. For example, the target node is Figure 3 If it is node 1 in the process, the current request will be routed to node 1 and node 1 will be called to process the current request.

[0060] Through the embodiments of the present application, the hash value of the business element is calculated, and the target node is determined from multiple nodes of the distributed cluster based on the hash value, which can improve the accuracy of the determined target node and thereby improve the reliability of the distributed session processing method of this embodiment.

[0061] In some embodiments, a target node is determined from multiple nodes in a distributed cluster based on a hash value, including: performing a modulo operation based on the hash value and the number of nodes in the distributed cluster to obtain a modulo result; determining the target node from a node list based on the modulo result; wherein the node list is obtained by arranging multiple nodes in the distributed cluster in ascending order according to IP addresses and port values.

[0062] In an embodiment of the present application, a modulo operation is performed based on the hash value and the number of nodes in the distributed cluster to obtain a modulo result. That is, the hash value is divided by the number of nodes in the distributed cluster, and the remainder is used as the modulo result.

[0063] For example, the hash value is 0x8d3e5f7a2b. Convert the hash value to decimal and get 379482157867. When the number of nodes in the distributed cluster is 3, 379482157867 / 3=126494052622 with a remainder of 1. At this time, the modulo result is 1.

[0064] like Figure 3 As shown, in an embodiment of the present application, the target node is determined from the node list according to the modulo result. The node list is obtained by arranging multiple nodes in the distributed cluster in ascending order according to IP addresses and port values. For example, Figure 3 The example includes nodes 1, 2, and 3, which are arranged in ascending order based on IP address and port numbers. Node 1 is 192.168.1.10:8080, and the corresponding number is 0. Node 2 is 192.168.1.20:8080, and the corresponding number is 1. Node 3 is 192.168.1.30:8080, and the corresponding number is 2. When the modulo result is 1, the modulo result corresponds to node 2.

[0065] In an embodiment of the present application, for multiple requests in the same target session, the business elements parsed by the element parser are the same, so the hash value calculated based on the element business is the same, the modulo result obtained by performing a modulo operation based on the hash value and the number of nodes in the distributed cluster is the same, and finally the target node determined is also the same.

[0066] Through the embodiments of the present application, through a simple hash modulo operation, while ensuring business continuity, the uniformity of load balancing is taken into account, thereby improving the reliability of the distributed session processing method of this embodiment.

[0067] In some embodiments, in response to receiving a target session processing instruction, each request in a target session including multiple requests is sequentially treated as a current request and the following processing steps are performed, including: in response to receiving a target session processing instruction, each request of the target session is marked with a sticking identifier; in response to identifying a request containing a sticking identifier, processing steps are performed on the request.

[0068] In the embodiment of the present application, the adhesion identifier is a routing metadata tag attached to the request, which is essentially a binary marking bit used to trigger a specific routing mechanism of the distributed system.

[0069] In an embodiment of the present application, different sessions have different processing requirements. Each request in a target session needs to be processed by the same target node. Therefore, in response to receiving a target session processing instruction, each request in the target session is marked with a sticky identifier, that is, each request in the target session is marked with a routing metadata tag. When a request containing a routing metadata tag is identified, the above processing steps are performed on the request, that is, the target node for processing the request is determined based on the extracted business elements.

[0070] When multiple requests in a session do not need to be processed by the same target node, it is possible to not mark each request in the session with a sticky identifier and use a random load balancing mechanism to randomly route multiple requests in the session to different nodes in the distributed cluster for processing, thereby improving the efficiency of session processing.

[0071] For example, in a transfer scenario, the steps of this embodiment can guide pre-query requests, transfer requests, and confirmation requests to accurately reach the target node, solving the two key pain points of "high state addressing overhead" and "routing deviation" (random load balancing) in related technologies, and enabling sub-millisecond state synchronization of capital flows.

[0072] Through the embodiments of the present application, by marking each request in the target session with a sticking identifier and executing processing steps for each request according to the sticking identifier, the efficiency and accuracy of the target session processing process can be improved, thereby improving the reliability of the distributed session processing method of this embodiment.

[0073] In some embodiments, the target session includes a first request and a second request located after the first request, and the method further includes: updating the session state of the target node according to the processing result obtained after executing the processing step of the first request; and calling the target node to process the second request according to the session state.

[0074] In an embodiment of the present application, the target node is equipped with a session container, which stores the user's session state. The session container is deployed in the service provider's instance memory and serves as a local state storage engine on the target node. After processing a first request, the session state of the target node's session container is updated based on the processing results obtained after executing the processing steps for the first request. When the target node processes a second request, it processes the second request based on the session state.

[0075] For example, the business elements of the first request are extracted, the target node is determined to be node X, node X processes the first request, node X creates a session container, and stores state S1. The business elements of the second request are extracted, the target node is determined to be node X, node X processes the second request, node X reads state S1 from the session container, and generates state S2.

[0076] Through the embodiments of the present application, cross-request state transfer can be achieved by binding the session container with business elements and coordinating with precise positioning of adhesion routing. Through the three-level mechanism of business elements, node positioning, and state access, strong consistency of state transfer during the target session processing process can be achieved.

[0077] In some embodiments, updating the session state of the target node according to the processing result obtained after executing the processing step of the first request includes: updating the session state to an abnormal state if no processing result is returned after executing the processing step in response to the first request.

[0078] In an embodiment of the present application, if the target node does not return a processing result after processing the first request, it means that the target node may have a system abnormality such as a database abnormality, which in turn causes the processing result to be unable to be returned successfully. At this time, the target node can be considered unavailable, so the session status of the target node is updated to an abnormal state.

[0079] In some embodiments, the calling target node processes the second request according to the session state, including: in response to the session state being an abnormal state, the calling target node refuses to process the second request.

[0080] In an embodiment of the present application, when it is identified that the session state of the target node is abnormal, the target node may be called to refuse to process the second request.

[0081] For example, in a transfer session, the first request could be a pre-query request, and the second request could be a transfer request. If the pre-query request fails to return a successful result due to a system failure such as a database anomaly on the target node, the target node's session status can be updated to an abnormal state. When the transfer request is routed to the target node, the target node can be instructed to refuse to process the transfer request based on its session status.

[0082] In an embodiment of the present application, when it is identified that the session state of the target node is abnormal, other nodes except the target node may be called to process multiple requests in the target session.

[0083] Through the embodiments of the present application, when the session status is abnormal, calling the target node to refuse to process the second request can improve the processing efficiency of the distributed session processing method of this embodiment and avoid the situation where the failure of the second request to execute leads to waste of node resources.

[0084] In some embodiments, distributed session processing is performed by the Distributed Service Framework (DSF) layer within the server. Based on the DSF's Service Provider Interface (SPI) extension mechanism, a load balancer and feature parser extensions are added. The service system reads the service features in the current request, and the framework uses the results to perform load calculations.

[0085] In an embodiment of the present application, the DSF framework layer receives a request from a consumer and, upon recognizing that the request contains a sticky identifier, calls the element parser to read the requested business element. It then calls the load balancer to calculate the hash value of the business element, performs a modulo operation on the hash value, and locates the index of the target node. The request is then routed to the target node and called upon to process the request.

[0086] The embodiments of the present application can solve the problems of session state splitting, session chain rupture, or session state inconsistency caused by abnormal server state in distributed scenarios, thereby ensuring the consistency of the session state of the target session during processing.

[0087] Based on the above distributed session processing method, this application also provides a distributed session processing device. Figure 4 The device is described in detail.

[0088] Figure 4 The structural block diagram of a distributed session processing device according to an embodiment of the present application is schematically shown.

[0089] like Figure 4 As shown, the distributed session processing device 400 of this embodiment includes an execution module 410 , and the execution module 410 includes a parsing unit 411 , a determining unit 412 and a calling unit 413 .

[0090] The execution module 410 is configured to, in response to receiving the target session processing instruction, sequentially take each request in the target session including multiple requests as a current request.

[0091] The parsing unit 411 is configured to parse the current request using an element parser to obtain a business element, wherein the business element is a unique identifier of the target session. In one embodiment, the parsing unit 411 may be configured to perform the operation S211 described above, which will not be described in detail herein.

[0092] The determining unit 412 is configured to determine a target node from multiple nodes in the distributed cluster according to the service element. In one embodiment, the determining unit 412 may be configured to perform the operation S212 described above, which will not be described in detail herein.

[0093] The calling unit 413 is configured to route the current request to the target node and call the target node to process the current request. In one embodiment, the calling unit 413 may be configured to execute the operation S213 described above, which will not be described in detail herein.

[0094] According to embodiments of the present application, any multiple units among parsing unit 411, determination unit 412, and invocation unit 413 may be combined into a single unit, or any one of these units may be split into multiple units. Alternatively, at least part of the functionality of one or more of these units may be combined with at least part of the functionality of other units and implemented in a single unit. According to embodiments of the present application, at least one of parsing unit 411, determination unit 412, and invocation unit 413 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented in hardware or firmware through any other reasonable means of circuit integration or packaging, or may be implemented in any one of the three implementation methods of software, hardware, and firmware, or any appropriate combination of these. Alternatively, at least one of parsing unit 411, determination unit 412, and invocation unit 413 may be at least partially implemented as a computer program module that, when executed, performs the corresponding functionality.

[0095] Figure 5 A block diagram of an electronic device suitable for implementing a distributed session processing method according to an embodiment of the present application is schematically shown.

[0096] like Figure 5As shown, an electronic device 500 according to an embodiment of the present application includes a processor 501, which can perform various appropriate actions and processes based on a program stored in a read-only memory (ROM) 502 or a program loaded from a storage unit 508 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present application.

[0097] Various programs and data required for the operation of the electronic device 500 are stored in the RAM 503. The processor 501, ROM 502, and RAM 503 are connected to each other via a bus 504. The processor 501 performs various operations of the method flow according to the embodiment of the present application by executing the programs in the ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than the ROM 502 and the RAM 503. The processor 501 may also perform various operations of the method flow according to the embodiment of the present application by executing the programs stored in one or more memories.

[0098] According to an embodiment of the present application, electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to bus 504. Electronic device 500 may also include one or more of the following components connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 508 including a hard disk; and a communication section 509 including a network interface card such as a LAN card or modem. Communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 510 as needed, so that computer programs read from the removable media can be installed into storage section 508 as needed.

[0099] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of this application is implemented.

[0100] According to an embodiment of the present application, a computer-readable storage medium may be a non-volatile computer-readable storage medium, such as, but not limited to, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present application, a computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0101] The embodiments of the present application also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to enable the computer system to implement the distributed session processing method provided in the embodiments of the present application.

[0102] The computer program executes the above functions defined in the system / device of the embodiment of the present application when the computer program is executed by the processor 501. According to the embodiment of the present application, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0103] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 509, and / or installed from a removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0104] In such an embodiment, the computer program can be downloaded and installed from the network via the communication section 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present application are performed. According to the embodiment of the present application, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.

[0105] According to an embodiment of the present application, the program code for executing the computer program provided by the embodiment of the present application can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

[0106] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0107] Those skilled in the art will appreciate that the features described in the various embodiments of this application may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in this application. In particular, the features described in the various embodiments of this application may be combined and / or coupled in various ways without departing from the spirit and teachings of this application. All such combinations and / or couplings fall within the scope of this application.

Claims

1. A distributed session processing method, characterized in that: The method comprises: In response to receiving the target session processing instruction, the following processing steps are performed on each request in the target session including multiple requests as a current request: Parsing the current request using an element parser to obtain a business element, wherein the business element is a unique identifier of the target session; Determining a target node from multiple nodes in a distributed cluster according to the business elements; The current request is routed to the target node, and the target node is called to process the current request.

2. The method according to claim 1, characterized in that The determining of a target node from a plurality of nodes in a distributed cluster according to the business element includes: Calculating the hash value of the business element using a hash function; The target node is determined from multiple nodes in the distributed cluster according to the hash value.

3. The method according to claim 2, characterized in that Determining the target node from the plurality of nodes in the distributed cluster according to the hash value includes: Performing a modulo operation on the hash value and the number of nodes in the distributed cluster to obtain a modulo result; Determine the target node from the node list according to the modulo result; The node list is obtained by arranging multiple nodes in the distributed cluster in ascending order according to IP addresses and port values.

4. The method according to claim 1, wherein In response to receiving the target session processing instruction, the following processing steps are performed on each request in the target session including multiple requests as a current request, including: In response to receiving the target session processing instruction, marking each request of the target session with a sticky identifier; In response to identifying a request containing the glue identifier, performing the processing steps on the request.

5. The method according to claim 1, wherein The target session includes a first request and a second request subsequent to the first request, and the method further includes: updating the session state of the target node according to a processing result obtained after executing the processing step according to the first request; The target node is called to process the second request according to the session state.

6. The method according to claim 5, characterized in that The updating of the session state of the target node based on a processing result obtained after executing the processing step according to the first request includes: In response to the first request, if no processing result is returned after the processing step is executed, the session state is updated to an abnormal state.

7. The method according to claim 6, characterized in that The calling the target node to process the second request according to the session state includes: In response to the session status being the abnormal state, calling the target node to refuse to process the second request.

8. A distributed session processing device, characterized in that: The device comprises: an execution module, configured to, in response to receiving a target session processing instruction, sequentially take each request in a target session including multiple requests as a current request, the execution module comprising: a parsing unit, configured to parse the current request using an element parser to obtain a business element, wherein the business element is a unique identifier of the target session; a determining unit, configured to determine a target node from a plurality of nodes in a distributed cluster according to the business element; The calling unit is used to route the current request to the target node and call the target node to process the current request.

9. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.