CN113014446B - Abnormal offline user detection method, device, server, storage medium and system - Google Patents

Abnormal offline user detection method, device, server, storage medium and system Download PDF

Info

Publication number
CN113014446B
CN113014446B CN202110188374.0A CN202110188374A CN113014446B CN 113014446 B CN113014446 B CN 113014446B CN 202110188374 A CN202110188374 A CN 202110188374A CN 113014446 B CN113014446 B CN 113014446B
Authority
CN
China
Prior art keywords
heartbeat
server
user
timer
user identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110188374.0A
Other languages
Chinese (zh)
Other versions
CN113014446A (en
Inventor
张晓林
茅志翔
秦志雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202110188374.0A priority Critical patent/CN113014446B/en
Publication of CN113014446A publication Critical patent/CN113014446A/en
Application granted granted Critical
Publication of CN113014446B publication Critical patent/CN113014446B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/54Presence management, e.g. monitoring or registration for receipt of user log-on information, or the connection status of the users

Abstract

The invention provides a method, a device, a server, a storage medium and a system for detecting abnormal offline users, wherein a corresponding timer is set in a heartbeat server aiming at a user routed to the heartbeat server, the time of receiving heartbeat data of the user for the last time is recorded in the corresponding timer, a user identifier and a server identifier of the heartbeat server which sets the corresponding timer for the user identifier are correspondingly stored in a heartbeat information database, when the timer of a user in the heartbeat server is overtime, the heartbeat information server is accessed to determine whether the heartbeat server is consistent with the server identifier recorded in the heartbeat information database, and then whether the user is an abnormal offline user is determined, and the reading and writing pressure of the heartbeat information database is reduced.

Description

Abnormal offline user detection method, device, server, storage medium and system
Technical Field
The embodiment of the disclosure relates to the technical field of abnormal offline detection, in particular to a method, a device, a server, a storage medium and a system for detecting abnormal offline users.
Background
For most network applications, it is often necessary to detect whether a user is active, and when it is found that the user is abnormally offline (for example, the user is suddenly offline due to network outage or network breakdown, but the user does not normally exit the network application), corresponding abnormal offline processing may need to be performed. For example, in a scenario of network voice calls between two parties, if one party suddenly goes offline, the other party needs to be notified to disconnect the call.
Disclosure of Invention
The embodiment of the disclosure provides an abnormal offline user detection method, an abnormal offline user detection device, a server, a storage medium and a system.
In a first aspect, an embodiment of the present disclosure provides an abnormal offline user detection method, which is applied to a heartbeat server, and the method includes: determining whether an overtime timer exists in a memory; responding to the fact that the overtime timer exists, and acquiring an overtime user identification corresponding to the overtime timer; inquiring a heartbeat server identifier corresponding to the overtime user identifier in a heartbeat information database; responding to the query, and determining whether the searched heartbeat server identification is the same as the heartbeat server identification of the heartbeat server; and in response to the determination, determining that the user indicated by the overtime user identification is the abnormal offline user.
In some optional embodiments, the method further comprises: and in response to the determination that the user identifier is different from the timeout user identifier or the user identifier is not queried, deleting the timer corresponding to the timeout user identifier in the memory.
In some optional embodiments, the method further comprises: responding to received heartbeat data aiming at a target user identifier sent by a client, and determining whether a timer corresponding to the target user identifier exists in a memory; and in response to determining that the timer corresponding to the target user identifier does not exist, newly establishing a timer corresponding to the target user identifier in a memory, wherein the starting time and the timeout duration of the timer corresponding to the target user identifier are respectively determined based on the current time and the preset heartbeat expiration duration, and correspondingly storing the target user identifier and the heartbeat server identifier of the heartbeat server into the heartbeat information database.
In some optional embodiments, the method further comprises: and in response to the fact that the timer corresponding to the target user identification exists, updating the starting time of the timer corresponding to the target user identification in the memory to be the current time.
In some optional embodiments, the heartbeat data is received by the gateway server from a client and forwarded to the heartbeat server.
In some optional embodiments, the heartbeat server is determined by the gateway server according to the target user identifier in the heartbeat data received from the client by using a hash algorithm.
In some optional embodiments, the method further comprises: and executing preset user abnormal off-line service operation aiming at the determined abnormal off-line user.
In a second aspect, an embodiment of the present disclosure provides an abnormal offline user detection apparatus, which is applied to a heartbeat server, and the apparatus includes: a first determination unit configured to determine whether a timeout timer exists in a memory; the acquiring unit is configured to respond to the fact that the overtime timer exists, and acquire an overtime user identification corresponding to the overtime timer; a query unit configured to query a heartbeat server identifier corresponding to the timeout user identifier in a heartbeat information database; a second determining unit configured to determine, in response to the query, whether the searched heartbeat server identifier is the same as the heartbeat server identifier of the heartbeat server; and the third determining unit is configured to determine that the user indicated by the overtime user identification is the abnormal offline user in response to determining that the user is the same.
In some optional embodiments, the apparatus further comprises: and the deleting unit is configured to delete the timer corresponding to the overtime user identifier in the memory in response to determining that the user identifiers are different or are not inquired.
In some optional embodiments, the apparatus further comprises: a fourth determining unit, configured to determine whether a timer corresponding to a target user identifier exists in a memory in response to receiving heartbeat data sent by a client and directed to the target user identifier; and a new establishing and storing unit configured to, in response to determining that there is no timer corresponding to the target user identifier, establish a new timer corresponding to the target user identifier in a memory, wherein a start time and an timeout duration of the timer corresponding to the target user identifier are determined based on a current time and a preset heartbeat expiration duration, respectively, and store the target user identifier and a heartbeat server identifier of the heartbeat server in the heartbeat information database, correspondingly.
In some optional embodiments, the apparatus further comprises: and the updating unit is configured to respond to the fact that the timer corresponding to the target user identification exists, and update the starting time of the timer corresponding to the target user identification in the memory to be the current time.
In some optional embodiments, the heartbeat data is received by the gateway server from a client and forwarded to the heartbeat server.
In some optional embodiments, the heartbeat server is determined by the gateway server according to the target user identifier in the heartbeat data received from the client by using a hash algorithm.
In some optional embodiments, the apparatus further comprises: and the execution unit is configured to execute preset user abnormal offline service operation aiming at the determined abnormal offline user.
In a third aspect, an embodiment of the present disclosure provides a heartbeat server, including: one or more processors; a storage device, on which one or more programs are stored, which, when executed by the one or more processors, cause the one or more processors to implement the method as described in any implementation manner of the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by one or more processors, implements the method as described in any of the implementations of the first aspect.
In a fifth aspect, an embodiment of the present disclosure provides an abnormal offline user detection system, including: at least two clients, at least one gateway server, at least one heartbeat server as described in the third aspect and a heartbeat information database.
In some optional embodiments, the heartbeat information database stores a user identifier and a heartbeat server identifier correspondingly.
In order to detect abnormal offline users, the currently common solution is: the client of the user sends heartbeat data once every a preset heartbeat period (for example, 10 seconds), the heartbeat data is routed through a gateway (gateway) server and forwarded to a certain heartbeat server in at least one heartbeat server, and the heartbeat server forwarded by the heartbeat data updates the time of receiving the heartbeat data in the heartbeat information database corresponding to the user at the latest time by using the time of receiving the heartbeat data. And the detection server connected with the heartbeat information database regularly scans the corresponding time of receiving the heartbeat data for the last time of all users in the heartbeat information database, and determines the corresponding user of which the time of receiving the heartbeat information for the last time exceeds the preset heartbeat expiration time from the current time as the abnormal off-line user. The abnormal off-line user detection method has the following defects:
(1) in a large-scale user scene, the heartbeat information of all users in the heartbeat information database is regularly scanned by the detection server, and overhigh reading pressure is caused to the heartbeat database; and the heartbeat data sent by each client at each time is written into the heartbeat information database, so that too high writing pressure is caused on the heartbeat information database.
(2) In the process of regularly scanning the heartbeat information database by the detection server, most of the scanned heartbeat information is not overtime, so that the scanning efficiency is low;
(3) when the heartbeat information database shakes, the detection server may not be connected to the heartbeat information database, and thus, whether an abnormal offline user exists or not may not be detected, that is, the abnormal offline user detection service is unavailable.
In order to solve the above technical problem, in the method, the apparatus, the server, the storage medium, and the system for detecting an abnormal offline user provided in the embodiments of the present disclosure, a corresponding timer is set in the heartbeat server for a user routed to the heartbeat server, a time when the heartbeat data of the user is received last time is recorded in the corresponding timer, and a user identifier and a server identifier of the heartbeat server for which the corresponding timer is currently set for the user identifier are correspondingly stored in the heartbeat information database. It may achieve effects including, but not limited to:
firstly, only when a timer corresponding to a certain user in the heartbeat server is overtime, the heartbeat server queries corresponding heartbeat server identification in the heartbeat information database, and compared with the prior art in which the detection server periodically scans heartbeat information of all users, the data reading pressure of the heartbeat database is greatly reduced.
Secondly, the start time in the timer corresponding to the user receiving the heartbeat data is updated in the heartbeat server, instead of writing the time of receiving the heartbeat data each time into the heartbeat database, the server identifier written into the heartbeat information database is only the heartbeat server corresponding to the user, and the time of receiving the heartbeat data most recently is not written, when the heartbeat data of the same user is routed in the gateway server, the heartbeat data of the same user can be routed to the same heartbeat server under most conditions, namely, the change times of the heartbeat server corresponding to the user in the heartbeat information database are less, the heartbeat information database only needs to be written when the heartbeat server corresponding to the user is changed, and compared with the prior art that the time of receiving the heartbeat data of the user each time is written into the heartbeat information database, the data writing pressure is greatly reduced.
Thirdly, in some embodiments, even if the heartbeat data of the user is routed to different heartbeat servers, that is, after the timer of a user is set in more than or equal to two heartbeat servers, the timer of the user in a heartbeat server may be overtime, and after the timer of the user in a heartbeat information database is queried and compared, the timer of the user in the heartbeat server recorded in the heartbeat information database and inconsistent with the heartbeat server corresponding to the overtime user is deleted, so that the problem of inconsistency caused by the creation of multiple timers for the same user by multiple heartbeat servers can be solved.
Drawings
Other features, objects, and advantages of the disclosure will become apparent from a reading of the following detailed description of non-limiting embodiments which proceeds with reference to the accompanying drawings. The drawings are only for purposes of illustrating the particular embodiments and are not to be construed as limiting the invention. In the drawings:
FIG. 1 is a system architecture diagram of one embodiment of an anomalous offline user detection system in accordance with the present disclosure;
FIG. 2 is a flow diagram of one embodiment of an abnormal offline user detection method according to the present disclosure;
FIG. 3 is a flow diagram of yet another embodiment of an abnormal offline user detection method according to the present disclosure;
FIG. 4 is a schematic block diagram illustrating one embodiment of an abnormal offline user detection apparatus according to the present disclosure;
FIG. 5 is a schematic block diagram of a computer system suitable for use as a heartbeat server for implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the figures and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 of an anomalous offline user detection system in accordance with the present disclosure.
As shown in fig. 1, the system architecture 100 may include clients 1011, 1012, 1013, 1014, a network 102, gateway servers 1031, 1032, a network 104, heartbeat servers 1051, 1052, 1053, a network 106, and a heartbeat information database 107. Network 102 is used to provide a medium for communication links between clients 1011, 1012, 1013, 1014 and gateway servers 1031, 1032, and network 104 is used to provide a medium for communication links between gateway servers 1031, 1032 and heartbeat servers 1051, 1052, 1053. Network 106 serves as a medium for providing communication links between heartbeat servers 1051, 1052, 1053 and heartbeat information database 107. Network 102, network 104, and network 106 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
Users may use clients 1011, 1012, 1013, 1014 to interact with gateway servers 1031, 1032 over network 102 and with heartbeat servers 1051, 1052, 1053 over network 104 through gateway servers 1031, 1032 to receive or send messages or the like. The clients 1011, 1012, 1013, 1014 may have various communication client applications installed thereon, such as an audio and video conference application, a network game application, a voice recognition application, a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The clients 1011, 1012, 1013, 1014 may be hardware or software. When the clients 1011, 1012, 1013, 1014 are hardware, they may be various electronic devices having a display screen and supporting sound collection and/or video collection, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, motion Picture Experts compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, motion Picture Experts compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like. When the clients 1011, 1012, 1013, 1014 are software, they may be installed in the electronic devices listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The gateway servers 1031, 1032 may be servers providing various services, for example, the gateway servers 1031, 1032 may route the heartbeat data received from the clients 1011, 1012, 1013, 1014 and forward the heartbeat data to the corresponding heartbeat servers.
The heartbeat servers 1051, 1052, 1053 may be servers providing various services, such as updating the start time in the timer of the corresponding user with heartbeat data issued by the client forwarded from the gateway servers 1031, 1032, and the like.
The heartbeat information database 107 may be used to store a user identification and a corresponding heartbeat server identification.
The gateway servers 1031 and 1032, the heartbeat servers 1051, 1052 and 1053, and the heartbeat information database 107 may be hardware or software. When the gateway servers 1031 and 1032, the heartbeat servers 1051, 1052 and 1053 and the heartbeat information database 107 are hardware, they may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the gateway servers 1031, 1032, the heartbeat servers 1051, 1052, 1053 and the heartbeat information database 107 are software, they may be implemented as a plurality of software or software modules, or may be implemented as a single software or software module. And is not particularly limited herein.
It should be noted that the abnormal offline user detection method provided by the present disclosure is generally executed by the heartbeat servers 1051, 1052, 1053, and accordingly, the abnormal offline user detection apparatus is generally disposed in the heartbeat servers 1051, 1052, 1053.
It should be understood that the number of clients, networks, gateway servers, heartbeat servers, and heartbeat information databases in fig. 1 are merely illustrative. There may be any number of clients, networks, gateway servers, heartbeat servers, and heartbeat information databases, as desired for implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of an abnormal offline user detection method according to the present disclosure is shown. The abnormal offline user detection method is applied to a heartbeat server in an abnormal offline user detection system, the abnormal offline user detection system may include at least two clients, at least one gateway server, at least one heartbeat server and a heartbeat information database, and the process 200 may include the following steps:
step 201, determine whether there is a timeout timer in the memory.
In this embodiment, an executing main body (for example, the heartbeat servers 1051, 1052, and 1053 shown in fig. 1) of the abnormal offline user detection method may determine whether a timeout timer exists in the memory for detecting the abnormal offline user. For example, it may be determined in real time whether there is a timeout timer in memory.
Here, the execution main memory may be provided with timers, each timer may be provided with a corresponding start time and an timeout duration, each timer may correspond to a corresponding user identifier, and the same user identifier corresponds to only one timer in the execution main memory. The starting time in the timer corresponding to the user identifier is the time when the execution main body receives the heartbeat data corresponding to the user identifier most recently, and the timeout duration in each timer is the preset heartbeat timeout duration. The execution main body may receive a message that the timer is overtime when the timer is overtime (that is, a time difference between the current time and the start time of the timer is greater than an overtime duration of the timer), so as to determine that the overtime timer exists in the memory, and may learn which timers are overtime timers.
In step 202, in response to determining that the timeout timer exists, obtaining a timeout user identifier corresponding to the timeout timer.
In this embodiment, if it is determined in step 201 that the timeout timer exists, which indicates that the time when the execution main body receives the heartbeat data corresponding to the user identifier corresponding to the timeout timer most recently exceeds the preset heartbeat timeout period from the current time, the user identifier corresponding to the timeout timer may be obtained, which is the timeout user identifier. Then, go to step 203 to execute.
Step 203, inquiring the heartbeat server identification corresponding to the overtime user identification in the heartbeat information database.
In this embodiment, the execution main body may query, after obtaining the timeout user identifier, a heartbeat server identifier corresponding to the timeout user identifier in a heartbeat information database. Here, the heartbeat information database may store a corresponding relationship between the user identifier and the heartbeat server identifier, where the corresponding relationship is used to represent the heartbeat server that has received the heartbeat data of the user corresponding to the user identifier most recently.
Therefore, here, the heartbeat server identifier corresponding to the timeout user identifier is queried in the heartbeat information database, and if the query indicates that the heartbeat server has received heartbeat data corresponding to the timeout user identifier, the process may go to step 204.
Step 204, determining whether the searched heartbeat server identification is the same as the heartbeat server identification of the heartbeat server.
In this embodiment, the executing main body may determine whether the found heartbeat server identifier is the same as the heartbeat server identifier of the heartbeat server when the heartbeat server identifier corresponding to the timeout user identifier is found in the heartbeat information database in step 203. If the two are the same, it indicates that the heartbeat server that has received the heartbeat data of the user corresponding to the timeout user identifier most recently is the heartbeat server where the execution main body is located, and the time when the execution main body has received the heartbeat data corresponding to the user identifier corresponding to the timeout timer most recently exceeds the preset heartbeat timeout period from the current time, it may be determined that the application corresponding to the timeout user identifier is used for abnormal offline, that is, go to step 205 to execute.
Step 205, determining that the user indicated by the timeout user identifier is an abnormal offline user.
In this embodiment, the executing body may determine that the user indicated by the timeout user identifier is an abnormal offline user when it is determined in step 204 that the found heartbeat server identifier is the same as the heartbeat server identifier of the heartbeat server, and then complete the abnormal offline user detection.
In some optional embodiments, the above flow 200 may further include the following step 206:
in step 206, the timer corresponding to the overtime ue id in the memory is deleted.
Here, in step 203, in the case that the heartbeat server identifier corresponding to the timeout user identifier is not queried in the heartbeat information database, it indicates that there is no data corresponding to the timeout user identifier written in the heartbeat information database by the heartbeat server, and there may be an abnormality, and it is necessary to delete the timer corresponding to the timeout user identifier in the memory of the heartbeat server where the execution main body is located.
Or, in the case that it is determined in step 204 that the found heartbeat server identifier is different from the heartbeat server identifier of the heartbeat server, the execution main body may indicate that the heartbeat server that receives the heartbeat data of the user corresponding to the timeout user identifier most recently is not the heartbeat server where the execution main body is located, but another heartbeat server, and the timer corresponding to the timeout user identifier in the memory of the heartbeat server where the execution main body is located needs to be deleted.
In some optional embodiments, the executing main body may further go to step 206 to execute if the heartbeat server identifier corresponding to the timeout user identifier is queried in the heartbeat information database in step 203.
In some optional embodiments, the above flow 200 may further include the following step 207:
and step 207, executing preset user abnormal offline service operation aiming at the determined abnormal offline user.
Here, the execution main body may execute a preset user abnormal offline service operation for the determined abnormal offline user after step 205. It can be understood that, for different specific services, the preset user abnormal offline service operation may be various corresponding service operations. For example, for an online game application, after determining that the user a is an abnormal offline user, the heartbeat server may call a corresponding program module to notify the user a that the user a is offline while playing the online game, and correspondingly store various information such as the current game progress of the user a.
In the abnormal offline user detection method provided by the above embodiment of the present disclosure, when the timeout timer is detected in the heartbeat server, the user identifier corresponding to the timeout timer is queried in the heartbeat information database, and the user indicated by the timeout user identifier is determined to be the abnormal offline user under the condition that the heartbeat server identifier corresponding to the timeout user identifier stored in the heartbeat information database is the heartbeat server identifier, and there is no need to perform integral scanning on the heartbeat information database, so that the data read pressure on the heartbeat information data is reduced, and the service stability of the heartbeat information database is improved.
With further reference to fig. 3, a flow 300 of yet another embodiment of an abnormal offline user detection method is illustrated. The process 300 of the abnormal offline user detection method includes the following steps:
step 301, in response to receiving heartbeat data for a target user identifier sent by a client, determining whether a timer corresponding to the target user identifier exists in a memory.
In this embodiment, an executing main body (for example, the heartbeat servers 1051, 1052, and 1053 shown in fig. 1) of the abnormal offline user detection method may determine whether a timer corresponding to the target user identifier exists in the memory when receiving heartbeat data for the target user identifier sent by the client. If it is determined that the heartbeat data corresponding to the target user identifier does not exist, it indicates that the heartbeat data corresponding to the target user identifier is forwarded to the heartbeat server where the execution subject is located for the first time, then go to step 302. If the heartbeat data corresponding to the target user identifier is not forwarded to the heartbeat server where the execution main body is located for the first time, the process goes to step 303.
In some optional embodiments, the heartbeat data may be received from the client by the gateway server and forwarded to the heartbeat server where the execution subject is located.
It should be noted that, in practice, the client may send heartbeat data to the gateway server providing the routing and forwarding service for the preset network application in the area where the client is located, at intervals of a preset heartbeat cycle (for example, 10 seconds) for the target user identifier, when the user opens the preset network application. Here, the target user id is used to indicate a user who uses the client to log in the preset web application. Correspondingly, the gateway server may determine, in response to receiving the heartbeat data sent by the client, a target heartbeat server among the at least one heartbeat server according to a preset routing rule and a target user identifier to which the received heartbeat data is directed. For example, a hash algorithm may be used to determine the server identifier of the target heartbeat server according to the target user identifier.
It should be noted that, because the gateway server determines the heartbeat server according to the target user identifier by using a hash algorithm, in most cases, heartbeat data of the same user will be routed to the same heartbeat server.
Step 302, a timer corresponding to the target user identifier is newly built in the memory, and the target user identifier and the heartbeat server identifier of the heartbeat server are correspondingly stored in the heartbeat information database.
Here, if in step 301, the executing main body determines that there is no timer corresponding to the target user identifier, which indicates that the heartbeat data corresponding to the target user identifier is forwarded to the heartbeat server where the executing main body is located for the first time, the executing main body may newly establish a timer corresponding to the target user identifier in the memory, and the start time of the newly established timer corresponding to the target user identifier may be determined based on the current time, and the timeout duration may be determined based on the preset heartbeat expiration duration. For example, the start time may be the current time and the timeout period may be a preset heartbeat expiration period. Here, the preset heartbeat expiration time may be greater than or equal to the preset heartbeat period. For example, the preset heartbeat expiration time may be 60 seconds. And correspondingly storing the target user identifier and the heartbeat server identifier of the heartbeat server into a heartbeat information database, namely storing the corresponding relation between the user identifier and the server identifier of the heartbeat server which receives the heartbeat data corresponding to the user identifier latest in the heartbeat information database.
Step 303, the start time of the timer corresponding to the target user identifier in the memory is updated to the current time.
Here, in step 301, if the execution main body determines that there is a timer corresponding to the target user identifier, which indicates that the heartbeat data corresponding to the target user identifier is not forwarded to the heartbeat server where the execution main body is located for the first time, but the heartbeat data corresponding to the target user identifier is received at present, the execution main body may update the start time of the timer corresponding to the target user identifier in the memory to be the current time, that is, the start time of the timer corresponding to the target user identifier in the memory is the time when the heartbeat data corresponding to the target user identifier is received at the latest.
At step 304, it is determined whether a timeout timer exists in the memory.
Step 305, in response to determining that the timeout timer exists, acquiring a timeout user identifier corresponding to the timeout timer.
Step 306, the heartbeat server identifier corresponding to the overtime user identifier is inquired in the heartbeat information database.
If the query is received, go to step 307 for execution.
If not, go to step 309.
Step 307, it is determined whether the found heartbeat server identification is the same as the heartbeat server identification of the heartbeat server.
And step 308, determining that the user indicated by the overtime user identification is an abnormal offline user.
And 309, deleting the timer corresponding to the overtime user identifier in the memory.
In this embodiment, the specific operations of step 304, step 305, step 306, step 307, step 308, and step 309 and the technical effects thereof are substantially the same as the operations and effects of step 201, step 202, step 203, step 204, step 205, and step 206 in the embodiment shown in fig. 2, and are not repeated herein.
As can be seen from fig. 3, compared with the embodiment corresponding to fig. 2, the process 300 of the abnormal offline user detection method in this embodiment has more steps of creating a timer or updating a timer in the case of receiving heartbeat data in the heartbeat server. Therefore, the scheme described in this embodiment can realize comprehensive abnormal offline user detection, and in comparison with the prior art, the heartbeat information database is written with the heartbeat data sent by each client at each time, the start time in the timer corresponding to the user receiving the heartbeat data is updated in the heartbeat server, instead of writing the time of receiving the heartbeat data into the heartbeat database, and writing the time of receiving the heartbeat data into the heartbeat information database, the server identifier of the heartbeat server corresponding to the user is only written into the heartbeat information database, and the time of receiving the heartbeat data most recently is not written into the heartbeat information database. When heartbeat data of the same user is routed in the gateway server, the heartbeat data of the same user can be routed to the same heartbeat server under most conditions, namely the change times of the heartbeat server corresponding to the user in the heartbeat information database are less, and the heartbeat information database only needs to be written when the heartbeat server corresponding to the user is changed.
With further reference to fig. 4, as an implementation of the methods shown in the above-mentioned figures, the present disclosure provides an embodiment of an abnormal offline user detection apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various heartbeat servers.
As shown in fig. 4, the abnormal offline user detection apparatus 400 of the present embodiment includes: a first determining unit 401, an obtaining unit 402, an inquiring unit 403, a second determining unit 404, a third determining unit 405, and a deleting unit 406. The first determining unit 401 is configured to determine whether a timeout timer exists in the memory; an obtaining unit 402, configured to, in response to determining that the timeout timer exists, obtain an timeout user identifier corresponding to the timeout timer; a query unit 403, configured to query the heartbeat server identifier corresponding to the timeout user identifier in the heartbeat information database; a second determining unit 404, configured to determine, in response to the query, whether the searched heartbeat server identifier is the same as the heartbeat server identifier of the heartbeat server; a third determining unit 405 configured to determine, in response to determining that the user indicated by the timeout user identifier is the abnormal offline user.
In this embodiment, specific processes of the first determining unit 401, the obtaining unit 402, the querying unit 403, the second determining unit 404, the third determining unit 405, and the deleting unit 406 of the abnormal offline user detecting apparatus 400 and technical effects thereof may refer to relevant descriptions of step 201, step 202, step 203, step 204, and step 205 in the corresponding embodiment of fig. 2, which are not described herein again.
In some optional embodiments, the apparatus 400 may further include: and the deleting unit 406 is configured to delete the timer corresponding to the timeout ue in the memory in response to determining that the ue is not the same or is not queried.
In some optional embodiments, the apparatus 400 may further include: a fourth determining unit 407, configured to determine, in response to receiving heartbeat data sent by the client and directed to a target user identifier, whether a timer corresponding to the target user identifier exists in a memory; a new creation and storage unit 408 configured to, in response to determining that there is no timer corresponding to the target user identifier, create a new timer corresponding to the target user identifier in a memory, wherein a start time and an timeout duration of the timer corresponding to the target user identifier are determined based on a current time and a preset heartbeat expiration duration, respectively, and store the target user identifier and a heartbeat server identifier of the heartbeat server in the heartbeat information database, correspondingly.
In some optional embodiments, the apparatus 400 may further include: and an updating unit 409 configured to update the start time of the timer corresponding to the target user identifier in the memory to the current time in response to determining that the timer corresponding to the target user identifier exists.
In some optional embodiments, the heartbeat data may be received from a client and forwarded to the heartbeat server by the gateway server.
In some optional embodiments, the heartbeat server may be determined by the gateway server according to the target user identifier in the heartbeat data received from the client by using a hash algorithm.
In some optional embodiments, the apparatus 400 may further include: an executing unit 410, configured to execute a preset user abnormal offline service operation for the determined abnormal offline user.
It should be noted that, for details of implementation and technical effects of each unit in the abnormal offline user detection apparatus provided in the embodiment of the present disclosure, reference may be made to descriptions of other embodiments in the present disclosure, and details are not described herein again.
Referring now to FIG. 5, shown is a schematic block diagram of a computer system 500 suitable for use as a heartbeat server for implementing embodiments of the present disclosure. The computer system 500 shown in fig. 5 is only an example and should not bring any limitations to the functionality or scope of use of the embodiments of the present disclosure.
As shown in fig. 5, computer system 500 may include a processing device (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage device 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the heartbeat server 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, and the like; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509. The communication means 509 may allow the computer system 500 to communicate with other devices, wireless or wired, to exchange data. While fig. 5 illustrates a computer system 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program, when executed by the processing device 501, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the heartbeat server; or may exist separately and not be installed in the heartbeat server.
The computer readable medium carries one or more programs which, when executed by the heartbeat server, cause the heartbeat server to implement the abnormal offline user detection method as shown in the embodiment shown in fig. 2 or fig. 3 and its optional implementation.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a cell does not in some cases constitute a limitation on the cell itself, for example, the first determination unit may also be described as a "unit that determines whether a timeout timer exists in the memory".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (16)

1. An abnormal offline user detection method is applied to a heartbeat server, and comprises the following steps:
determining whether an overtime timer exists in a memory;
responding to the fact that the overtime timer exists, and acquiring an overtime user identification corresponding to the overtime timer;
inquiring a heartbeat server identifier corresponding to the overtime user identifier in a heartbeat information database;
in response to the query, determining whether the queried heartbeat server identification is the same as a heartbeat server identification of the heartbeat server;
in response to determining that the user indicated by the overtime user identification is the abnormal offline user;
the method further comprises the following steps:
responding to received heartbeat data aiming at a target user identifier sent by a client, and determining whether a timer corresponding to the target user identifier exists in a memory;
and responding to the fact that the timer corresponding to the target user identification does not exist, newly building the timer corresponding to the target user identification in a memory, wherein the starting time and the timeout duration of the timer corresponding to the target user identification are respectively determined based on the current time and the preset heartbeat expiration duration, and correspondingly storing the target user identification and the heartbeat server identification of the heartbeat server to the heartbeat information database.
2. The method of claim 1, further comprising:
and in response to the determination that the user identifier is different from the preset user identifier or the user identifier is not inquired, deleting the timer corresponding to the overtime user identifier in the memory.
3. The method of claim 1, further comprising:
and in response to the fact that the timer corresponding to the target user identification exists, updating the starting time of the timer corresponding to the target user identification in the memory to be the current time.
4. The method of claim 3, wherein the heartbeat data is received from a client and forwarded to the heartbeat server by a gateway server.
5. The method of claim 4, wherein the heartbeat server is determined by the gateway server using a hashing algorithm based on the target user identifier in the heartbeat data received from the client.
6. The method according to any one of claims 1-5, further comprising:
and executing preset user abnormal off-line service operation aiming at the determined abnormal off-line user.
7. An abnormal offline user detection device, applied to a heartbeat server, the device comprising:
a first determination unit configured to determine whether a timeout timer exists in a memory;
an obtaining unit configured to obtain an overtime user identifier corresponding to an overtime timer in response to determining that the overtime timer exists;
a query unit configured to query a heartbeat server identification corresponding to the timeout user identification in a heartbeat information database;
a second determining unit configured to determine, in response to the query, whether the queried heartbeat server identification is the same as the heartbeat server identification of the heartbeat server;
a third determining unit configured to determine that the user indicated by the timeout user identifier is an abnormal offline user in response to determining that the user is the same;
the device further comprises:
the fourth determining unit is configured to determine whether a timer corresponding to a target user identifier exists in a memory in response to receiving heartbeat data, sent by a client, for the target user identifier;
a new establishing and storing unit configured to, in response to determining that there is no timer corresponding to the target user identifier, newly establish a timer corresponding to the target user identifier in a memory, wherein a start time and an timeout duration of the timer corresponding to the target user identifier are determined based on a current time and a preset heartbeat expiration duration, respectively, and correspondingly store the target user identifier and a heartbeat server identifier of the heartbeat server to the heartbeat information database.
8. The apparatus of claim 7, further comprising:
and the deleting unit is configured to delete the timer corresponding to the overtime user identifier in the memory in response to determining that the user identifiers are different or are not inquired.
9. The apparatus of claim 7, further comprising:
and the updating unit is configured to respond to the fact that the timer corresponding to the target user identification exists, and update the starting time of the timer corresponding to the target user identification in the memory to be the current time.
10. The apparatus of claim 9, wherein the heartbeat data is received from a client and forwarded to the heartbeat server by a gateway server.
11. The apparatus according to claim 10, wherein the heartbeat server is determined by the gateway server using a hashing algorithm according to the target user id in the heartbeat data received from the client.
12. The apparatus according to any one of claims 7-11, wherein the apparatus further comprises:
and the execution unit is configured to execute preset user abnormal offline service operation aiming at the determined abnormal offline user.
13. A heartbeat server, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-6.
14. A computer-readable storage medium, on which a computer program is stored, the computer program, when executed by one or more processors, implementing the method of any one of claims 1-6.
15. An abnormal offline user detection system, comprising: at least two clients, at least one gateway server, at least one heartbeat server as claimed in claim 13 and a heartbeat information database.
16. The system according to claim 15, wherein the heartbeat information database has a user identifier and a heartbeat server identifier stored therein, respectively.
CN202110188374.0A 2021-02-10 2021-02-10 Abnormal offline user detection method, device, server, storage medium and system Active CN113014446B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110188374.0A CN113014446B (en) 2021-02-10 2021-02-10 Abnormal offline user detection method, device, server, storage medium and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110188374.0A CN113014446B (en) 2021-02-10 2021-02-10 Abnormal offline user detection method, device, server, storage medium and system

Publications (2)

Publication Number Publication Date
CN113014446A CN113014446A (en) 2021-06-22
CN113014446B true CN113014446B (en) 2022-09-16

Family

ID=76402862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110188374.0A Active CN113014446B (en) 2021-02-10 2021-02-10 Abnormal offline user detection method, device, server, storage medium and system

Country Status (1)

Country Link
CN (1) CN113014446B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110401880A (en) * 2019-07-04 2019-11-01 天脉聚源(杭州)传媒科技有限公司 Off-line checking method, system and the storage medium of virtual spectators

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE602005006746D1 (en) * 2005-04-18 2008-06-26 Research In Motion Ltd Realization of a push service for a wireless terminal with the aid of a push proxy, which monitors the radio coverage state of the terminal
US8874761B2 (en) * 2013-01-25 2014-10-28 Seven Networks, Inc. Signaling optimization in a wireless network for traffic utilizing proprietary and non-proprietary protocols
CN104166589A (en) * 2013-05-17 2014-11-26 阿里巴巴集团控股有限公司 Heartbeat package processing method and device
CN103684911B (en) * 2013-12-05 2017-05-03 北京奇虎科技有限公司 Website online user statistical method and device
CN105578487B (en) * 2014-10-09 2018-11-30 普天信息技术有限公司 A kind of monitoring method and terminal, base station of terminal disconnection
CN106936662B (en) * 2015-12-31 2020-01-31 杭州华为数字技术有限公司 method, device and system for realizing heartbeat mechanism
CN106961364A (en) * 2017-04-24 2017-07-18 努比亚技术有限公司 Heartbeat detecting method and application server

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110401880A (en) * 2019-07-04 2019-11-01 天脉聚源(杭州)传媒科技有限公司 Off-line checking method, system and the storage medium of virtual spectators

Also Published As

Publication number Publication date
CN113014446A (en) 2021-06-22

Similar Documents

Publication Publication Date Title
US9131054B2 (en) Synchronization in unified messaging systems
US20140099930A1 (en) Contact information synchronization system and method
US20190230174A1 (en) Method and Apparatus for Selecting Information Pushed-To Terminal
US20140328478A1 (en) Method and system for identifying prank call, client, server, and storage medium
US9641899B2 (en) Social network creation and interaction
US20110093519A1 (en) System and method of employing a client side device to access local and remote data during communication distruptions
CN110022260B (en) Cross-environment receipt message processing method and system
CN110300165B (en) Method, device and equipment for calling functional program and storage medium
CN109446204B (en) Data storage method and device for instant messaging, electronic equipment and medium
CN112835904A (en) Data processing method and data processing device
EP2974159B1 (en) Method, device and system for voice communication
CN110008037A (en) Message treatment method, device and storage medium
CN112732456A (en) Micro-service calling method and device, electronic equipment and storage medium
CN111460049A (en) Content sharing method and device, electronic equipment and computer readable storage medium
US20210112025A1 (en) Method and server for processing messages
CN113014446B (en) Abnormal offline user detection method, device, server, storage medium and system
WO2013091449A1 (en) Connecting wireless devices
CN110581784B (en) Node health check method, device and equipment
US9058586B2 (en) Identification of a person located proximite to a contact identified in an electronic communication client
CN111161072A (en) Block chain-based random number generation method, equipment and storage medium
CN114513552B (en) Data processing method, device, equipment and storage medium
CN111626802A (en) Method and apparatus for processing information
US20210144048A1 (en) Method and apparatus for outputting information
CN112949326B (en) Information query method, device, equipment and computer readable medium
CN113760929A (en) Data synchronization method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant