Session sharing method and related device

In the distributed architecture of the Web service system, the combination of forwarding control unit and heterogeneous server side is used to realize the synchronization and sharing of session states, solving the problem of session states out of synchronization in the traditional distributed architecture, and improving the system's concurrency processing capability and high availability.

CN120034583APending Publication Date: 2025-05-23ZHENGZHOU ANGSHI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510261957.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

In the distributed architecture of the traditional web service system, after the website transitions from stand-alone login to distributed login, it depends on the session mechanism stored locally by the server, and the login status is out of synchronization and it is difficult to realize session sharing.

Method used

By receiving the request information uploaded by the client in the forwarding control unit, if the target request is a login request, a heterogeneous server side is selected as the login server side, forward the request information to the server side, and generate and store the target session identifier and session information. For logout requests and sharing function requests, the same is done by selecting the appropriate server side.

Benefits of technology

The synchronization and sharing of session states are realized, the system's concurrency processing capabilities and high availability are improved, and the risk of service unavailability caused by a single server failure is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120034583A_ABST
    Figure CN120034583A_ABST
Patent Text Reader

Abstract

The invention discloses a session sharing method and a related device, which can be applied to the technical field of Internet, when a target request in received request information is a login request, a forwarding control unit forwards the request information to a heterogeneous server side, namely a login server side, in a server cluster, and at the moment, the request information is sent to the server cluster by a server, namely the login server side. When only one heterogeneous server side in the server cluster receives the request information and responds to the login request, the target session identifier generated by the heterogeneous server side and used for identifying the session initiated by the client side is random and unique, so that session sharing is realized based on the uniqueness of the target session identifier.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a session sharing method and related devices. Background Art

[0002] In today's network environment, Web service systems, as important service carriers and provision platforms, bring together massive data resources. In order to solve the limitations of a single server, distributed architectures are widely adopted. Multiple servers jointly process user requests to achieve horizontal expansion of the system. Distributed systems can effectively improve concurrent processing capabilities and high availability of the system. However, in the distributed architecture of traditional Web service systems, after the website transitions from single-machine login to distributed login, it relies on the session mechanism stored locally on the server, which results in asynchrony of login status and difficulty in achieving session sharing. Summary of the invention

[0003] In view of the above problems, the present application provides a session sharing method and related devices to achieve the purpose of improving the effect of session sharing. The specific scheme is as follows:

[0004] A first aspect of the present application provides a session sharing method, which is applied to a forwarding control unit, including:

[0005] Receiving request information uploaded by a client, wherein the request information includes a target random identifier and a target request;

[0006] If the target request is a login request, selecting a heterogeneous server end as a login server end from a preset server cluster, the server cluster including multiple heterogeneous server ends;

[0007] The request information is forwarded to the login server so that the login server responds to the login request and stores the target session identifier and the target session information correspondingly to a preset storage service, wherein the target session identifier is generated based on the target random identifier and the target session information is generated based on the login request.

[0008] In a possible implementation, the session sharing method further includes:

[0009] If the target request is a logout request, selecting a heterogeneous server from the server cluster as a logout server;

[0010] forwarding the request information to the logout server, so that the logout server generates the target session identifier based on the target random identifier, and searches for the target session information stored in the storage service based on the target session identifier;

[0011] The target session identifier and the target session information are deleted from the storage service.

[0012] In a possible implementation, multiple heterogeneous server terminals in a server cluster are divided into multiple heterogeneous server pools, and the session sharing method further includes:

[0013] If the target request is a shared function request, one heterogeneous server end is selected from each of the plurality of heterogeneous server pools as a concurrent server end, and the shared function request is a request other than the login request and the logout request;

[0014] Distribute the request information to each of the concurrent servers, so that the concurrent server generates the target session identifier based on the target random identifier, and searches the storage service for the target session information based on the target session identifier;

[0015] If so, respond to the sharing function request;

[0016] If not present, a status prompt message is generated, wherein the status prompt message includes a target random identifier and a preset logout instruction, and is used to indicate that the client that issues the target random identifier is in a logout state.

[0017] A second aspect of the present application provides a session sharing method, which is applied to a server cluster, wherein the server cluster includes a plurality of heterogeneous server ends; the session sharing method includes:

[0018] The server cluster receives first request information forwarded by the forwarding control unit through the login server, where the first request information includes a target random identifier and a login request;

[0019] Responding to the login request through the login server, and correspondingly storing the target session identifier and the target session information in a preset storage service;

[0020] The login server end is a heterogeneous server end selected by the forwarding control unit from the server cluster when receiving the login request; the target session identifier is generated based on the target random identifier, and the target session information is generated based on the login request.

[0021] In a possible implementation, the session sharing method further includes:

[0022] Receiving, by the logout server, second request information forwarded by the forwarding control unit, where the second request information includes the target random identifier and a logout request;

[0023] Generate the target session identifier based on the target random identifier by the logout server, search for the target session information stored in the storage service based on the target session identifier, and delete the target session identifier and the target session information from the storage service;

[0024] The logout server is a heterogeneous server selected by the forwarding control unit from the server cluster after receiving the logout request.

[0025] In a possible implementation, multiple heterogeneous server terminals in a server cluster are divided into multiple heterogeneous server pools, and the session sharing method further includes:

[0026] Receiving, through a plurality of concurrent server terminals, third request information distributed by the forwarding control unit, the third request information including the target random identifier and a shared function request, the shared function request being a request other than the login request and the logout request;

[0027] Generate the target session identifier based on the target random identifier by using a plurality of the concurrent servers, and search for the target session information in the storage service based on the target session identifier;

[0028] If so, respond to the sharing function request;

[0029] If not, generate status prompt information, the status prompt information including the target random identifier and a preset logout instruction, for indicating that the client issuing the target random identifier is in a logout state;

[0030] The multiple concurrent server ends include heterogeneous server ends selected by the forwarding control unit from the multiple heterogeneous server pools when receiving a sharing function request.

[0031] A third aspect of the present application provides a session sharing system, comprising: a forwarding control unit and a server cluster, wherein the server cluster comprises a plurality of heterogeneous server terminals;

[0032] The forwarding control unit is used for:

[0033] Receive request information uploaded by a client, the request information including a target random identifier and a target request; if the target request is a login request, select a heterogeneous server end as a login server end from a preset server cluster, the server cluster including multiple heterogeneous server ends; forward the request information to the login server end;

[0034] The server cluster is used for:

[0035] The request information is received through the login server; the login server responds to the login request and correspondingly stores the target session identifier and the target session information in a preset storage service; the target session identifier is generated based on the target random identifier, and the target session information is generated based on the login request.

[0036] A fourth aspect of the present application provides a computer program product, comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the session sharing method of the first aspect or any implementation manner of the first aspect.

[0037] A fifth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0038] The memory is used to store computer programs;

[0039] The processor is used to execute the computer program so that the electronic device can implement the session sharing method of the above-mentioned first aspect or any implementation manner of the first aspect.

[0040] In a sixth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the session sharing method of the first aspect or any implementation of the first aspect.

[0041] It can be seen from the above technical solution that in the session sharing method and related devices provided by the embodiments of the present application, when the target request in the received request information is a login request, the forwarding control unit forwards the request information to a heterogeneous server end in the server cluster, that is, the login server end. At this time, when only one heterogeneous server end in the server cluster receives the request information and responds to the login request, the target session identifier generated by the heterogeneous server end for identifying the session initiated by the client is random and unique. Therefore, based on the uniqueness of the target session identifier, the effect of improving session sharing is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A specific structural diagram of a session sharing system provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of the specific structure of a bytecode processing component pool provided in an embodiment of the present application;

[0045] Figure 3 A flowchart of a specific implementation method of a session sharing method provided in an embodiment of the present application;

[0046] Figure 4 A flowchart of a session sharing method provided in an embodiment of the present application;

[0047] Figure 5 A structural diagram of a session sharing system provided in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0050] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0051] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0052] A session sharing method provided in an embodiment of the present application is applicable to, but not limited to, a session sharing system. Figure 1 A session sharing system is provided in an embodiment of the present application. The session sharing system includes a client, a forwarding control unit, a server cluster, a Redis (Remote Dictionary Server) server, and a bytecode processing component pool. The server cluster includes multiple heterogeneous server pools deployed in a distributed manner, and each heterogeneous server pool includes multiple heterogeneous server ends deployed in a distributed manner. Figure 1 As shown, the server-side cluster includes heterogeneous server pool 1, heterogeneous server pool 2 and heterogeneous server pool 3, wherein each heterogeneous server pool includes three heterogeneous server ends, namely heterogeneous server end 1, heterogeneous server end 2 and heterogeneous server end 3.

