CN112969064A - Redis cache timeout-based equipment online state calculation method - Google Patents

Redis cache timeout-based equipment online state calculation method Download PDF

Info

Publication number
CN112969064A
CN112969064A CN202110172147.9A CN202110172147A CN112969064A CN 112969064 A CN112969064 A CN 112969064A CN 202110172147 A CN202110172147 A CN 202110172147A CN 112969064 A CN112969064 A CN 112969064A
Authority
CN
China
Prior art keywords
equipment
time
timeout
redis cache
video
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110172147.9A
Other languages
Chinese (zh)
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.)
Zhiyang Innovation Technology Co Ltd
Original Assignee
Zhiyang Innovation 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 Zhiyang Innovation Technology Co Ltd filed Critical Zhiyang Innovation Technology Co Ltd
Priority to CN202110172147.9A priority Critical patent/CN112969064A/en
Publication of CN112969064A publication Critical patent/CN112969064A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N17/00Diagnosis, testing or measuring for television systems or their details
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Biomedical Technology (AREA)
  • Multimedia (AREA)
  • Environmental & Geological Engineering (AREA)
  • Cardiology (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

A device online state calculation method based on Redis cache timeout comprises the following steps: recording the heartbeat time of the equipment, and setting the overtime time; the video equipment periodically sends heartbeat messages to the signaling server, updates the online time of the equipment stored in the Redis cache, and resets the overtime time corresponding to the KEY value in the cache; when the video equipment is overtime and does not send heartbeat messages, the Redis cache triggers a KEY value overtime event, and the signaling server sets the state of the video equipment corresponding to the KEY value to be offline; and after the video equipment is offline, if the video equipment starts to send the heartbeat messages periodically again, repeating the first step. The method for calculating the online state of the equipment based on the Redis cache timeout has the characteristics of simplicity, convenience, high execution efficiency, large number of concurrent connections of the supported video equipment and the like, can judge the online and offline state of the equipment at the first time, has no overtime condition of the equipment, and hardly occupies a CPU.

Description

Redis cache timeout-based equipment online state calculation method
Technical Field
The invention relates to a Redis cache timeout-based equipment online state calculation method, and belongs to the technical field of comprehensive intelligent security.
Background
The video equipment based on the GB/T28181 national standard protocol is compatible with the network architecture and the network condition of various video equipment: the method is characterized in that online and offline states of the equipment are maintained by adopting a mode of adding a registration message and a heartbeat message, wherein the registration message is authentication verification of the equipment on a signaling server for the first time, and after the verification is successful, the equipment periodically sends the heartbeat message to maintain a connection state with the signaling server. Aiming at the online and offline states of the equipment, the heartbeat time of the equipment is mainly recorded, and the current time is compared with the latest heartbeat time by utilizing thread polling: when the time difference between the two devices is larger than the specified timeout time, the device is judged to be offline, but the method has low execution efficiency when a large number of devices are connected, and the judgment is not timely.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a device online state calculation method based on Redis cache timeout. The invention judges the online and offline states of the equipment by monitoring the overtime event of the Redis cache.
The technical scheme of the invention is as follows:
a device online state calculation method based on Redis cache timeout is characterized by comprising the following steps:
the first step is as follows: recording the heartbeat time of the equipment, and setting the timeout time, wherein the timeout time comprises S1-S2:
s1: the video equipment sends a registration message to a signaling server;
s2: the signaling server stores the online time of the equipment in the Redis cache, the KEY is the unique identifier of the video equipment, such as the serial number of the video equipment, and the overtime time corresponding to the KEY value is set;
the second step is that: the video equipment periodically sends heartbeat messages to the signaling server, updates the online time of the equipment stored in the Redis cache, and resets the overtime time corresponding to the KEY value in the cache;
the third step: when the video equipment is overtime and does not send heartbeat messages, the Redis cache triggers a KEY value overtime event, and the signaling server sets the state of the video equipment corresponding to the KEY value to be offline;
and after the video equipment is offline, if the video equipment starts to send the heartbeat messages periodically again, repeating the first step.
Preferably, in step S1, the video device sends a registration message to the signaling server according to the GB/T28181 national standard protocol (requirements for information transmission, exchange and control in security video monitoring networking system).
Preferably, according to the invention, the video device is a video device based on the GB/T28181 national standard protocol.
Preferably, according to the present invention, the signaling server in the first step is a server for handling device packet interaction in the GB/T28181 international protocol.
According to a preferred embodiment of the present invention, the timeout period in the first step is: redis removes the time to cache the data.
The invention has the beneficial technical effects that:
the method for calculating the online state of the equipment based on the Redis cache timeout has the characteristics of simplicity, convenience, high execution efficiency, large number of concurrent connections of the supported video equipment and the like. When a part of devices in a large number of devices are online and offline, the traditional queue polling mode has the judgment speed depending on the polling speed, the CPU is occupied when the polling speed is high, and the judgment is not timely when the polling speed is low. By adopting the mode of the invention, the online and offline state of the equipment can be judged at the first time, the overtime condition of the equipment is avoided, and the CPU is hardly occupied.
Drawings
Fig. 1 is a flow chart of a device online status calculation method based on Redis cache timeout according to the present invention.
Detailed Description
In order to make the purpose and technical solution of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings, but is not limited thereto.
Examples
A device online state calculation method based on Redis cache timeout comprises the following steps:
the first step is as follows: recording the heartbeat time of the equipment, and setting the timeout time, wherein the timeout time comprises S1-S2:
s1: the video equipment sends a registration message to a signaling server;
s2: the signaling server stores the online time of the device in the Redis cache, the KEY is a unique identifier of the video device, the unique identifier is a video device number, the timeout time corresponding to the KEY value is set, and the timeout time is set to be 180 seconds in the embodiment;
the second step is that: the video equipment periodically sends heartbeat messages to the signaling server, updates the online time of the equipment stored in the Redis cache, and resets the overtime time corresponding to the KEY value in the cache; that is, when the device sends a heartbeat packet, the signaling server updates the cache information of the Redis, resets the timeout time (for example, 180 seconds) of the cache, and the Redis starts timing from 0 again to perform timeout judgment; wherein the KEY value timeout event is an event notification provided by Redis;
the third step: when the video equipment is overtime and does not send heartbeat messages, the Redis cache triggers a KEY value overtime event, and the signaling server sets the state of the video equipment corresponding to the KEY value to be offline; that is, if the device does not send a heartbeat message after exceeding 180 seconds, the Redis cache triggers a KEY value timeout event of the device, and the signaling server monitors the event and sets the device state to be offline;
and after the video equipment is offline, if the video equipment starts to send the heartbeat messages periodically again, repeating the first step.
In step S1, the video device sends a registration message to the signaling server according to the GB/T28181 national standard protocol ("information transmission, exchange, and control technical requirements for security video monitoring networking system").
The video equipment is based on the GB/T28181 national standard protocol.
The signaling server in the first step is a server for processing equipment message interaction in GB/T28181 international protocol.
The timeout time in the first step is: redis removes the time to cache the data.
Experimental comparison example,
The calculation method and the traditional queue polling mode of the embodiment of the invention are respectively adopted to monitor different amounts of equipment, and the obtained comparison data are as follows:
Figure BDA0002939043220000031

Claims (6)

1. a device online state calculation method based on Redis cache timeout is characterized by comprising the following steps:
the first step is as follows: recording the heartbeat time of the equipment, and setting the timeout time, wherein the timeout time comprises S1-S2:
s1: the video equipment sends a registration message to a signaling server;
s2: the signaling server stores the online time of the equipment in the Redis cache, the KEY is the unique identifier of the video equipment, and the overtime time corresponding to the KEY value is set;
the second step is that: the video equipment periodically sends heartbeat messages to the signaling server, updates the online time of the equipment stored in the Redis cache, and resets the overtime time corresponding to the KEY value in the cache;
the third step: when the video equipment is overtime and does not send heartbeat messages, the Redis cache triggers a KEY value overtime event, and the signaling server sets the state of the video equipment corresponding to the KEY value to be offline.
2. The device online status calculation method based on Redis cache timeout according to claim 1, wherein after offline, if the video device starts sending heartbeat messages periodically again, the first step is repeated.
3. The method according to claim 1, wherein in step S1, the video device sends a registration packet to the signaling server according to the GB/T28181 national standard protocol.
4. The device online status calculation method based on Redis cache timeout according to claim 1, wherein the video device is a video device based on GB/T28181 national standard protocol.
5. The method according to claim 1, wherein the signaling server in the first step is a server for handling device packet interaction in GB/T28181 international protocol.
6. The device online state calculation method based on Redis cache timeout according to claim 1, wherein the timeout time in the first step is: redis removes the time to cache the data.
CN202110172147.9A 2021-02-08 2021-02-08 Redis cache timeout-based equipment online state calculation method Pending CN112969064A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110172147.9A CN112969064A (en) 2021-02-08 2021-02-08 Redis cache timeout-based equipment online state calculation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110172147.9A CN112969064A (en) 2021-02-08 2021-02-08 Redis cache timeout-based equipment online state calculation method

Publications (1)

Publication Number Publication Date
CN112969064A true CN112969064A (en) 2021-06-15

Family

ID=76275404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110172147.9A Pending CN112969064A (en) 2021-02-08 2021-02-08 Redis cache timeout-based equipment online state calculation method

Country Status (1)

Country Link
CN (1) CN112969064A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113596619A (en) * 2021-06-22 2021-11-02 深圳市泛海数据科技有限公司 Fire-fighting Internet of things multi-device state judgment method, device, equipment and storage medium
CN114095404A (en) * 2021-11-17 2022-02-25 北京金和网络股份有限公司 Video equipment state calculation output method, device and equipment based on stream calculation
CN114244754A (en) * 2021-11-30 2022-03-25 慧之安信息技术股份有限公司 Equipment online state calculation method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101917437A (en) * 2010-08-20 2010-12-15 迈普通信技术股份有限公司 User off-line detection method based on SIP and SIP user state detection system
CN108063918A (en) * 2017-12-14 2018-05-22 厦门普杰信息科技有限公司 A kind of method of GB28181 Media Streams convergence forwarding
CN110572443A (en) * 2019-08-22 2019-12-13 厦门网宿有限公司 Long connection state updating method, server and storage medium
CN111130951A (en) * 2019-12-31 2020-05-08 中消云(北京)物联网科技研究院有限公司 Equipment state detection method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101917437A (en) * 2010-08-20 2010-12-15 迈普通信技术股份有限公司 User off-line detection method based on SIP and SIP user state detection system
CN108063918A (en) * 2017-12-14 2018-05-22 厦门普杰信息科技有限公司 A kind of method of GB28181 Media Streams convergence forwarding
CN110572443A (en) * 2019-08-22 2019-12-13 厦门网宿有限公司 Long connection state updating method, server and storage medium
CN111130951A (en) * 2019-12-31 2020-05-08 中消云(北京)物联网科技研究院有限公司 Equipment state detection method, device and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113596619A (en) * 2021-06-22 2021-11-02 深圳市泛海数据科技有限公司 Fire-fighting Internet of things multi-device state judgment method, device, equipment and storage medium
CN113596619B (en) * 2021-06-22 2023-11-24 深圳市鹏芯数据技术有限公司 Fire-fighting Internet of things multi-equipment state judging method, device, equipment and storage medium
CN114095404A (en) * 2021-11-17 2022-02-25 北京金和网络股份有限公司 Video equipment state calculation output method, device and equipment based on stream calculation
CN114244754A (en) * 2021-11-30 2022-03-25 慧之安信息技术股份有限公司 Equipment online state calculation method and device

Similar Documents

Publication Publication Date Title
CN112969064A (en) Redis cache timeout-based equipment online state calculation method
CN110266810B (en) Message receiving method, device and storage medium based on MQTT protocol
CN103634149B (en) A kind of monitoring method for distributed system
US7814051B2 (en) Managing watcher information in a distributed server environment
CN110809262B (en) COAP protocol-based operation and maintenance management method for Internet of things equipment
CN108924485A (en) Client live video stream interruption processing method and system, monitoring system
CN113824594B (en) Message sending method and device
CN103516766A (en) Method and system of communication between client-side and application server
JP4869160B2 (en) Packet relay device
EP2944073A2 (en) Method and system for the handling of redundant long poll
CN103312586B (en) A kind of method of instant messaging, system and server
CN109040286B (en) Client online state maintenance method based on memory database
CN111865659B (en) Main and standby controller switching method and device, controller and network equipment
WO2021083075A1 (en) Method and apparatus for subscribing to event stream
CN115866535A (en) Method and system for realizing 5G message access by multiple protocols
CN115378926A (en) Emergency broadcast pushing method under mobile terminal equipment
CN113645103B (en) Method and device for detecting communication link abnormity between video monitoring platform and front-end equipment
CN109710435A (en) A kind of message delivery method based on the more message queues of support
CN114125021A (en) Terminal information issuing system based on Netty message drive
CN114363309B (en) Intelligent blackboard management control system based on MQTT and control method thereof
CN114500660B (en) Request processing method, device, equipment and computer readable storage medium
CN117640745A (en) Event subscription method, device, computer readable storage medium and terminal equipment
CN113626210B (en) Power grid operation risk early warning information transfer method and storage system
CN116841832A (en) Method, equipment and medium for monitoring state of embedded software called by terminal
CN117939508A (en) Big data service communication system based on 5G and use method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210615

RJ01 Rejection of invention patent application after publication