A conversation processing method, device, electronic device and storage medium
By obtaining and parsing VNC session files to determine node and session identification, local query is realized instead of remote access, which solves the problem of slow VNC session query speed and high latency, improves query speed and accuracy, and enhances data security. .
Patent Information
- Application Number
- CN202211136824.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-09-19
AI Technical Summary
In the distributed deployment environment, when querying VNC sessions, the existing technology has problems such as slow query speed and high query delay. Especially with the increase in the number of VNC nodes, the query delay further increases.
By obtaining the session file corresponding to the session in the set storage directory, determining the node ID and session ID based on the session file, and determining the session information on each created node based on the node ID and session ID, local query is used instead of remote access to create the node. Get session information.
It reduces the delay in querying VNC sessions, improves the query speed of VNC sessions, ensures that the session files on the creation node are consistent with the session files in the set storage directory on the management node, improves query accuracy, and enhances the efficiency within the cluster. Data security.
Smart Images

Figure CN115422129B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a session processing method, device, electronic device and storage medium. Background Art
[0002] In a distributed deployment environment, a Virtual Networking Computing (VNC) session is created on multiple VNC nodes. VNC is a display system that can transmit a complete window interface on a computer to the screen of another computer through a network.
[0003] When a computing node or management node queries the VNC sessions in the cluster, it usually logs in to each VNC node remotely through the Secure Shell (SSH) protocol to query all VNC sessions of the corresponding VNC node. Only when the computing node or management node logs in to the VNC node through SSH can the number of VNC sessions on the VNC node be obtained.
[0004] This method of logging in to VNC nodes one by one to query VNC sessions has the problems of slow query speed and high query delay. Moreover, as the number of VNC nodes increases, the delay of querying VNC sessions will further increase. Summary of the invention
[0005] The embodiments of the present invention provide a session processing method, device, electronic device and storage medium, which can reduce the time delay of querying a VNC session and improve the query speed of the VNC session.
[0006] According to one aspect of the present invention, there is provided a session processing method, comprising:
[0007] In response to the session query request, obtaining a session file corresponding to the session in the set storage directory;
[0008] Determine a node identifier and a session identifier according to the session file, wherein the node identifier represents an identifier of a creation node that creates the session;
[0009] The session information on each creation node is determined according to the node identifier and the session identifier.
[0010] Optionally, before obtaining the session file corresponding to the session in the set storage directory in response to the session query request, the method further includes:
[0011] Obtaining a target session file corresponding to the session and sent periodically by the creation node;
[0012] The original session file in the set storage directory is updated according to the target session file.
[0013] The original session file is overwritten by the obtained target session file to ensure that the session file on the creation node is consistent with the session file in the storage directory set on the management node.
[0014] Optionally, when the preset scheduled task is triggered, it also includes:
[0015] Query the session file in the setting storage directory to obtain an association relationship between the user identifier and the first process identifier of the session;
[0016] Querying the creation node for a second process identifier of a session corresponding to the user according to the user identifier;
[0017] For each of the user identifiers, if the first process identifier and the second process identifier are inconsistent, the session file corresponding to the first process identifier in the set storage directory is deleted, and the session process corresponding to the second process identifier is deleted through the creation node.
[0018] The above method ensures that the session file on the creation node is consistent with the session file in the storage directory set on the management node, improves the query accuracy, avoids manually creating a new session on the creation node to replace the user's session, and improves the security of data in the cluster.
[0019] Optionally, when the preset scheduled task is triggered, it also includes:
[0020] Obtaining a third process identifier of each session in each of the creation nodes;
[0021] For each of the created nodes, query the session files in the set storage directory according to the node identifier to obtain the session files to be processed;
[0022] Comparing the third process identifier with a fourth process identifier corresponding to the session file to be processed;
[0023] If the fourth process identifier is inconsistent with the third process identifier, the to-be-processed session file corresponding to the fourth process identifier in the setting storage directory is deleted.
[0024] The above method reduces the situation where the session cleaning process on the creation node is not immediately reported to the management node, which affects the accuracy of the session query, and improves the query accuracy.
[0025] Optionally, in response to the session query request, obtaining a session file corresponding to the session in a set storage directory includes:
[0026] In response to the session query request, executing a start query script, wherein the start query script is used to configure the query script and set a storage path of the storage directory;
[0027] The query script is used to obtain the session file corresponding to the session in the set storage directory based on the storage path.
[0028] By starting the query script to configure the query script and setting the storage path of the storage directory, the session file is queried according to the storage path through the query script, which simplifies the session query method and improves the session query speed.
[0029] Optionally, determining the node identifier and the session identifier according to the session file includes:
[0030] The file name of the session file is parsed according to the session file naming rule to obtain a node identifier and a session identifier.
[0031] The node identifier and the session identifier are obtained by parsing the file name of the session file, which shortens the query time of the node identifier and the session identifier and improves the session query speed.
[0032] Optionally, determining the session information on each creation node according to the node identifier and the session identifier includes:
[0033] Determine, according to the node identifier and the session identifier, the session identifier corresponding to each of the node identifiers;
[0034] The number of sessions on each creation node is determined according to the session identifier corresponding to each node identifier.
[0035] The number of sessions on each creation node is determined by the node identifier and the session identifier, so as to avoid the situation where the number of sessions is queried by logging into each creation node one by one, thereby improving the session query speed.
[0036] According to another aspect of the present invention, a session processing device is provided, the device comprising:
[0037] A file acquisition module, used to respond to a session query request and acquire a session file corresponding to the session in a set storage directory;
[0038] An identifier determination module, used to determine a node identifier and a session identifier according to the session file, wherein the node identifier represents an identifier of a creation node that creates the session;
[0039] The session determination module is used to determine the session information on each creation node according to the node identifier and the session identifier.
[0040] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0041] at least one processor; and
[0042] a memory communicatively connected to the at least one processor; wherein,
[0043] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the session processing method described in any embodiment of the present invention.
[0044] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the session processing method described in any embodiment of the present invention when executed.
[0045] The technical solution of the embodiment of the present invention obtains the session file under the set storage directory, determines the node identifier and the session identifier according to the session file, and determines the session information on each creation node according to the node identifier and the session identifier, and obtains the session information by local query instead of remote access to the creation node, thereby solving the problems of slow session query speed and high query delay in the related technology, thereby achieving the effect of reducing the delay in querying VNC sessions and improving the query speed of VNC sessions.
[0046] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A flow chart of a session processing method is provided for an embodiment of the present invention;
[0049] Figure 2 A flowchart of another session processing method provided by an embodiment of the present invention;
[0050] Figure 3 A flowchart of another session processing method provided by an embodiment of the present invention;
[0051] Figure 4 A structural diagram of a session processing device provided by an embodiment of the present invention
[0052] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0053] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0054] It should be noted that the terms "first", "second", "target", "original", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.
[0055] In addition, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, product, or apparatus.
[0056] Figure 1 A flow chart of a session processing method is provided for an embodiment of the present invention. This embodiment is applicable to the case where a computing node or a management node in a distributed cluster queries session information on a creation node. The method can be executed by a session processing device, which can be implemented in the form of hardware and / or software. The session processing device can be configured in an electronic device. For example, the electronic device includes a server or a server configured as a management node in a server cluster. Figure 1 As shown, the method includes:
[0057] S110. In response to the session query request, obtain a session file corresponding to the session in a set storage directory.
[0058] The session query request is a request for querying session information on a specific creation node in the cluster. The session query request can be issued by a user through a computing node or a management node in the cluster, and responded by the management node. For example, a user inputs a session query request through a computing node, and the computing node sends the session query request to an activated management node. Alternatively, a user inputs a session query request through an activated management node, etc. It should be noted that a cluster can have multiple management nodes, but only one management node is activated at the same time.
[0059] The storage directory is set as the file storage directory for storing session files in the management node. A scheduled task is set on the creation node. When the scheduled task is triggered, the creation node copies all session files under the session directory on the current node to the set storage directory of all management nodes. Optionally, the management node uses the target session file newly sent by the creation node to overwrite the original session file. The original session file is the session file that already exists in the set storage directory of the management node before the overwriting operation.
[0060] In some embodiments, the session may be a VNC session, the creation node may be a VNC node, and the session file may be a VNC session file. The VNC session file may be synchronized by the VNC node to the session directory of the management node at regular intervals, so that the VNC session file is stored in the session directory of the management node.
[0061] The session corresponds to the session file. After the creation node creates the session, it will create the session file of the session in the session directory of the current node. Taking the creation of a VNC session as an example, since the creation of a VNC session may be initiated by a computing node or a management node, a script for starting to create a VNC session is configured on the computing node or the management node. The script for starting to create a VNC session is used to configure the creation node, login information, and creation script. The creation script is used to configure the display information, user name, and password of the window interface. When the computing node or the management node obtains the VNC session creation operation, the script for starting to create a VNC session is executed, and the creation node configured in the script for starting to create a VNC session is logged in through the SSH protocol. A case where a VNC session is created on a creation node, the creation script is executed on the current node through the creation node. A case where a VNC session is created on multiple creation nodes, the management node executes the script for starting to create a VNC session, logs in to each creation node through the SSH protocol, and executes the creation script on the corresponding node through each creation node. For each creation node, executing the creation script will call the vncserver command to create a VNC session. The vncserver command is a command for the server to provide VNC management services. After the VNC session is created, the session file of the VNC session is created in the session directory of the node that created the VNC session. When the scheduled task on the creation node is triggered, all session files in the session directory on the current creation node are copied to the set storage directory of all management nodes.
[0062] In some embodiments, the management node obtains the target session file corresponding to the session sent periodically by the creation node; overwrites the original session file in the set storage directory according to the target session file, and implements the periodic update of the session file in the set storage directory, thereby ensuring that the session file stored in the management node reflects the real session information on the creation node as much as possible.
[0063] Exemplarily, in response to a session query request, a start query script is executed, wherein the start query script is used to configure the query script and set the storage path of the storage directory. The query script is used to obtain the session file corresponding to the session in the set storage directory based on the storage path.
[0064] Specifically, in response to the session query request, a script for starting to query the number of VNC sessions is executed. Since the script for starting to query the number of VNC sessions contains the script identifier of the query script for the number of VNC sessions and the storage path of the VNC session file, the script for starting to query the number of VNC sessions is executed, the script identifier of the query script and the storage path of the VNC session file are obtained, the query script corresponding to the script identifier is executed, and the session file corresponding to the VNC session in the set storage directory is obtained based on the storage path.
[0065] S120: Determine a node identifier and a session identifier according to the session file.
[0066] The node identifier represents the identifier of the creation node of the session creation. In a large cluster with multiple nodes, load balancing is performed by adding a creation node. Therefore, the creation node is a node in the cluster, and a session is created by creating the node. For example, the node identifier can be identification information such as an IP address, a MAC address, etc. that can uniquely identify the creation node.
[0067] The session identifier is an identifier for representing a session on a creation node. A session may be represented by a session identifier. For example, the session identifier may be a session number, etc.
[0068] In some embodiments, the session file may be named based on the node identifier and the session identifier. For example, the file name of the session file may include the node identifier and the session identifier.
[0069] Exemplarily, the file name of the session file is parsed according to the session file naming rule to obtain the node identifier and the session identifier.
[0070] S130: Determine session information on each creation node according to the node identifier and the session identifier.
[0071] The session information may be information about the number of sessions on the creation node. The number of sessions created on the corresponding creation node may be determined through the session information, thereby obtaining the load condition of the creation node.
[0072] Exemplarily, the session identifier corresponding to each node identifier is determined according to the node identifier and the session identifier; and the number of sessions on each creation node is determined according to the session identifier corresponding to each node identifier.
[0073] Specifically, the session identifiers are grouped according to the node identifiers, and the session identifiers in each group are determined to be the session identifiers corresponding to the corresponding node identifiers. For example, the session identifiers with the same node identifier can be grouped into the same group, and the session identifiers in the group are the session identifiers corresponding to the corresponding node identifiers. The number of session identifiers corresponding to each node identifier is counted, and the number of session identifiers corresponding to each node identifier is used as the number of sessions on each created node.
[0074] The technical solution of the embodiment of the present invention obtains the session file under the set storage directory, determines the node identifier and the session identifier according to the session file, and determines the session information on each creation node according to the node identifier and the session identifier, and obtains the session information by local query instead of remote access to the creation node, thereby solving the problems of slow session query speed and high query delay in the related technology, thereby achieving the effect of reducing the delay in querying VNC sessions and improving the query speed of VNC sessions.
[0075] Figure 2 This is a flow chart of another session processing method provided by an embodiment of the present invention. Based on the above embodiment, this embodiment also adds a feature of updating the session file according to the process identifier. Figure 2 As shown, the method includes:
[0076] S210: Detecting that a preset timed task is triggered.
[0077] The preset scheduled tasks are scheduled tasks set on the management node.
[0078] S220: Query the session file in the setting storage directory to obtain an association relationship between the user identifier and the first process identifier of the session.
[0079] The first process identifier is identification information of a process executing a VNC session created by a user and stored in the session file. The first process identifier is associated with the user identifier and stored in the session file.
[0080] When the preset timed task is triggered, the management node queries the session file in the set storage directory, and obtains the user identifier and the first process identifier corresponding to the user identifier according to the file content of the session file.
[0081] S230: Query the creation node for a second process identifier of a session corresponding to the user according to the user identifier.
[0082] The second process identifier is identification information of a process executing a session created by a user on the creation node, and the second process identifier is associated with the user identifier and stored on the creation node.
[0083] The management node logs in to the corresponding VNC node through the SSH protocol according to the node identifier in the file name, queries the VNC node according to the user identifier stored in the corresponding session file, and obtains the second process identifier of the VNC session of the corresponding user.
[0084] For example, when a scheduled task on a management node is triggered, the VNC node is logged in through the SSH protocol to query the VNC session on the VNC node.
[0085] S240. For each of the user identifiers, if the first process identifier and the second process identifier are inconsistent, delete the session file corresponding to the first process identifier in the set storage directory, and delete the session process corresponding to the second process identifier through the creation node.
[0086] After the user manually deletes the VNC session on the VNC node, if the scheduled task of the VNC node is not triggered, the VNC node will not immediately report the deletion event of the VNC session to the management node, resulting in the existence of the session file corresponding to the deleted VNC session in the set storage directory of the management node. If the number of sessions of the VNC node is queried at this time, the query result will be inaccurate. In addition, if a new session is manually created on the VNC node to replace the user's session, although the number of VNC sessions on the VNC node has not changed, there may be a malicious intrusion into the VNC node to create an abnormal VNC session, which poses a security threat to the data in the cluster.
[0087] In order to improve the query accuracy, for each user ID, compare the first process ID corresponding to the user ID and the second process ID of the VNC session of the user corresponding to the user ID. If the first process ID and the second process ID are consistent, then give up deleting the session file corresponding to the first process ID under the set storage directory. If the first process ID and the second process ID are inconsistent, then delete the session file corresponding to the first process ID under the set storage directory, log in to the VNC node corresponding to the session file through the SSH protocol, and delete the session process corresponding to the second process ID through the VNC node.
[0088] For example, the management node determines the deleted VNC session on the VNC node based on the VNC session queried from the VNC node and the session file in the setting storage directory, and executes the deletion script to delete the session file corresponding to the deleted VNC process in the setting storage directory.
[0089] S250: Obtain a third process identifier of each session in each creation node.
[0090] The third process identifier is a process identifier of each VNC session in the creation node.
[0091] Exemplarily, when the scheduled task on the management node is triggered, each VNC node is logged in through the SSH protocol, the VNC process of each VNC session in each VNC node is acquired, and the third process identifier of each VNC session is obtained.
[0092] S260: For each of the created nodes, query the session files in the set storage directory according to the node identifier to obtain the session files to be processed.
[0093] Since multiple sessions may be created on a creation node, multiple session files exist accordingly. For each creation node, all session files in the storage directory can be queried according to the node identifier to obtain the session file corresponding to the session created on the creation node as the session file to be processed.
[0094] For example, for each VNC node, the file names of all session files in the storage directory are queried according to the node identifier, and the session file corresponding to the file name containing the node identifier is obtained as the session file to be processed.
[0095] S270: Compare the third process identifier with a fourth process identifier corresponding to the session file to be processed.
[0096] After the user manually cleans up the VNC process on the VNC node, if the scheduled task of the VNC node is not triggered, the VNC node will not immediately report the VNC process cleanup event to the management node, resulting in the session file corresponding to the cleaned VNC process still existing in the setting storage directory of the management node. If the number of sessions of the VNC node is queried at this time, the query result will be inaccurate.
[0097] Exemplarily, the fourth process identifier in each session file to be processed is obtained, the third process identifier is compared with the fourth process identifier, and it is determined whether to synchronously delete the session file corresponding to the cleaned VNC process in the set storage directory of the management node according to the comparison result.
[0098] S280: If the fourth process identifier is inconsistent with the third process identifier, delete the to-be-processed session file corresponding to the fourth process identifier in the setting storage directory.
[0099] Exemplarily, since the association between the user identifier and the VNC process is stored in the VNC session file, if the fourth process identifier of the VNC session is inconsistent with the third process identifier, the VNC session file containing the fourth process identifier in the setting storage directory is deleted. If the fourth process identifier of the VNC session is consistent with the third process identifier, the deletion of the VNC session file containing the fourth process identifier in the setting storage directory is abandoned.
[0100] Optionally, the management node determines the cleaned VNC process on the VNC node according to the VNC process queried from the VNC node and the session files in the setting storage directory, and executes a cleanup script to delete the session files corresponding to the cleaned VNC process in the setting storage directory.
[0101] It should be noted that the execution order of S210 to S240 and S250 to S280 is not limited to the order listed above. S250 to S280 can be executed first and then S210 to S240, or S210 to S240 and S250 to S280 can be executed in parallel, or S250 to S280 can be executed interspersed during the execution of S210 to S240, or only S210 to S240 can be executed, or only S250 to S280 can be executed. The present invention does not make specific limitations on this.
[0102] The technical solution of the embodiment of the present invention improves the security of data in the cluster by querying the first process identifier in the session file that is inconsistent with the second process identifier of the corresponding user's session when the preset timed task is triggered, deleting the session file corresponding to the first process identifier in the set storage directory, and deleting the session process corresponding to the second process identifier, thereby avoiding the situation where a new session is manually created at the creation node to replace the user's session, and improving the security of data in the cluster. In addition, when the preset timed task is triggered, the third process identifier of each session in each creation node is obtained, the fourth process identifier in the session file that is inconsistent with the third process identifier is queried, and the session file corresponding to the fourth process identifier in the set storage directory is deleted, thereby reducing the situation where the session cleanup process on the creation node will not be immediately reported to the management node, which affects the accuracy of the session query, and improving the query accuracy.
[0103] Figure 3 A flowchart of another session processing method provided by an embodiment of the present invention is as follows: Figure 3 As shown, the method includes:
[0104] S301: Obtain a target session file corresponding to a session and sent periodically by the creation node.
[0105] S302: Update the original session file in the set storage directory according to the target session file.
[0106] S303: When the preset timed task is triggered, query the session file in the set storage directory to obtain the association relationship between the user identifier and the first process identifier of the session.
[0107] S304: Query the creation node for a second process identifier of a session corresponding to the user according to the user identifier.
[0108] S305: For each user identifier, if the first process identifier and the second process identifier are inconsistent, delete the session file corresponding to the first process identifier in the set storage directory, and delete the session process corresponding to the second process identifier through the creation node.
[0109] S306: When the preset timed task is triggered, obtain the third process identifier of each session in each creation node.
[0110] S307: For each of the created nodes, query the session files in the set storage directory according to the node identifier to obtain the session files to be processed.
[0111] S308: Compare the third process identifier with a fourth process identifier corresponding to the session file to be processed.
[0112] S309: If the fourth process identifier is inconsistent with the third process identifier, delete the to-be-processed session file corresponding to the fourth process identifier in the setting storage directory.
[0113] S310. In response to a session query request, execute a start query script, wherein the start query script is used to configure a query script and set a storage path of a storage directory.
[0114] S311. Obtain, through the query script and based on the storage path, a session file corresponding to the session in the set storage directory.
[0115] S312: Parse the file name of the session file according to the session file naming rule to obtain a node identifier and a session identifier.
[0116] S313: Determine the session identifier corresponding to each of the node identifiers according to the node identifiers and the session identifiers.
[0117] S314: Determine the number of sessions on each creation node according to the session identifier corresponding to each node identifier.
[0118] It should be noted that the execution order of S301 to S302, S303 to S305, and S306 to S309 is not limited to the order listed above, and the execution order of S301 to S302, S303 to S305, and S306 to S309 can be exchanged according to the actual application scenario. In addition, S301 to S309 is not necessarily executed before S310 to S314, but may be executed after S310 to S314, or interspersed in the execution process of S310 to S314, and the embodiments of the present disclosure do not specifically limit this.
[0119] Figure 4 A schematic diagram of the structure of a session processing device provided by an embodiment of the present invention. Figure 4 As shown, the device includes: a file acquisition module 410, an identification determination module 420 and a session determination module 430.
[0120] The file acquisition module 410 is used to respond to the session query request and acquire the session file corresponding to the session in the set storage directory;
[0121] An identifier determination module 420, configured to determine a node identifier and a session identifier according to the session file, wherein the node identifier represents an identifier of a creation node that creates the session;
[0122] The session determination module 430 is used to determine the session information on each creation node according to the node identifier and the session identifier.
[0123] The technical solution of the embodiment of the present invention obtains the session file under the set storage directory, determines the node identifier and the session identifier according to the session file, and determines the session information on each creation node according to the node identifier and the session identifier, and obtains the session information by local query instead of remote access to the creation node, thereby solving the problems of slow session query speed and high query delay in the related technology, thereby achieving the effect of reducing the delay in querying VNC sessions and improving the query speed of VNC sessions.
[0124] Optionally, the device further comprises:
[0125] A file updating module, configured to obtain a target session file corresponding to the session sent regularly by the creation node before obtaining the session file corresponding to the session in the set storage directory in response to the session query request;
[0126] The original session file in the set storage directory is updated according to the target session file.
[0127] Optionally, the file update module is further used to:
[0128] When the preset timed task is triggered, query the session file in the set storage directory to obtain the association relationship between the user identifier and the first process identifier of the session;
[0129] Querying the creation node for a second process identifier of a session corresponding to the user according to the user identifier;
[0130] For each of the user identifiers, if the first process identifier and the second process identifier are inconsistent, the session file corresponding to the first process identifier in the set storage directory is deleted, and the session process corresponding to the second process identifier is deleted through the creation node.
[0131] Optionally, the file update module is further used to:
[0132] When the preset timed task is triggered, obtaining the third process identifier of each session in each creation node;
[0133] For each of the created nodes, query the session files in the set storage directory according to the node identifier to obtain the session files to be processed;
[0134] Comparing the third process identifier with a fourth process identifier corresponding to the session file to be processed;
[0135] If the fourth process identifier is inconsistent with the third process identifier, the to-be-processed session file corresponding to the fourth process identifier in the setting storage directory is deleted.
[0136] Optionally, the file acquisition module 410 is specifically used for:
[0137] In response to the session query request, executing a start query script, wherein the start query script is used to configure the query script and set a storage path of the storage directory;
[0138] The query script is used to obtain the session file corresponding to the session in the set storage directory based on the storage path.
[0139] Optionally, the identification determination module 420 is specifically configured to:
[0140] The file name of the session file is parsed according to the session file naming rule to obtain a node identifier and a session identifier.
[0141] Optionally, the session determination module 430 is specifically configured to:
[0142] Determine, according to the node identifier and the session identifier, the session identifier corresponding to each of the node identifiers;
[0143] The number of sessions on each creation node is determined according to the session identifier corresponding to each node identifier.
[0144] The session processing device provided in the embodiment of the present invention can execute the session processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0145] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, Figure 5 The structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0146] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0147] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0148] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the session processing method.
[0149] In some embodiments, the session processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the session processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the session processing method in any other appropriate manner (e.g., by means of firmware).
[0150] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0151] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0152] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0154] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0155] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0156] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0157] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A session processing method, characterized in that: include: In response to the session query request, obtaining a session file corresponding to the session in the set storage directory; Determine a node identifier and a session identifier according to the session file, wherein the node identifier represents an identifier of a creation node that creates the session; Determine the session information on each creation node according to the node identifier and the session identifier; When the preset timed task is triggered, it also includes: Query the session file in the setting storage directory to obtain an association relationship between the user identifier and the first process identifier of the session; Querying the creation node for a second process identifier of a session corresponding to the user according to the user identifier; For each of the user identifiers, if the first process identifier and the second process identifier are inconsistent, the session file corresponding to the first process identifier in the set storage directory is deleted, and the session process corresponding to the second process identifier is deleted through the creation node.
2. The method according to claim 1, characterized in that Before the step of obtaining the session file corresponding to the session in the set storage directory in response to the session query request, the method further includes: Obtaining a target session file corresponding to the session and sent periodically by the creation node; The original session file in the set storage directory is updated according to the target session file.
3. The method according to claim 1 or 2, characterized in that: When the preset timer task is triggered, it also includes: Obtaining a third process identifier of each session in each of the creation nodes; For each of the created nodes, query the session files in the set storage directory according to the node identifier to obtain the session files to be processed; Comparing the third process identifier with a fourth process identifier corresponding to the session file to be processed; If the fourth process identifier is inconsistent with the third process identifier, the to-be-processed session file corresponding to the fourth process identifier in the setting storage directory is deleted.
4. The method according to claim 1, characterized in that: The step of obtaining, in response to the session query request, a session file corresponding to the session in a set storage directory includes: In response to the session query request, executing a start query script, wherein the start query script is used to configure the query script and set a storage path of the storage directory; The query script is used to obtain the session file corresponding to the session in the set storage directory based on the storage path.
5. The method according to claim 1, characterized in that The determining the node identifier and the session identifier according to the session file comprises: The file name of the session file is parsed according to the session file naming rule to obtain a node identifier and a session identifier.
6. The method according to claim 1, characterized in that The determining, according to the node identifier and the session identifier, session information on each creation node includes: Determine, according to the node identifier and the session identifier, the session identifier corresponding to each of the node identifiers; The number of sessions on each creation node is determined according to the session identifier corresponding to each node identifier.
7. A session processing device, characterized in that: include: A file acquisition module, used to respond to a session query request and acquire a session file corresponding to the session in a set storage directory; An identifier determination module, used to determine a node identifier and a session identifier according to the session file, wherein the node identifier represents an identifier of a creation node that creates the session; A session determination module, used to determine the session information on each creation node according to the node identifier and the session identifier; The session processing device also includes: A file update module, used for querying the session file in the set storage directory when the preset timer task is triggered, and obtaining the association relationship between the user identifier and the first process identifier of the session; Querying the creation node for a second process identifier of a session corresponding to the user according to the user identifier; For each of the user identifiers, if the first process identifier and the second process identifier are inconsistent, the session file corresponding to the first process identifier in the set storage directory is deleted, and the session process corresponding to the second process identifier is deleted through the creation node.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the session processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the session processing method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Message processing method, system and equipment thereof
CN102208988A