[0053] In this embodiment, each heterogeneous server pre-deploys a session sharing Java bytecode resource package, which includes a login logic with session sharing function, a login status judgment logic, and a session sharing bytecode of a logout logic.

[0054] In this embodiment, the bytecode processing component pool is used to modify the original Java bytecode resource package to generate a session shared Java bytecode resource package. Figure 2 A schematic diagram of the structure of a bytecode processing component pool provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the bytecode processing component pool includes a configuration parsing module, a bytecode parsing module, a login status judgment logic processing module, a login logic processing module, a logout logic processing module, a bytecode editing module, a file value processing module and a resource packaging module.

[0055] The configuration parsing module is used to receive the original Java bytecode resource package to be modified, wherein the original Java bytecode resource package includes the original bytecode of the login logic, the login status judgment logic, and the logout logic.

[0056] The bytecode parsing module is used to parse the original Java bytecode resource package, and extract the original bytecode of the login logic, the original bytecode of the login status judgment logic, and the original bytecode of the logout logic.

[0057] The login status judgment logic processing module is used to transform the original bytecode of the login status judgment logic according to the configuration mode of the session configuration file, obtain the session shared bytecode, and send the session shared bytecode to the bytecode editing module.

[0058] The login logic processing module is used to transform the original bytecode of the login logic according to the configuration mode of the session configuration file, obtain the session shared bytecode, and send the session shared bytecode to the bytecode editing module.

[0059] The logout logic processing module is used to transform the original bytecode of the logout logic according to the configuration mode of the session configuration file, obtain the session shared bytecode, and send the session shared bytecode to the bytecode editing module.

[0060] The bytecode editing module is used to edit the session shared bytecode of the login status judgment logic, the session shared bytecode of the login logic, and the session shared bytecode of the logout logic, and obtain the Java bytecode file of the login status judgment logic, the Java bytecode file of the login logic, and the Java bytecode file of the logout logic respectively, and send each Java bytecode file to the file value processing module.

[0061] The file value processing module is used to modify the cyclic redundancy check value and message digest algorithm value of each Java bytecode file, obtain the bytecode resources of the login status judgment logic, the bytecode resources of the login logic, and the bytecode resources of the logout logic, and send each bytecode resource to the resource packaging module. Among them, the message digest algorithm value is the MD5 (Message-Digest Algorithm 5) value, and the cyclic redundancy check value is the CRC value.

[0062] The resource packaging module is used to package various bytecode resources to obtain session shared Java bytecode resources.

[0063] It can be seen from the above technical solution that the bytecode processing module component pool utilizes the inherent security concept and uses bytecode editing technology to add some data processing at the three levels of login, logout, and login status judgment without affecting the original application logic, and makes corresponding modifications to the CRC value and MD5 value in the bytecode file. Since the code has undergone offline automated transformation, the application natively supports distributed login functions while having inherent session sharing functions, thereby enhancing the concurrent processing capabilities and high availability of the server side.

[0064] Figure 3 A specific implementation process of a session sharing method provided in an embodiment of the present application is as follows: Figure 3 As shown, the method includes:

[0065] S301: The forwarding control unit receives request information uploaded by the client.

[0066] In this embodiment, the client generates and sends request information to the forwarding control unit according to the demand, wherein the request information includes the target random identifier JessionId and the target request, and the target request is one of a login request, a logout request, or a sharing function request, wherein any request is a URL (Uniform Resource Locator) request. The sharing function request is a request other than the login request and the logout request. The logout request includes information to be verified, such as identity information, password information, etc.

[0067] S302: If the target request is a login request or a logout request, the forwarding control unit randomly selects a heterogeneous server end as a first heterogeneous server end, and forwards the request information to the first heterogeneous server end.

[0068] In this embodiment, if the target request is a login request, the forwarding control unit randomly selects a heterogeneous server as the login server, and if the target request is a logout request, the forwarding control unit randomly selects a heterogeneous server as the logout server. The first heterogeneous server is a login server or a logout server.

