Client Survival Awareness Method, Device, Computer Equipment and Readable Storage Medium

By combining heartbeat detection and service requests, the target heartbeat value and detection status of the client are updated, and the problems of low efficiency and high energy consumption caused by frequent sending heartbeat packets in long connections are solved, and efficient and low-energy-consuming client survival detection is achieved.

CN116248562BActive Publication Date: 2025-05-27PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310142901.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-09
Publication Date
2025-05-27
Estimated Expiration
2043-02-09

AI Technical Summary

Technical Problem

Frequently sending unnecessary heartbeat packets with long connections, resulting in low heartbeat detection efficiency and high energy consumption.

Method used

By intercepting the target request sent by the target client, combining heartbeat detection and service requests, the target heartbeat value of the target client is updated, and the heartbeat detection status is updated according to the comparison results to reduce the sending of useless heartbeat packets.

Benefits of technology

It realizes high-efficiency and low-energy-consuming client survival detection, reducing the problems of resource waste and inefficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116248562B_ABST
    Figure CN116248562B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, computer device and readable storage medium for client survival perception, which relates to the field of Internet technology. This method abstracts the computing and processing work to the server side, combines heartbeat detection with business requests to avoid the sending of redundant heartbeat packets, thereby achieving high-efficiency and low-power consumption survival detection. The method includes: intercepting a target request sent by a target client, where the target request includes a heartbeat request and a business request, and the target client sends the heartbeat request based on the heartbeat detection status; updating a target heartbeat value corresponding to the target client according to the target request; when the target request is a heartbeat request, performing heartbeat detection based on the heartbeat request to determine the survival status of the target client; comparing the target heartbeat value with a heartbeat threshold, and updating the heartbeat detection status according to the comparison result, so that the target client sends a heartbeat request based on the updated heartbeat detection status to perform heartbeat detection and determine the survival status.
Need to check novelty before this filing date? Find Prior Art

Claims

1. A method for detecting the liveness of a client, characterized in that, it includes: Intercepting a target request sent by a target client, where the target request includes a heartbeat request and a service request, and the target client sends the heartbeat request based on the heartbeat detection status; Updating a target heartbeat value corresponding to the target client according to the target request, and performing a heartbeat detection when the target request is the heartbeat request to determine the liveness status of the target client; Comparing the target heartbeat value with a heartbeat threshold, and updating the heartbeat detection status according to the comparison result, so that the target client sends a heartbeat request based on the updated heartbeat detection status to perform the heartbeat detection and determine the liveness status.

2. The method according to claim 1, characterized in that, before intercepting the target request sent by the target client, the method further includes: Detecting a request sent by the target client; When detecting that the request sent by the target client is a long connection request, establishing a long connection with the target client and generating a heartbeat record corresponding to the target client; Initializing the heartbeat threshold corresponding to the target client.

3. The method according to claim 1, characterized in that, the updating the target heartbeat value corresponding to the target client according to the target request includes: Identifying the target request; If the target request is the service request, reading the target heartbeat value corresponding to the target client in the heartbeat record, subtracting the target heartbeat value from a preset value to obtain a heartbeat update value, and using the heartbeat update value to overwrite the target heartbeat value to complete the update of the target heartbeat value; If the target request is the heartbeat request, reading the target heartbeat value corresponding to the target client in the heartbeat record, and when the target heartbeat value is less than the heartbeat threshold, adding the target heartbeat value to a preset value to obtain a heartbeat update value, and using the heartbeat update value to overwrite the target heartbeat value to complete the update of the target heartbeat value.

4. The method according to claim 3, characterized in that, after reading the target heartbeat value corresponding to the target client in the heartbeat record when the target request is the heartbeat request, the method further includes: when the target heartbeat value is equal to the heartbeat threshold, using the heartbeat threshold as the heartbeat update value and using the heartbeat update value to overwrite the target heartbeat value to complete the update of the target heartbeat value.

5. The method according to claim 1, characterized in that, the performing a heartbeat detection to determine the liveness status of the target client includes: after identifying the heartbeat packet carried by the heartbeat request, updating the liveness status to alive and sending a heartbeat reply packet to the target client, so that the target client determines the liveness status based on the heartbeat reply packet.

6. The method according to claim 1, characterized in that, the comparing the target heartbeat value with the heartbeat threshold and updating the heartbeat detection status according to the comparison result includes: Comparing the target heartbeat value with the heartbeat threshold; When the target heartbeat value is non-positive and its absolute value is less than the heartbeat threshold, obtain the heartbeat pause time and update the heartbeat detection status to the paused state, where the paused state is used to indicate that the target client stops sending the heartbeat request during the heartbeat pause time; When the target heartbeat value is non-positive and its absolute value is equal to the heartbeat threshold, update the heartbeat detection status to the stopped state, where the stopped state is used to indicate disconnecting the long connection of the target client; When the target heartbeat value is positive and less than or equal to the heartbeat threshold, update the heartbeat detection status to the normal state, where the normal state is used to indicate that the target client sends the heartbeat request according to a preset heartbeat frequency.

7. The method according to claim 1, wherein, the method further includes: After receiving the heartbeat request, start a timeout timer; If no heartbeat request is intercepted again within the timing duration of the timeout timer, determine that the survival status of the target client is inactivated.

8. A client survival perception device, wherein, comprising: An interception module, configured to intercept a target request sent by a target client, where the target request includes a heartbeat request and a service request, and the target client sends the heartbeat request based on the heartbeat detection status; An update module, configured to update the target heartbeat value corresponding to the target client according to the target request, and perform heartbeat detection when the target request is the heartbeat request to determine the survival status of the target client; A comparison module, configured to compare the target heartbeat value with the heartbeat threshold, and update the heartbeat detection status according to the comparison result, so that the target client sends a heartbeat request based on the updated heartbeat detection status to perform the heartbeat detection and determine the survival status.

9. A computer device, including a memory and a processor, where the memory stores a computer program, wherein, when the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Heartbeat detection method and application server

    CN106961364A

  • Communication method and device and computer readable storage medium

    CN111698098A