CN113645261A - Session data processing method, device, storage medium and computer equipment - Google Patents
Session data processing method, device, storage medium and computer equipment Download PDFInfo
- Publication number
- CN113645261A CN113645261A CN202010346483.6A CN202010346483A CN113645261A CN 113645261 A CN113645261 A CN 113645261A CN 202010346483 A CN202010346483 A CN 202010346483A CN 113645261 A CN113645261 A CN 113645261A
- Authority
- CN
- China
- Prior art keywords
- session
- identifier
- cache
- session data
- sending
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 21
- 238000012545 processing Methods 0.000 claims abstract description 26
- 238000000034 method Methods 0.000 claims description 24
- 230000009467 reduction Effects 0.000 abstract description 8
- 239000012634 fragment Substances 0.000 description 15
- 238000010586 diagram Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 230000015556 catabolic process Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000006731 degradation reaction Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000013467 fragmentation Methods 0.000 description 2
- 238000006062 fragmentation reaction Methods 0.000 description 2
- 230000010076 replication Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
In the technical scheme of the session data processing method, the session data processing device, the session data processing medium and the computer device, the first session request sent by the Web server is received, the session data is generated according to the first session request, the session data is stored in the local memory and sent to the first cache device, so that the first cache device stores the session data, the cache identifier is generated according to the session data and sent to the Web server, the cache identifier comprises the device identifier corresponding to the first cache device and the session identifier corresponding to the session data, and the session data is managed by adopting the cache device, so that the problems of memory increase and severe performance reduction caused by the fact that the application server stores multiple pieces of session data can be avoided, and the processing efficiency of the session data is improved.
Description
[ technical field ] A method for producing a semiconductor device
The invention relates to the field of design service support and data service, in particular to a session data processing method, a device, a storage medium and computer equipment.
[ background of the invention ]
With the continuous development and increase of the service scale and the users, the service application needs to be correspondingly and continuously expanded, and the deployment amount is increased. The middleware or service system needs a high-performance session management scheme capable of supporting high concurrent access to ensure access performance and the capability of realizing linear expansion of services.
In the related art, the middleware/service system mainly adopts a session replication sharing technology to realize session management, and generally, in a cluster environment, sessions are synchronized among a plurality of application servers, so that the sessions are kept consistent and transparent to the outside. If one server fails, the Web server can search for available nodes and distribute requests according to the principle of load balance, and because the session is synchronized, the session information of the user can not be lost. However, in the related art, the technology of session copy sharing may rapidly increase performance loss, and the application server stores multiple session data, which may cause an increase in memory and result in serious performance degradation.
[ summary of the invention ]
In view of this, the present invention provides a session data processing method, an apparatus, a storage medium, and a computer device, where session data is managed by using a cache device, so that problems of memory increase and severe performance degradation caused by storing multiple pieces of session data by an application server can be avoided, and processing efficiency of session data is improved.
In one aspect, an embodiment of the present invention provides a session data processing method, including:
receiving a first session request sent by a Web server, and generating session data according to the first session request;
storing the session data to a local memory;
sending the session data to a first cache device so that the first cache device stores the session data, generating a cache identifier according to the session data, and sending the session data and the cache identifier to a Web server, wherein the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
Optionally, after the sending the session data to the first caching device, the method further includes:
receiving a second session request sent by a Web server, wherein the second session request comprises a cache identifier and a session identifier;
according to the session identification, session data corresponding to the session identification is obtained from the local memory;
and sending the session data corresponding to the session identification to a Web server.
Optionally, after the sending the session data to the first caching device, the method further includes:
receiving a second session request sent by a Web server, wherein the second session request comprises a cache identifier and a session identifier;
according to the session identifier and the cache identifier, session data corresponding to the session identifier is obtained from cache equipment corresponding to the cache identifier;
and sending the session data corresponding to the session identification to a Web server.
Optionally, the obtaining, according to the session identifier and the cache identifier, session data corresponding to the session identifier from a cache device corresponding to the cache identifier includes:
acquiring a proxy server list;
and selecting a first proxy server from the proxy server list, and sending a cache command to the first proxy server, wherein the cache command comprises a session identifier and a cache identifier, so that the first proxy server queries the cache device corresponding to the cache identifier, and acquires session data corresponding to the session identifier from the corresponding cache device.
Optionally, after the sending the session data to the first caching device, the method further includes:
and if the first application server is in a shutdown state, sending the second session request to a second application server, wherein the second session request comprises a cache identifier and a session identifier, so that the second application server obtains a corresponding device identifier according to the cache identifier, obtains session data corresponding to the session identifier from the first cache device corresponding to the device identifier, sends the session data corresponding to the session identifier to a Web server, and stores the session data corresponding to the session identifier to a second cache device.
Optionally, after the sending the session data corresponding to the session identifier to the Web server, the method further includes:
and if the acquired session data is judged to be updated, when the second session request is ended, sending the updated session data to the corresponding cache equipment.
On the other hand, an embodiment of the present invention provides a session data processing system, where the system includes: the system comprises a Web server, a plurality of application servers and a plurality of cache devices, wherein the plurality of application servers at least comprise a first application server, and the plurality of cache devices at least comprise a first cache device;
the Web server is used for sending a first session request to the first application server;
the first application server is used for generating session data according to the first session request;
the first application server is also used for storing the session data to a local memory;
the first application server is further used for sending the session data to a first cache device;
the first cache device is used for storing the session data;
the first cache device is further configured to generate a cache identifier according to the session data, and send the session data and the cache identifier to a Web server, where the cache identifier includes a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
In another aspect, an embodiment of the present invention provides a session data processing apparatus, where the apparatus includes:
the receiving module is used for receiving a first session request sent by the Web server;
the generating module is used for generating session data according to the first session request;
the storage module is used for storing the session data to a local memory;
the sending module is used for sending the session data to a first cache device so that the first cache device stores the session data, generating a cache identifier according to the session data, and sending the session data and the cache identifier to a Web server, wherein the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
On the other hand, an embodiment of the present invention provides a storage medium, where the storage medium includes a stored program, and when the program runs, the apparatus where the storage medium is located is controlled to execute the above session data processing method.
In another aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, where the memory is used to store information including program instructions, and the processor is used to control execution of the program instructions, and the program instructions are loaded by the processor and execute the steps of the above-mentioned session data processing method.
In the technical scheme provided by the embodiment of the invention, a first session request sent by a Web server is received, session data is generated according to the first session request, the session data is stored in a local memory and is sent to a first cache device, so that the first cache device stores the session data, a cache identifier is generated according to the session data, the session data and the cache identifier are sent to the Web server, the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data, and the session data is managed by adopting the cache device, so that the problems of memory increase and serious performance reduction caused by the fact that an application server stores multiple pieces of session data can be avoided, and the processing efficiency of the session data is improved.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 is an architecture diagram of a session data processing system provided by an embodiment of the present invention;
fig. 2 is a flowchart of a session data processing method according to an embodiment of the present invention;
fig. 3 is a flowchart of a session data processing method according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a session data processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a computer device according to an embodiment of the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of associative relationship that describes an associated object, meaning that three types of relationships may exist, e.g., A and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Fig. 1 is an architecture diagram of a session data processing system according to an embodiment of the present invention, and as shown in fig. 1, the system 100 includes: the Web server 1, a plurality of application servers 2, a plurality of proxy servers 3 and a plurality of cache devices 4, wherein the plurality of application servers 2 at least include a first application server 21 and a second application server 22, the plurality of proxy servers at least include a first proxy server 31, and the plurality of cache devices 4 at least include a first cache device 41 and a first cache device 42.
The Web server 1 is used for a first session request sent to the first application server 21.
The first application server 21 is configured to generate session data according to the first session request.
The first application server 21 is also configured to store the session data to a local memory.
The first application server 21 is further configured to send the session data to the first caching device 41.
The first caching device 41 is used to store session data.
The first cache device 41 is further configured to generate a cache identifier according to the session data, and send the session data and the cache identifier to the Web server 1, where the cache identifier includes a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
The first application server 21 is further configured to receive a second session request sent by the Web server, where the second session request includes a cache identifier and a session identifier; according to the session identification, session data corresponding to the session identification is obtained from a local memory; the session data corresponding to the session identification is transmitted to the Web server 1.
The first application server 21 is further configured to receive a second session request sent by the Web server 1, where the second session request includes a cache identifier and a session identifier; according to the session identifier and the cache identifier, session data corresponding to the session identifier is obtained from the cache device corresponding to the cache identifier; the session data corresponding to the session identification is transmitted to the Web server 1.
The first application server 21 is specifically configured to obtain a proxy server list; and selecting the first proxy server from the proxy server list, and sending a cache command to the first proxy server, wherein the cache command comprises a session identifier and a cache identifier, so that the first proxy server queries the cache device corresponding to the cache identifier, and acquires session data corresponding to the session identifier from the corresponding cache device.
The first application server 21 is further configured to send a second session request to the second application server 22 if the first application server 21 is in a shutdown state, where the second session request includes the cache identifier and the session identifier.
The second application server 22 is configured to obtain a corresponding device identifier according to the cache identifier, obtain session data corresponding to the session identifier from the first cache device 41 corresponding to the device identifier, send the session data corresponding to the session identifier to the Web server, and store the session data corresponding to the session identifier in the second cache device 42.
The first application server 21 is further configured to, if it is determined that the acquired session data is updated, send the updated session data to the corresponding cache device when the second session request is ended.
In the embodiment of the present invention, through the above system architecture, when receiving the first session request, the first application server stores the session data in the corresponding cache device, when the first application server fails, the Web server distributes the second session request to the second application server, when the second application server finds that the session data is not in the local memory, the second application server searches in the cache device, and if the corresponding session data is found, the session data is copied to the second application server, so that the session data is managed by using the cache device, thereby avoiding the problems of memory increase and severe performance degradation caused by the application server storing multiple pieces of session data, and improving the processing efficiency of the session data. The following describes the process of the session data processing method in detail with reference to fig. 2 and 3.
Fig. 2 is a flowchart of a session data processing method according to an embodiment of the present invention, and as shown in fig. 2, the method includes:
In the technical scheme provided by the embodiment of the invention, a first session request sent by a Web server is received, session data is generated according to the first session request, the session data is stored in a local memory and is sent to a first cache device, so that the first cache device stores the session data, a cache identifier is generated according to the session data, the session data and the cache identifier are sent to the Web server, the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data, and the session data is managed by adopting the cache device, so that the problems of memory increase and serious performance reduction caused by the fact that an application server stores multiple pieces of session data can be avoided, and the processing efficiency of the session data is improved.
Fig. 3 is a flowchart of a session data processing method according to another embodiment of the present invention, as shown in fig. 3, the method includes:
In the embodiment of the present invention, the first session request includes a first session request, that is, the first application server receives the session request sent by the Web server for the first time.
In the embodiment of the invention, the local memory comprises the memory corresponding to the first application server, and the session data is stored in the local memory through the first application server, so that the session data can be quickly acquired from the local memory when a session request is received next time, and the efficiency of processing the session data is improved.
In the embodiment of the invention, the session data are sent to the first cache device, so that the first cache device stores the session data, and the session data are managed by adopting the cache device, thereby avoiding the problems of memory increase and serious performance reduction caused by the fact that the application server stores a plurality of session data in the local memory, and improving the processing efficiency of the session data.
According to the session data, the cache identifier is generated, so that the session request can be received next time, and when the first application server fails, other application servers can quickly acquire the cache device where the session data is located according to the cache identifier, and quickly acquire the corresponding session data, so that the efficiency of processing the session data is improved. It should be noted that the cache identifier includes a device identifier corresponding to the first cache device and a Session identifier corresponding to the Session data, and a format of the cache identifier is < Session ID > + < Redis ID >, where the Session ID is used to indicate the Session identifier corresponding to the Session data, and the Redis ID is used to indicate the device identifier corresponding to the first cache device.
And step 204, the first application server receives a second session request sent by the Web server, wherein the second session request comprises a cache identifier and a session identifier.
In the embodiment of the present invention, the second session request includes a repeated session request, that is, the first application server receives the session request sent by the Web server for the second time or more.
And step 205, the first application server obtains session data corresponding to the session identifier from the cache device corresponding to the cache identifier according to the session identifier and the cache identifier, and sends the session data corresponding to the session identifier to the Web server.
In this embodiment of the present invention, in step 205, the executing process of "obtaining session data corresponding to the session identifier from the cache device corresponding to the cache identifier according to the session identifier and the cache identifier" may specifically include:
step 2051, the first application server obtains the proxy server list.
Step 2052, the first application server selects the first proxy server from the proxy server list, and sends a cache command to the first proxy server, where the cache command includes the session identifier and the cache identifier, so that the first proxy server queries the cache device corresponding to the cache identifier, and obtains session data corresponding to the session identifier from the corresponding cache device.
In the embodiment of the invention, the proxy server list is established, so that when the cache equipment fails, the proxy server in the proxy server list can send the cache command to other cache equipment, thereby acquiring the session data to provide service for the Web server.
In the embodiment of the present invention, further, the method further includes: and calculating a fragment value corresponding to the session identifier according to the session identifier through a Hash algorithm, and storing the corresponding relation between the fragment value and the cache device in the proxy server list.
In an alternative, as shown in table 1 below, the first application server divides the multiple session data into 1024 fragments, where 0-511 fragments are stored in the first cache device, and 512-1023 fragments are stored in the second cache device, and the number of fragments stored in the first cache device is the same as that stored in the second cache device. For example, when the fragmentation value corresponding to the session identifier is calculated to be 10 by the hash algorithm, it can be determined that the session data is stored in the first cache device.
TABLE 1
First cache device | Second cache device |
0-511 | 512-1023 |
Therefore, the execution process of "the first proxy server queries the cache device corresponding to the cache identifier" in step 2052 may specifically include: and the first proxy server determines the cache device in which the session data corresponding to the fragment value is stored from the plurality of cache devices according to the fragment value corresponding to the session identifier and the corresponding relationship between the fragment value and the cache device.
It should be noted that, the caching device and the proxy server in the embodiment of the present invention are not statically configured, but are dynamically obtained through the storage service, so that horizontal expansion of the caching device and the proxy server is easily achieved.
In the embodiment of the present invention, further, the method further includes: and expanding the capacity of a plurality of cache devices.
Specifically, taking the above table 1 as an example, a third cache device is added on the basis of the table 1, and in order to implement balanced fragmentation, the 341 through 511 fragments and the 512 through 680 fragments are migrated to the third cache device through a management command. The final slice layout is shown in table 2 below:
TABLE 2
First cache device | Second cache device | Third cache device |
0-340 | 681-1023 | 341-680 |
By implementing the fragment layout of table 2 above, the session data corresponding to the 341-680 fragments will be stored in the third cache device, and the session request corresponding to the subsequent fragment will be forwarded to the third cache device. It should be noted that the number of fragments stored in each cache device is the same.
In the embodiment of the present invention, further, the method further includes: and carrying out capacity reduction on a plurality of cache devices.
Specifically, the capacity reduction of the multiple cache devices is opposite to the capacity expansion of the multiple cache devices, and in the example shown in table 2, the data of the 341 and 680 sub-segments are respectively migrated to the first cache device and the second cache device, and the third cache device is removed. The final slice layout is shown in table 1 above.
In the embodiment of the present invention, further, the method further includes: the cache device is divided into a main cache device and an auxiliary cache device, and the session data stored in the main cache device and the session data stored in the auxiliary cache device are the same.
For example, taking the first cache device as an example, the first cache device includes a first primary cache device and a first secondary cache device. By dividing the cache device into the primary cache device and the secondary cache device, when the primary cache device fails, the application server can acquire the session data from the secondary cache device, so that the processing efficiency of the session data is further improved.
Optionally, step 205 may further include: and the first application server acquires the session data corresponding to the session identifier from the local memory according to the session identifier and sends the session data corresponding to the session identifier to the Web server.
In the embodiment of the present invention, the session data is already stored in the local memory of the first application server by executing step 202, so that the first application server can quickly obtain the session data corresponding to the session identifier from the corresponding local memory according to the session identifier, thereby improving the efficiency of processing the session data.
In the embodiment of the present invention, after step 205, the method further includes: and if the first application server or the second application server judges that the acquired session data is updated, when the second session request is finished, the updated session data is sent to the corresponding cache equipment.
In the embodiment of the invention, the updated session data is sent to the corresponding cache device, so that the data replication and synchronization participated by the application server can be reduced, the problem of performance loss is avoided, the service expansion capability of the application server can be improved, and the processing efficiency of the session data is improved.
And step 206, if the first application server is in a halt state, sending a second session request to a second application server, wherein the second session request comprises a cache identifier and a session identifier.
In the embodiment of the invention, when the first application server fails, the Web server distributes the second session request to the second application server, so that the session data is acquired by the second application server, and the normal operation of the service is realized. It should be noted that the second application server may comprise any available node server. The query mode of the second application server can be any available node server queried by the Web server through a load management algorithm.
And step 207, the second application server obtains the corresponding equipment identifier according to the cache identifier.
In the embodiment of the present invention, in step 203, the cache identifier includes an equipment identifier corresponding to the first cache equipment and a session identifier corresponding to the session data, so that the corresponding equipment identifier can be obtained through the cache identifier.
And step 208, the second application server obtains the session data corresponding to the session identifier from the first cache device corresponding to the device identifier.
In the embodiment of the present invention, since the local memory of the second application server does not store the session data, the second application server needs to obtain the session data from the first cache device corresponding to the device identifier. And acquiring the session data through the second application server, so that the Web server can realize normal service operation according to the acquired session data.
And step 209, the second application server sends the session data corresponding to the session identifier to the Web server, and stores the session data corresponding to the session identifier in the second cache device.
In the embodiment of the present invention, by executing step 209, the second application server stores the session data corresponding to the session identifier to the second cache device, so that session data is managed by using the cache device, and session data sharing and high availability are achieved.
In the technical scheme provided by the embodiment of the invention, a first session request sent by a Web server is received, session data is generated according to the first session request, the session data is stored in a local memory and is sent to a first cache device, so that the first cache device stores the session data, a cache identifier is generated according to the session data, the session data and the cache identifier are sent to the Web server, the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data, and the session data is managed by adopting the cache device, so that the problems of memory increase and serious performance reduction caused by the fact that an application server stores multiple pieces of session data can be avoided, and the processing efficiency of the session data is improved.
Fig. 4 is a schematic structural diagram of a session data processing apparatus according to an embodiment of the present invention, and as shown in fig. 4, the apparatus includes: a receiving module 51, a generating module 52, a storing module 53 and a transmitting module 54.
The receiving module 51 is configured to receive a first session request sent by a Web server.
The generating module 52 is configured to generate session data according to the first session request.
The storage module 53 is configured to store the session data in a local memory.
The sending module 54 is configured to send the session data to a first cache device, so that the first cache device stores the session data, generate a cache identifier according to the session data, and send the session data and the cache identifier to a Web server, where the cache identifier includes a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
In the embodiment of the present invention, the apparatus further includes: an acquisition module 55.
The receiving module 51 is further configured to receive a second session request sent by the Web server, where the second session request includes a cache identifier and a session identifier.
The obtaining module 55 is configured to obtain session data corresponding to the session identifier from the local memory according to the session identifier.
The sending module 54 is further configured to send session data corresponding to the session identifier to a Web server.
In the embodiment of the present invention, the apparatus further includes:
the receiving module 51 is further configured to receive a second session request sent by the Web server, where the second session request includes a cache identifier and a session identifier.
The obtaining module 55 is further configured to obtain, according to the session identifier and the cache identifier, session data corresponding to the session identifier from a cache device corresponding to the cache identifier.
The sending module 54 is further configured to send session data corresponding to the session identifier to a Web server.
In the embodiment of the present invention, the obtaining module 55 of the apparatus is specifically configured to obtain a proxy server list; and selecting a first proxy server from the proxy server list, and sending a cache command to the first proxy server, wherein the cache command comprises a session identifier and a cache identifier, so that the first proxy server queries the cache device corresponding to the cache identifier, and acquires session data corresponding to the session identifier from the corresponding cache device.
In the embodiment of the present invention, the apparatus further includes: the sending module 54 is further configured to send the second session request to a second application server if the first application server is in a shutdown state, where the second session request includes a cache identifier and a session identifier, so that the second application server obtains a corresponding device identifier according to the cache identifier, obtains session data corresponding to the session identifier from the first cache device corresponding to the device identifier, sends the session data corresponding to the session identifier to the Web server, and stores the session data corresponding to the session identifier in a second cache device.
In the embodiment of the present invention, the apparatus further includes: the sending module 54 is further configured to, if it is determined that the obtained session data is updated, send the updated session data to the corresponding cache device when the second session request is ended.
In the technical scheme provided by the embodiment of the invention, a first session request sent by a Web server is received, session data is generated according to the first session request, the session data is stored in a local memory and is sent to a first cache device, so that the first cache device stores the session data, a cache identifier is generated according to the session data, the session data and the cache identifier are sent to the Web server, the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data, and the session data is managed by adopting the cache device, so that the problems of memory increase and serious performance reduction caused by the fact that an application server stores multiple pieces of session data can be avoided, and the processing efficiency of the session data is improved.
An embodiment of the present invention provides a storage medium, where the storage medium includes a stored program, where, when the program runs, a device in which the storage medium is located is controlled to execute each step of the above embodiment of the session data processing method, and for specific description, reference may be made to the above embodiment of the session data processing method.
An embodiment of the present invention provides a computer device, including a memory and a processor, where the memory is used to store information including program instructions, and the processor is used to control execution of the program instructions, and the program instructions are loaded and executed by the processor to implement the steps of the session data processing method. For a detailed description, reference may be made to the above-described embodiments of the session data processing method.
Fig. 5 is a schematic diagram of a computer device according to an embodiment of the present invention. As shown in fig. 5, the computer device 6 of this embodiment includes: the processor 61, the memory 62, and the computer program 63 stored in the memory 62 and capable of running on the processor 61, where the computer program 63 is executed by the processor 61 to implement the session data processing method applied in the embodiment, and in order to avoid repetition, details are not repeated herein. Alternatively, the computer program is executed by the processor 61 to implement the functions of each model/unit applied to the session data processing apparatus in the embodiments, and in order to avoid repetition, the description is omitted here.
The computer device 6 includes, but is not limited to, a processor 61, a memory 62. Those skilled in the art will appreciate that fig. 5 is merely an example of a computing device 6 and is not intended to limit computing device 6 and may include more or fewer components than shown, or some of the components may be combined, or different components, e.g., computing device 6 may also include input output devices, network access devices, buses, etc.
The Processor 61 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 62 may be an internal storage unit of the computer device 6, such as a hard disk or a memory of the computer device 6. The memory 62 may also be an external storage device of the computer device 6, such as a plug-in hard disk provided on the computer device 6, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 62 may also include both an internal storage unit of the computer device 6 and an external storage device. The memory 62 is used for storing computer programs and other programs and data required by the computer device 6. The memory 62 may also be used to temporarily store data that has been output or is to be output.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (10)
1. A session data processing method, comprising:
receiving a first session request sent by a Web server, and generating session data according to the first session request;
storing the session data to a local memory;
sending the session data to a first cache device so that the first cache device stores the session data, generating a cache identifier according to the session data, and sending the session data and the cache identifier to a Web server, wherein the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
2. The method of claim 1, wherein after sending the session data to the first caching device, further comprising:
receiving a second session request sent by a Web server, wherein the second session request comprises a cache identifier and a session identifier;
according to the session identification, session data corresponding to the session identification is obtained from the local memory;
and sending the session data corresponding to the session identification to a Web server.
3. The method of claim 1, wherein after sending the session data to the first caching device, further comprising:
receiving a second session request sent by a Web server, wherein the second session request comprises a cache identifier and a session identifier;
according to the session identifier and the cache identifier, session data corresponding to the session identifier is obtained from cache equipment corresponding to the cache identifier;
and sending the session data corresponding to the session identification to a Web server.
4. The method according to claim 3, wherein the obtaining, in the context of the session identifier and the cache identifier, session data corresponding to the session identifier from a cache device corresponding to the cache identifier includes:
acquiring a proxy server list;
and selecting a first proxy server from the proxy server list, and sending a cache command to the first proxy server, wherein the cache command comprises a session identifier and a cache identifier, so that the first proxy server queries the cache device corresponding to the cache identifier, and acquires session data corresponding to the session identifier from the corresponding cache device.
5. The method of claim 1, wherein after sending the session data to the first caching device, further comprising:
and if the first application server is in a shutdown state, sending a second session request to a second application server, wherein the second session request comprises a cache identifier and a session identifier, so that the second application server obtains a corresponding device identifier according to the cache identifier, obtains session data corresponding to the session identifier from the first cache device corresponding to the device identifier, sends the session data corresponding to the session identifier to a Web server, and stores the session data corresponding to the session identifier to a second cache device.
6. The method according to claim 2 or 3, wherein after the sending the session data corresponding to the session identifier to the Web server, further comprising:
and if the acquired session data is judged to be updated, when the second session request is ended, sending the updated session data to the corresponding cache equipment.
7. A conversational data processing system, the system comprising: the system comprises a Web server, a plurality of application servers and a plurality of cache devices, wherein the plurality of application servers at least comprise a first application server, and the plurality of cache devices at least comprise a first cache device;
the Web server is used for sending a first session request to the first application server;
the first application server is used for generating session data according to the first session request;
the first application server is also used for storing the session data to a local memory;
the first application server is further used for sending the session data to a first cache device;
the first cache device is used for storing the session data;
the first cache device is further configured to generate a cache identifier according to the session data, and send the session data and the cache identifier to a Web server, where the cache identifier includes a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
8. A session data processing apparatus, characterized in that the apparatus comprises:
the receiving module is used for receiving a first session request sent by the Web server;
the generating module is used for generating session data according to the first session request;
the storage module is used for storing the session data to a local memory;
the sending module is used for sending the session data to a first cache device so that the first cache device stores the session data, generating a cache identifier according to the session data, and sending the session data and the cache identifier to a Web server, wherein the cache identifier comprises a device identifier corresponding to the first cache device and a session identifier corresponding to the session data.
9. A storage medium, characterized in that the storage medium includes a stored program, wherein, when the program runs, a device in which the storage medium is located is controlled to execute the session data processing method according to any one of claims 1 to 6.
10. A computer device comprising a memory for storing information comprising program instructions and a processor for controlling the execution of the program instructions, characterized in that the program instructions are loaded and executed by the processor to implement the steps of the session data processing method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010346483.6A CN113645261A (en) | 2020-04-27 | 2020-04-27 | Session data processing method, device, storage medium and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010346483.6A CN113645261A (en) | 2020-04-27 | 2020-04-27 | Session data processing method, device, storage medium and computer equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113645261A true CN113645261A (en) | 2021-11-12 |
Family
ID=78415146
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010346483.6A Pending CN113645261A (en) | 2020-04-27 | 2020-04-27 | Session data processing method, device, storage medium and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113645261A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023165429A1 (en) * | 2022-03-01 | 2023-09-07 | 百果园技术(新加坡)有限公司 | Session state management method and system, apparatus, device, and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104580226A (en) * | 2015-01-15 | 2015-04-29 | 上海瀚之友信息技术服务有限公司 | Session data sharing system and method |
CN104735098A (en) * | 2013-12-18 | 2015-06-24 | 青岛海尔空调器有限总公司 | Session information control method and system |
CN105338095A (en) * | 2015-11-17 | 2016-02-17 | 中国建设银行股份有限公司 | Conversation data processing method and device |
CN106973106A (en) * | 2017-03-29 | 2017-07-21 | 中国农业银行股份有限公司 | A kind of method for obtaining session information, apparatus and system |
CN109150936A (en) * | 2017-06-19 | 2019-01-04 | 北京宝兰德软件股份有限公司 | The sharing method and device of session object Session in a kind of distributed type assemblies |
CN109361778A (en) * | 2018-12-18 | 2019-02-19 | 厦门商集网络科技有限责任公司 | A kind of method and terminal managing session |
-
2020
- 2020-04-27 CN CN202010346483.6A patent/CN113645261A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104735098A (en) * | 2013-12-18 | 2015-06-24 | 青岛海尔空调器有限总公司 | Session information control method and system |
CN104580226A (en) * | 2015-01-15 | 2015-04-29 | 上海瀚之友信息技术服务有限公司 | Session data sharing system and method |
CN105338095A (en) * | 2015-11-17 | 2016-02-17 | 中国建设银行股份有限公司 | Conversation data processing method and device |
CN106973106A (en) * | 2017-03-29 | 2017-07-21 | 中国农业银行股份有限公司 | A kind of method for obtaining session information, apparatus and system |
CN109150936A (en) * | 2017-06-19 | 2019-01-04 | 北京宝兰德软件股份有限公司 | The sharing method and device of session object Session in a kind of distributed type assemblies |
CN109361778A (en) * | 2018-12-18 | 2019-02-19 | 厦门商集网络科技有限责任公司 | A kind of method and terminal managing session |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023165429A1 (en) * | 2022-03-01 | 2023-09-07 | 百果园技术(新加坡)有限公司 | Session state management method and system, apparatus, device, and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10209908B2 (en) | Optimization of in-memory data grid placement | |
US10127281B2 (en) | Dynamic hash table size estimation during database aggregation processing | |
CN112199427A (en) | Data processing method and system | |
CN111338806B (en) | Service control method and device | |
CN102523234A (en) | Implementation method and system for clustering of application servers | |
CN114827145B (en) | Server cluster system, metadata access method and device | |
CN111722918A (en) | Service identification code generation method and device, storage medium and electronic equipment | |
US11720593B2 (en) | Managing identifiers for multinodal master systems of unknown or changing size | |
CN110727738B (en) | Global routing system based on data fragmentation, electronic equipment and storage medium | |
CN113094430B (en) | Data processing method, device, equipment and storage medium | |
CN111651424B (en) | Data processing method, device, data node and storage medium | |
CN115470008B (en) | Metadata access method and device and storage medium | |
CN112100152A (en) | Service data processing method, system, server and readable storage medium | |
CN111339057A (en) | Method, apparatus and computer readable storage medium for reducing back-to-source requests | |
CN112948498A (en) | Method and device for generating global identification of distributed system | |
CN114218267A (en) | Query request asynchronous processing method and device, computer equipment and storage medium | |
CN112948178A (en) | Data processing method, device, system, equipment and medium | |
CN113051102A (en) | File backup method, device, system, storage medium and computer equipment | |
CN113645261A (en) | Session data processing method, device, storage medium and computer equipment | |
US10498696B2 (en) | Applying a consistent hash to a distributed domain name server cache | |
CN112579650A (en) | Data processing method and system based on Redis cache | |
CN112328693A (en) | Block synchronization method, device and storage medium | |
CN112395313A (en) | Global sequence generation method and device, electronic equipment and computer storage medium | |
CN111083182B (en) | Distributed Internet of things equipment management method and device | |
CN112231405A (en) | Data storage device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20211112 |