[0069] S303: If the target request is a shared function request, the forwarding control unit selects one heterogeneous server end from each heterogeneous server pool as a concurrent server end, and distributes the request information to each concurrent server end.

[0070] In this embodiment, the forwarding control unit determines the request type in the request information by matching the URL.

[0071] S304: After receiving the request information, the target heterogeneous server in the server cluster determines the type of the target request.

[0072] In this embodiment, the target heterogeneous server end is any heterogeneous server end.

[0073] S305. If the target request is a login request, the target heterogeneous server generates a session identifier and session information according to the target random identifier after the client security verification is passed, and stores the session identifier and session information in the Redis shared server using the session identifier as the key and the session information as the key value.

[0074] In this embodiment, a Redis shared service is pre-deployed in the Redis shared server. The Redis shared service stores login information in the form of key-value. The key in each login information is the session identifier SessionId, and the key value is the session information after serialization and encryption.

[0075] Optionally, the target heterogeneous server performs this step by calling the login logic in the pre-deployed shared Java bytecode resource.

[0076] S306. The target heterogeneous server sends a response result of the login request to the forwarding control unit, so that the forwarding control unit forwards the response result of the login request to the client.

[0077] S307: If the target request is a logout request, the target heterogeneous server generates a session identifier based on the target random identifier as the target session identifier, and deletes the target session identifier and the corresponding session information stored in the Redis shared server.

[0078] In this embodiment, the target heterogeneous server performs this step by calling the logout logic in the shared Java bytecode resource.

[0079] S308. The target heterogeneous server sends a response result of the logout request to the forwarding control unit, so that the forwarding control unit forwards the response result of the logout request to the client.

[0080] S309: If the target request is a shared function request, a session identifier is generated based on the target random identifier as the target session identifier, and the Redis shared server is searched for session information corresponding to the target session identifier.

[0081] In this embodiment, the target heterogeneous server determines the login status of the client by calling the login status judgment logic in the shared Java bytecode resource. That is, if the Redis shared server has session information corresponding to the target session identifier, it is determined that the client is in the login state. If the Redis shared server does not have session information corresponding to the target session identifier, it is determined that the client is in the logout state.

[0082] S310: If it exists, the target heterogeneous server performs deserialization processing on the target session information and stores the deserialized target session information.

[0083] In this embodiment, the target heterogeneous server can store the deserialized session information in the backend running service httpServletRequest object.

[0084] S311. The target heterogeneous server sends a response result of the sharing function request to the forwarding control unit.

[0085] S312: If it does not exist, the target heterogeneous server generates status prompt information.

[0086] In this embodiment, the status prompt information includes a target random identifier and a preset logout instruction, which is used to indicate that the client that issues the target random identifier is in a logout state.

[0087] S313: The target heterogeneous server sends the generated status prompt information to the forwarding control unit, so that the forwarding control unit forwards the status prompt information to the client to prompt the client to log in again.

[0088] It can be seen from the above technical solution that a session sharing method provided by an embodiment of the present application, for a login request or a logout request, the forwarding control unit randomly forwards the request information to a heterogeneous server in the server cluster. At this time, only one heterogeneous server receives the request information. When a heterogeneous server responds to a login request or a logout request, a session identifier generated by a heterogeneous server for identifying the session initiated by the client is random and unique, and the login information is stored in the Redis shared service. Based on the uniqueness of the login information, the sharing effect of the login information is improved. That is, once the login is successful, any heterogeneous server can query the login information. Further, it ensures that the insertion and deletion operations of the login information in the Redis shared service are not repeated, thereby reducing the load of the Redis shared service.

[0089] Furthermore, for any type of request except login request and logout request, the forwarding control unit randomly forwards the request information indicating the shared function request to a heterogeneous server in each heterogeneous server pool in the server cluster. Multiple heterogeneous server ends respond to shared function requests based on shared and unique login information, which increases the processing capacity for request services. When the number of requests increases, the processing capacity of a single heterogeneous server end is obviously inferior to that of multiple redundant heterogeneous server ends. Redundant heterogeneous server ends achieve high availability of the system and avoid the risk of service unavailability caused by failure of a single heterogeneous server end.

