Method and device for determining number of online people
By generating a list of active nodes and deleting invalid session nodes, the problem of inaccurate online user statistics was solved, enabling accurate determination even in abnormal situations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
- Filing Date
- 2024-10-21
- Publication Date
- 2026-04-21
AI Technical Summary
Existing technologies suffer from access anomalies and connection timeouts when determining the number of online users, resulting in low accuracy in determining the number of online users.
By generating a list of active nodes, obtaining the session queues of active nodes, deleting invalid session nodes, and determining the number of online users based on the number of session queues of active nodes.
In cases of access anomalies and connection timeouts, the system can accurately determine the number of online users, thus improving the accuracy of statistical results.
Smart Images

Figure CN121907902A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for determining the number of online users. Background Technology
[0002] To facilitate system operation analysis, it is often necessary to determine the number of online users. Typically, this is done by setting a variable for the number of users and continuously accumulating the number of connections to the system. However, during user access to the system, various situations can occur, such as access errors and connection timeouts, leading to multiple deductions for the same connection. Therefore, the accuracy of the above method for determining the number of online users is not high. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a method and apparatus for determining the number of online users, which can accurately determine the number of online users in the system.
[0004] In a first aspect, embodiments of the present invention provide a method for determining the number of online users, including:
[0005] Identify the multiple service nodes corresponding to the target system;
[0006] A list of active nodes is generated based on the status information of each service node;
[0007] For each active node in the active node list, obtain the session queue of the active node; perform deletion processing on the session queue to remove invalid session nodes from the session queue;
[0008] The number of online users in the target system is determined based on the number of sessions corresponding to the session queues of each active node.
[0009] Optionally, after generating the list of active nodes based on the status information of each service node, the following may also be included:
[0010] An access request for the target system has been received.
[0011] Determine the target service node corresponding to the access request;
[0012] If the session node corresponding to the access request does not exist in the session queue of the target service node, the session node corresponding to the access request is added to the session queue of the target service node.
[0013] Optionally, after receiving an access request for the target system, the process may also include:
[0014] In response to the access request meeting the invalidation condition, the session node corresponding to the access request is removed from the session queue of the target service node.
[0015] Optionally, after generating the list of active nodes based on the status information of each service node, the following may also be included:
[0016] An access request for the target system has been received.
[0017] Determine the target service node corresponding to the access request;
[0018] In response to the target service node not existing in the list of active nodes, the target service node is added to the list of active nodes.
[0019] Optionally, after generating the list of active nodes based on the status information of each service node, the following may also be included:
[0020] Retrieve the current service node from the list of active nodes;
[0021] If the current service node meets the removal criteria, the current service node will be removed from the list of active nodes.
[0022] Optionally, a deletion process is performed on the session queue to remove invalid session nodes from the session queue, including:
[0023] Retrieve the current session node from the session queue;
[0024] Determine the session duration of the current session node;
[0025] In response to a session duration exceeding a duration threshold, the current session node is removed from the session queue of active nodes.
[0026] Secondly, embodiments of the present invention provide a device for determining the number of online users, comprising:
[0027] The node determination module is used to determine multiple service nodes corresponding to the target system;
[0028] The list generation module is used to generate a list of active nodes based on the status information of each service node;
[0029] The queue processing module is used to obtain the session queue of each active node in the active node list; and to perform deletion processing on the session queue to remove invalid session nodes from the session queue.
[0030] The user count determination module is used to determine the number of online users in the target system based on the number of sessions corresponding to the session queues of each active node.
[0031] Thirdly, embodiments of the present invention provide an electronic device, including:
[0032] One or more processors;
[0033] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the methods of any of the above embodiments.
[0034] Fourthly, embodiments of the present invention provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method of any of the above embodiments.
[0035] Fifthly, embodiments of the present invention provide a computer program product, including a computer program, wherein the computer program, when executed by a processor, implements the method of any of the above embodiments.
[0036] One embodiment of the above invention has the following advantages or beneficial effects: An active node list is generated based on the status information of each service node corresponding to the target system. The active node list stores service nodes that are currently active. For each active node in the active node list, a session queue is obtained. The session queue stores relevant information about session nodes accessing the active node. Finally, the number of online users of the target system is determined based on the number of sessions corresponding to the session queues of each active node after deletion processing. Invalid session nodes are deleted from the session queues. Invalid session nodes can be those experiencing access errors, connection timeouts, or other similar issues. Therefore, even in cases of access errors or connection timeouts, the solution of this embodiment can accurately determine the number of online users of the system.
[0037] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0038] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0039] Figure 1 This is a schematic diagram of the process of determining the number of online users according to an embodiment of the present invention;
[0040] Figure 2 This is a schematic diagram of the process of determining the number of online users according to another embodiment of the present invention;
[0041] Figure 3 This is a schematic diagram of the process of determining the number of online users according to another embodiment of the present invention;
[0042] Figure 4 This is a schematic diagram illustrating the principle of a method for determining the number of online users according to an embodiment of the present invention;
[0043] Figure 5This is a schematic diagram of the structure of a device for determining the number of online users according to an embodiment of the present invention;
[0044] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0045] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0046] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of this invention comply with the relevant provisions of national laws and regulations.
[0047] Figure 1 This is a schematic diagram illustrating the flow of a method for determining the number of online users according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0048] Step 101: Identify the multiple service nodes corresponding to the target system.
[0049] Multiple service nodes are used to receive user access requests for the target system and provide users with relevant services from the target system. Setting up multiple service nodes can improve the concurrency and availability of the target system.
[0050] Step 102: Generate a list of active nodes based on the status information of each service node.
[0051] Status information may include: whether the system is down, whether it is running normally, whether it is a scaling-up node, whether it is a scaling-down node, whether it can normally receive user access requests for the target system, whether it can normally provide users with relevant services for the target system, and whether there have been user accesses in the most recent time period. The duration of the most recent time period can be set according to needs. The duration of the most recent time period can be 10 minutes, 30 minutes, 1 hour, etc.
[0052] An active service node can normally receive user access requests for the target system and provide users with relevant services for the target system. An active service node can also be a service node that has been accessed by users in the recent time period.
[0053] Inactive service nodes cannot receive user access requests for the target system, cannot provide users with relevant services for the target system, or have had no user access within the recent time period. Inactive service nodes do not need to be considered when determining the number of online users for the target system.
[0054] An active node list can be maintained on the master node of the target system. This list stores node information for service nodes that are currently active. Node information may include: node identifier, node name, node address, and status information.
[0055] Step 103: For each active node in the active node list, obtain the session queue of the active node; perform a deletion process on the session queue to remove invalid session nodes from the session queue.
[0056] An active node is a service node that is in an active state. Each service node corresponding to the target system maintains its own session queue. The session queue is used to store the session nodes corresponding to that service node. A session node may include: session identifier, user identifier, start time, etc. The session queue can be maintained on the service node corresponding to the session queue. Alternatively, the session queues of each service node can be maintained on the master node of the target system.
[0057] The system can perform deletion processing on the session queue based on preset time intervals, received deletion instructions, received instructions to determine the number of users in the target system, or received instructions to close the connection for an active node. Deletion processing is used to remove invalid session nodes from the session queue. Invalid session nodes can be those that have experienced access errors, connection timeouts, or received connection closure instructions.
[0058] In one embodiment of the present invention, a deletion process is performed on the session queue to delete invalid session nodes in the session queue, including: obtaining the current session node from the session queue; determining the session duration of the current session node; and deleting the current session node from the session queue of active nodes in response to the session duration exceeding a duration threshold.
[0059] The session duration threshold can be set according to requirements. Thresholds can be 2 minutes, 10 minutes, 15 minutes, etc. If the session duration exceeds the threshold, the current session node is considered a timed-out session node and will be removed from the active node's session queue.
[0060] Step 104: Determine the number of online users in the target system based on the number of sessions corresponding to the session queues of each active node.
[0061] The number of sessions for an active node can be the length of its session queue or the number of session nodes in the queue. The sum of the number of sessions corresponding to the session queues of all active nodes is used to determine the number of online users in the target system.
[0062] In the solution of this embodiment of the invention, an active node list is generated based on the status information of each service node corresponding to the target system. For each active node in the active node list, its session queue is obtained. The session queue is used to store relevant information about session nodes accessing the active node. Finally, the number of online users of the target system is determined based on the number of sessions corresponding to the session queues of each active node after deletion processing. Invalid session nodes in the session queue are deleted by performing deletion processing. Therefore, even in cases of access anomalies, connection timeouts, etc., the solution of this embodiment of the invention can accurately determine the number of online users of the system.
[0063] Figure 2 This is a schematic diagram illustrating the flow of a method for determining the number of online users according to another embodiment of the present invention. Figure 2 As shown, the method includes:
[0064] Step 201: Identify the multiple service nodes corresponding to the target system.
[0065] Step 202: Generate a list of active nodes based on the status information of each service node.
[0066] Step 203: Receive an access request for the target system; determine the target service node corresponding to the access request.
[0067] The target service node is the service node that receives and responds to access requests.
[0068] Step 204: In response to the fact that the session node corresponding to the access request does not exist in the session queue of the target service node, add the session node corresponding to the access request to the session queue of the target service node.
[0069] If the session node corresponding to the access request does not exist in the session queue of the target service node, then the session node corresponding to the access request will be added to the session queue of the target service node. If the session node corresponding to the access request already exists in the session queue of the target service node, then no processing is required.
[0070] Determining whether the session node corresponding to the access request exists in the session queue of the target service node includes: determining whether there is an existing session node in the session queue, wherein the session identifier of the existing session node is the same as the session identifier corresponding to the access request, and / or, wherein the user identifier of the existing session node is the same as the user identifier corresponding to the access request.
[0071] Step 205: In response to the fact that the target service node does not exist in the list of active nodes, add the target service node to the list of active nodes.
[0072] If the target service node does not exist in the active node list, add the target service node to the active node list. If the target service node already exists in the active node list, no action is required.
[0073] Determining whether the target service node exists in the list of active nodes includes: determining whether there is an existing service node in the list of active nodes, wherein the node identifier of the existing service node is the same as the node identifier of the target service node.
[0074] It should be noted that, in response to the continuous receipt of user access requests for the target system, the execution process of steps 203-205 will be repeated continuously.
[0075] Step 206: For each active node in the active node list, obtain the session queue of the active node; perform a deletion process on the session queue to remove invalid session nodes from the session queue.
[0076] Step 207: Determine the number of online users in the target system based on the number of sessions corresponding to the session queues of each active node.
[0077] In the solution of this embodiment of the invention, after receiving an access request for the target system, if the session node corresponding to the access request does not exist in the session queue of the target service node, the session node corresponding to the access request is added to the session queue of the target service node; if the target service node does not exist in the active node list, the target service node is added to the active node list. This allows for automatic management of the session queue and the active node list, resulting in more accurate user statistics.
[0078] In one embodiment of the present invention, after generating an active node list based on the status information of each service node, the method further includes: obtaining the current service node from the active node list; and deleting the current service node from the active node list in response to the current service node meeting the removal conditions.
[0079] Removal conditions can be set according to requirements. These conditions may include: service node downtime, service node malfunction, service node being a scaled-down node, service node failing to receive user access requests for the target system, service node failing to provide services related to the target system, and no user access to the service node in the recent time period. A preset time loop or a command to determine the number of online users for the target system can be used to determine if the current service node meets the removal conditions. If the current service node meets the removal conditions, it will be removed from the active node list to ensure that all service nodes in the active node list are active.
[0080] Figure 3 This is a schematic diagram illustrating the flow of a method for determining the number of online users according to another embodiment of the present invention. Figure 3 As shown, the method includes:
[0081] Step 301: Identify the multiple service nodes corresponding to the target system.
[0082] Step 302: Generate a list of active nodes based on the status information of each service node.
[0083] Step 303: Obtain the first service node from the list of active nodes and designate the first node as the current node.
[0084] Step 304: Determine if the current service node meets the removal criteria.
[0085] Removal conditions may include: service node crash, service node malfunction, service node being a scaled-down node, service node being unable to receive user access requests for the target system, service node being unable to provide users with the relevant services for the target system, and service node having no user access in the recent period.
[0086] If the current service node meets the removal criteria, proceed to step 305. If the current service node does not meet the removal criteria, proceed to step 306.
[0087] Step 305: Remove the current service node from the list of active nodes.
[0088] Step 306: Determine whether there is a next node for the current service node in the list of active nodes.
[0089] If a next node for the current service node exists in the list of active nodes, designate the next node as the current node and proceed to step 307. If no next node for the current service node exists in the list of active nodes, proceed to step 308.
[0090] Step 307: Determine the next node as the current node.
[0091] Repeat step 304 until all service nodes in the active node list have been processed.
[0092] It should be noted that the execution process of steps 303-307 can be performed after a preset duration cycle, a list optimization instruction, a determination of the number of users in the target system, or a reduction instruction, to ensure that each node in the active node list corresponds to an active node.
[0093] Step 308: For each active node in the active node list, obtain the session queue of the active node; perform a deletion process on the session queue to remove invalid session nodes from the session queue.
[0094] Step 309: Determine the number of online users in the target system based on the number of sessions corresponding to the session queues of each active node.
[0095] In the solution of this embodiment of the invention, by determining the node status of each service node in the active node list and deleting inactive service nodes from the active node list, it is ensured that each node in the active node list corresponds to an active node. By statistically analyzing the session information of each active node in the active node list, the number of online users of the target system can be quickly and accurately determined.
[0096] The solution in this invention employs an active node list and a session queue for active nodes, which can solve the problem of inaccurate online user statistics when scaling up or down nodes. The session queue has the ability to adjust autonomously; if there are invalid session nodes in the session queue, they can be automatically removed.
[0097] Figure 4 This is a schematic diagram illustrating the principle of a method for determining the number of online users provided in an embodiment of the present invention. Figure 4 The IP list in this embodiment is the active session list. The service nodes in the active session list include: IP1 and IP2. IP1 has just completed server startup, and the number of sessions in IP1 is 0; therefore, all session nodes in IP1's session queue are deleted. IP3 meets the removal criteria, so IP3 is deleted from the active session list.
[0098] The user sends an access request to the target system, and the target service node for this access request is ip2. Since the session node corresponding to the access request does not exist in ip2's session queue, the session node corresponding to the access request is added to ip2's session queue.
[0099] In addition, the duration threshold is set to 10 minutes. The session duration is... Figure 4The connection duration in IP2. If multiple session nodes with session durations exceeding the duration threshold exist in IP2's session queue, these multiple session nodes with session durations exceeding the duration threshold will be removed from IP2's session queue.
[0100] This invention also provides a method for determining the number of online users, the method comprising:
[0101] Step S1. After the service node restarts, the number of online users on the service node starts to accumulate from 0. Therefore, after the service node starts, it will initialize the session queue of the service node and clear all the session nodes existing in the session queue.
[0102] Step S2. When a user accesses the current service node, the user's session node is added to the session queue of the current service node. Specifically, it is determined whether the current service node exists in the active node list. If it does not exist, the current service node is added to the active node list.
[0103] The session duration threshold is set to 10 minutes. If a user's session duration exceeds 10 minutes, the session is determined to be invalid and the session node corresponding to the invalid session needs to be removed from the session queue.
[0104] Step S3. Set the queue timeout to 30 minutes. The lifespan of an active node will be extended based on the number of users in the conversation. If no user accesses the service node for half an hour, the session queue of that service node will expire, and the current service node will be removed from the list of active nodes.
[0105] Step S4. The dialogue ends, and the session node of the current access request is removed from the session queue of the current service node.
[0106] Step S5. Obtain the number of online users. Retrieve all active nodes from the active node list and loop through the session queues of each active node. Sum the session queue lengths of each active node to obtain and return the number of online users.
[0107] If the current service node is not found in the active node list, it means that the current service node has been scaled down or has no active users. Remove the current service node from the active node list.
[0108] If the current service node exists in the active node list, determine if there are any session nodes in the session queue that have exceeded the session duration. If so, remove the session nodes that have exceeded the session duration from the session queue.
[0109] In the solution of this embodiment of the invention, for newly expanded service nodes, whenever a user's conversation is assigned to the newly expanded service node, a session queue will be created on the newly expanded service node, and the newly expanded service node will be added to the active node queue. For scaled-down service nodes, there will be a short delay. If no user accesses the scaled-down service node after a preset time, the scaled-down service node will be deleted from the active node list. In the case of a service node restart, all session nodes in the session queue of that service node will be deleted, so that the number of online users on that service node starts from 0.
[0110] Figure 5 This is a schematic diagram of a device for determining the number of online users according to an embodiment of the present invention. Figure 5 As shown, the device includes:
[0111] The node determination module 501 is used to determine multiple service nodes corresponding to the target system;
[0112] The list generation module 502 is used to generate a list of active nodes based on the status information of each service node;
[0113] The queue processing module 503 is used to obtain the session queue of each active node in the active node list; and to perform deletion processing on the session queue to delete invalid session nodes in the session queue.
[0114] The user count determination module 504 is used to determine the number of online users in the target system based on the number of sessions corresponding to the session queues of each active node.
[0115] Optionally, it also includes:
[0116] The queue addition module is used to receive access requests for the target system;
[0117] Determine the target service node corresponding to the access request;
[0118] If the session node corresponding to the access request does not exist in the session queue of the target service node, the session node corresponding to the access request is added to the session queue of the target service node.
[0119] Optionally, it also includes:
[0120] The queue deletion module is used to delete the session node corresponding to the access request from the session queue of the target service node in response to the access request meeting the invalidation conditions.
[0121] Optionally, it also includes:
[0122] The list addition module is used to receive access requests for the target system;
[0123] Determine the target service node corresponding to the access request;
[0124] In response to the target service node not existing in the list of active nodes, the target service node is added to the list of active nodes.
[0125] Optionally, it also includes:
[0126] The list deletion module is used to retrieve the current service node from the list of active nodes;
[0127] If the current service node meets the removal criteria, the current service node will be removed from the list of active nodes.
[0128] Optionally, the queue processing module 503 is specifically used for:
[0129] Retrieve the current session node from the session queue;
[0130] Determine the session duration of the current session node;
[0131] In response to a session duration exceeding a duration threshold, the current session node is removed from the session queue of active nodes.
[0132] This invention provides an electronic device, comprising:
[0133] One or more processors;
[0134] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the methods of any of the above embodiments.
[0135] This invention provides a computer program product, including a computer program that, when executed by a processor, implements the method of any of the above embodiments.
[0136] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing a terminal device of the present invention. Figure 6 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0137] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0138] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0139] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.
[0140] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0141] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0142] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be located in a processor, and for example, can be described as: a node determination module, a list generation module, a queue processing module, and a number of users determination module. The names of these modules do not necessarily limit the module itself; for example, the node determination module can also be described as "a module for determining multiple service nodes corresponding to a target system".
[0143] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist alone and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include:
[0144] Identify the multiple service nodes corresponding to the target system;
[0145] A list of active nodes is generated based on the status information of each service node;
[0146] For each active node in the active node list, obtain the session queue of the active node; perform deletion processing on the session queue to remove invalid session nodes from the session queue;
[0147] The number of online users in the target system is determined based on the number of sessions corresponding to the session queues of each active node.
[0148] According to the technical solution of this embodiment of the invention, an active node list is generated based on the status information of each service node corresponding to the target system. The active node list stores service nodes that are currently active. For each active node in the active node list, a session queue is obtained. The session queue stores relevant information about session nodes accessing the active node. Finally, the number of online users of the target system is determined based on the number of sessions corresponding to the session queues of each active node after deletion processing. Invalid session nodes are deleted from the session queues. Invalid session nodes can be those experiencing access errors, connection timeouts, or other similar issues. Therefore, even in cases of access errors or connection timeouts, the solution of this embodiment of the invention can accurately determine the number of online users of the system.
[0149] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for determining the number of online users, characterized in that, include: Identify the multiple service nodes corresponding to the target system; Based on the status information of each service node, a list of active nodes is generated; For each active node in the active node list, obtain the session queue of the active node; The session queue is deleted to remove invalid session nodes from the session queue; The number of online users in the target system is determined based on the number of sessions corresponding to the session queues of each active node.
2. The method according to claim 1, characterized in that, After generating the list of active nodes based on the status information of each service node, the process further includes: An access request for the target system has been received. Determine the target service node corresponding to the access request; If the session node corresponding to the access request does not exist in the session queue of the target service node, the session node corresponding to the access request is added to the session queue of the target service node.
3. The method according to claim 2, characterized in that, After receiving the access request for the target system, the process further includes: In response to the access request meeting the invalidation condition, the session node corresponding to the access request is deleted from the session queue of the target service node.
4. The method according to claim 1, characterized in that, After generating the list of active nodes based on the status information of each service node, the process further includes: An access request for the target system has been received. Determine the target service node corresponding to the access request; In response to the fact that the target service node does not exist in the list of active nodes, the target service node is added to the list of active nodes.
5. The method according to claim 1, characterized in that, After generating the list of active nodes based on the status information of each service node, the process further includes: Retrieve the current service node from the list of active nodes; In response to the current service node meeting the removal criteria, the current service node is removed from the list of active nodes.
6. The method according to claim 1, characterized in that, The step of deleting the session queue to remove invalid session nodes from the session queue includes: Retrieve the current session node from the session queue; Determine the session duration of the current session node; In response to the session duration exceeding the duration threshold, the current session node is removed from the session queue of the active nodes.
7. A device for determining the number of online users, characterized in that, include: The node determination module is used to determine multiple service nodes corresponding to the target system; The list generation module is used to generate a list of active nodes based on the status information of each service node. The queue processing module is used to obtain the session queue of each active node in the active node list. The session queue is deleted to remove invalid session nodes from the session queue; The user count determination module is used to determine the number of online users in the target system based on the number of sessions corresponding to the session queues of each active node.
8. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.