[0090] Furthermore, the bytecode processing component pool takes advantage of the inherent security concept and uses bytecode editing technology to add data processing at the three levels of login, logout, and login status judgment (also known as login verification) without affecting the initial logic. The CRC and MD5 features in the modified Java bytecode file are modified accordingly, allowing the application to natively support distributed login functions, enhancing the concurrent processing capabilities and high availability of the server cluster.

[0091] Furthermore, the heterogeneous server pool provides heterogeneous functions at four levels: hardware layer, operating system layer, web server, and virtualization software, which increases the confusion for attackers. For example, the return request body intercepted by the attacker is random, and the operation of responding to the request is executed on the heterogeneous execution body (heterogeneous server side), so the response result is different from that generated by the ordinary server side, which increases the difficulty of attack and thus improves security.

[0092] It should be noted that the above S301 to S313 are an optional specific implementation process of the present application, and the session sharing method provided by the present application also includes other specific implementation processes.

[0093] For example, the client, the Redis server, and the bytecode processing component pool are all optional structures, and the Redis service can be deployed on the Redis server or a heterogeneous server.

[0094] For another example, there are multiple implementations of the specific distributed structure of the server cluster. For example, the number of heterogeneous server pools and the number of heterogeneous server terminals in each heterogeneous server pool are both configurable.

[0095] In summary, a session sharing system provided in an embodiment of the present application includes a forwarding control unit and a server cluster, and the server cluster includes multiple server ends. A session sharing method provided in an embodiment of the present application is summarized as follows: Figure 4 The process shown is as follows Figure 4 As shown, the session sharing method includes:

[0096] S401: The forwarding control unit receives request information uploaded by the client.

[0097] In this embodiment, the request information includes a target random identifier and a target request.

[0098] In this embodiment, the request information is classified into first request information, second request information and third request information according to the type of target request, wherein the first request information includes a target random identifier and a login request, the first request information includes a target random identifier and a logout request, and the first request information includes a target random identifier and a shared function request.

[0099] S402: If the target request is a login request, the forwarding control unit selects a heterogeneous server end from a preset server cluster as a login server end, and forwards the request information to the login server end.

[0100] In this embodiment, if the target request is a login request, that is, the target request is the first request information, the forwarding control unit selects a heterogeneous server end as the login server end. Optionally, a heterogeneous server end is randomly selected as the login server end, or a heterogeneous server end is selected as the login server end according to the real-time load status of each heterogeneous server end.

[0101] S403: The server cluster receives the request information by logging into the server.

[0102] In this embodiment, the server cluster receives the first request information through the login server, that is, receives the request information in which the target request is a login request.

[0103] S404: The server cluster responds to the login request through the login server, and correspondingly stores the target session identifier and the target session information in a preset storage service.

[0104] In this embodiment, the target session identifier is generated based on the target random identifier, and the target session information is generated based on the login request.

[0105] It can be seen from the above technical solution that an embodiment of the present application provides a session sharing method. When the target request in the received request information is a login request, the forwarding control unit forwards the request information to a heterogeneous server in the server cluster, that is, the login server. At this time, when only one heterogeneous server in the server cluster receives the request information and responds to the login request, the target session identifier generated by the heterogeneous server for identifying the session initiated by the client is random and unique. Therefore, based on the uniqueness of the target session identifier, the effect and stability of session sharing are improved.

[0106] Furthermore, the session sharing method provided in the embodiment of the present application also includes:

[0107] If the target request is a logout request, that is, the request information is the second request information, the forwarding control unit selects a heterogeneous server end from the server cluster as the logout server end, and forwards the second request information to the logout server end;

[0108] After the server cluster receives the second request information forwarded by the forwarding control unit through the logout server, it generates a target session identifier based on the target random identifier through the logout server, searches for the target session information stored in the storage service based on the target session identifier, and deletes the target session identifier and the target session information from the storage service.

[0109] Among them, the logout server end is a heterogeneous server end selected by the forwarding control unit from the server cluster after receiving the logout request. Therefore, only one heterogeneous server end in the server cluster performs the logout operation, reducing the load and improving system performance.

[0110] Furthermore, the session sharing method provided in the embodiment of the present application also includes:

[0111] If the target request is a shared function request, that is, the request information is the third request information, the forwarding control unit selects one heterogeneous server end from each of the multiple heterogeneous server pools as a concurrent server end, and distributes the third request information to each of the concurrent server ends.

[0112] The server cluster receives the third request information distributed by the forwarding control unit through multiple concurrent server terminals, generates the target session identifier based on the target random identifier through the multiple concurrent server terminals, searches for the target session information in the storage service based on the target session identifier; if it exists, responds to the sharing function request; if it does not exist, generates status prompt information, the status prompt information includes the target random identifier and a preset logout instruction, which is used to indicate that the client that issued the target random identifier is in a logout state;

[0113] Among them, the multiple concurrent server ends include the heterogeneous server ends selected by the forwarding control unit from the multiple heterogeneous server pools when the target request is a shared function request, and the high availability of the system is improved through redundant heterogeneous server ends. Further, the session sharing method provided in the embodiment of the present application also includes modifying the original bytecodes of the login logic, login status judgment logic, and logout logic in the original Java bytecode resource package through the bytecode processing component pool through a pre-configured bytecode processing component pool, and obtaining the bytecodes of the login logic, login status judgment logic, and logout logic with session sharing functions, that is, session sharing bytecodes, so that each heterogeneous server end after deploying the modified login logic, login status judgment logic, and logout logic can implement the above steps. In summary, based on the idea of ​​dynamic heterogeneity, an offline resource package processing program is set. The web server responds to the user login request and stores the login information, namely the session information and the session identifier, in the Redis service. The login information stored in the Redis service is automatically deleted along with the logout request. The concurrent processing capability and high availability of the system ensure that users enjoy safe and stable web services, improve the concurrent processing capability of the original web service and the high availability of the system, and ensure that users can make web requests and receive responses safely and stably.

[0114] Figure 5 A structural diagram of a session sharing system provided in an embodiment of the present application is shown. Figure 5 As shown, the session sharing system may include: a forwarding control unit and a server cluster, wherein the server cluster includes a plurality of heterogeneous server terminals;

[0115] The forwarding control unit is used to: receive request information uploaded by the client, the request information including a target random identifier and a target request; if the target request is a login request, select a heterogeneous server end as a login server end from a preset server cluster, the server cluster including multiple heterogeneous server ends; forward the request information to the login server end;

[0116] The server cluster is used to: receive the request information through the login server; respond to the login request through the login server, and correspondingly store the target session identifier and the target session information in a preset storage service; the target session identifier is generated based on the target random identifier, and the target session information is generated based on the login request.

[0117] In a possible implementation, the forwarding control unit is further used to: if the target request is a logout request, select a heterogeneous server end from the server cluster as a logout server end; and forward the request information to the logout server end.

[0118] The server cluster is also used to: receive second request information forwarded by the forwarding control unit through the logout server, the second request information including a target random identifier and a logout request; generate a target session identifier based on the target random identifier through the logout server, search for target session information stored in the storage service based on the target session identifier, and delete the target session identifier and target session information from the storage service.

[0119] In a possible implementation, multiple heterogeneous server ends in the server cluster are divided into multiple heterogeneous server pools, and the forwarding control unit is further used to: if the target request is a shared function request, select one heterogeneous server end from each of the multiple heterogeneous server pools as a concurrent server end, and the shared function request is a request other than a login request and a logout request; distribute the request information to each concurrent server end;

[0120] The server cluster is also used to: receive third request information distributed by the forwarding control unit through multiple concurrent server terminals, the third request information including a target random identifier and a shared function request, the shared function request being a request other than a login request and a logout request; generate a target session identifier based on the target random identifier through multiple concurrent server terminals, and search whether the target session information exists in the storage service based on the target session identifier; if so, respond to the shared function request; if not, generate status prompt information, the status prompt information including the target random identifier and a preset logout instruction, for indicating that the client that issued the target random identifier is in a logged out state.

[0121] An electronic device is also provided in an embodiment of the present application. Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, referring to Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0122] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0123] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0124] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any session sharing method provided in the embodiment of the present application.

[0125] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any session sharing method provided in the embodiment of the present application.

[0126] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0127] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0128] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0129] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A session sharing method, characterized in that: Applied to a forwarding control unit, the session sharing method includes: Receiving request information uploaded by a client, wherein the request information includes a target random identifier and a target request; If the target request is a login request, selecting a heterogeneous server end from a preset server cluster as a login server end, the server cluster including multiple heterogeneous servers ends; The request information is forwarded to the login server so that the login server responds to the login request and stores the target session identifier and the target session information correspondingly to a preset storage service, wherein the target session identifier is generated based on the target random identifier and the target session information is generated based on the login request.

2. The session sharing method according to claim 1, characterized in that: The session sharing method further includes: If the target request is a logout request, selecting a heterogeneous server from the server cluster as a logout server; forwarding the request information to the logout server, so that the logout server generates the target session identifier based on the target random identifier, and searches for the target session information stored in the storage service based on the target session identifier; The target session identifier and the target session information are deleted from the storage service.

3. The session sharing method according to claim 2, characterized in that: The plurality of heterogeneous server terminals in the server cluster are divided into a plurality of heterogeneous server pools, and the session sharing method further comprises: If the target request is a shared function request, one heterogeneous server end is selected from each of the plurality of heterogeneous server pools as a concurrent server end, and the shared function request is a request other than the login request and the logout request; Distribute the request information to each of the concurrent servers, so that the concurrent server generates the target session identifier based on the target random identifier, and searches the storage service for the target session information based on the target session identifier; If so, respond to the sharing function request; If not present, a status prompt message is generated, wherein the status prompt message includes a target random identifier and a preset logout instruction, and is used to indicate that the client that issues the target random identifier is in a logout state.

4. A session sharing method, characterized in that: Applied to a server cluster, the server cluster includes multiple heterogeneous server ends; The session sharing method comprises: The server cluster receives first request information forwarded by the forwarding control unit through the login server, where the first request information includes a target random identifier and a login request; Responding to the login request through the login server, and correspondingly storing the target session identifier and the target session information in a preset storage service; The login server end is a heterogeneous server end selected by the forwarding control unit from the server cluster when receiving the login request; the target session identifier is generated based on the target random identifier, and the target session information is generated based on the login request.

5. The session sharing method according to claim 4, characterized in that: The session sharing method further includes: Receiving, by the logout server, second request information forwarded by the forwarding control unit, the second request information including the target random identifier and the logout request; Generate the target session identifier based on the target random identifier by the logout server, search for the target session information stored in the storage service based on the target session identifier, and delete the target session identifier and the target session information from the storage service; The logout server is a heterogeneous server selected by the forwarding control unit from the server cluster after receiving the logout request.

6. The session sharing method according to claim 5, characterized in that: The plurality of heterogeneous server terminals in the server cluster are divided into a plurality of heterogeneous server pools, and the session sharing method further comprises: Receiving, through a plurality of concurrent server terminals, third request information distributed by the forwarding control unit, the third request information including the target random identifier and a shared function request, the shared function request being a request other than the login request and the logout request; Generate the target session identifier based on the target random identifier by using a plurality of the concurrent servers, and search for the target session information in the storage service based on the target session identifier; If so, respond to the sharing function request; If not, generate status prompt information, the status prompt information including the target random identifier and a preset logout instruction, for indicating that the client issuing the target random identifier is in a logout state; The multiple concurrent server ends include heterogeneous server ends selected by the forwarding control unit from the multiple heterogeneous server pools when receiving a sharing function request.

7. A session sharing system, characterized in that: include: A forwarding control unit and a server cluster, wherein the server cluster includes a plurality of heterogeneous server ends; The forwarding control unit is used for: Receiving request information uploaded by a client, wherein the request information includes a target random identifier and a target request; If the target request is a login request, selecting a heterogeneous server end as a login server end from a preset server cluster, the server cluster including multiple heterogeneous server ends; Forwarding the request information to the login server; The server cluster is used for: The request information is received through the login server; the login server responds to the login request and correspondingly stores the target session identifier and the target session information in a preset storage service; the target session identifier is generated based on the target random identifier, and the target session information is generated based on the login request.

8. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on an electronic device, enable the electronic device to implement the session sharing method as described in any one of claims 1 to 3 or 4 to 6.

9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the session sharing method as described in any one of claims 1 to 3 or 4 to 6.

10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the session sharing method as described in any one of claims 1 to 3 or 4 to 6.