CN112769889B - Method, device, storage medium and electronic device for pushing service data - Google Patents
Method, device, storage medium and electronic device for pushing service data Download PDFInfo
- Publication number
- CN112769889B CN112769889B CN202011300195.3A CN202011300195A CN112769889B CN 112769889 B CN112769889 B CN 112769889B CN 202011300195 A CN202011300195 A CN 202011300195A CN 112769889 B CN112769889 B CN 112769889B
- Authority
- CN
- China
- Prior art keywords
- node
- service data
- receiving node
- state
- pushed
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0817—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/16—Threshold monitoring
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Computer And Data Communications (AREA)
- Telephonic Communication Services (AREA)
Abstract
本发明实施例提供了一种服务数据的推送方法、装置、存储介质以及电子装置,该方法包括:采用在确定需要向接收节点推送目标服务数据的情况下,获取第一节点的运行状态,在第一节点处于第一运行状态的情况下,将目标服务数据推送至接收节点,在第一节点处于第二运行状态的情况下,终止向第一节点推送目标服务数据,因此,可以解决相关技术中存在的推送服务数据容易造成级联故障,难以高效的完成推送服务的技术问题,达到提高数据推送服务的健壮和稳定性、实现了服务的高可用性的技术效果。
Embodiments of the present invention provide a method, device, storage medium, and electronic device for pushing service data. The method includes: obtaining the operating status of the first node when it is determined that the target service data needs to be pushed to the receiving node, and then When the first node is in the first operating state, the target service data is pushed to the receiving node, and when the first node is in the second operating state, the pushing of the target service data to the first node is terminated. Therefore, related technologies can be solved The push service data existing in the system is easy to cause cascading failures, and it is difficult to efficiently complete the technical problems of the push service, so as to achieve the technical effect of improving the robustness and stability of the data push service and realizing the high availability of the service.
Description
技术领域technical field
本发明实施例涉及通信领域,具体而言,涉及一种服务数据的推送方 法、装置、存储介质以及电子装置。Embodiments of the present invention relate to the communication field, and in particular, relate to a method, device, storage medium, and electronic device for pushing service data.
背景技术Background technique
WebHook是一个api(application programming interface,应用程序编 程接口)概念,也被成为反向api,即:终端不主动发送请求,完全由服 务器进行后端推送。WebHook is an api (application programming interface, application programming interface) concept, which is also called a reverse api, that is, the terminal does not actively send requests, and the server pushes them completely.
在传统的服务数据推送过程中,客户端从服务器请求数据,然后服务 器提供给客户端数据。在WebHook方式下,服务器更新所需提供的资源, 然后自动将其作为服务数据推送到客户端,客户端不是请求者,而是被动 接收方。这种控制关系的反转可以用来促进许多原本需要在远程服务器上 进行更复杂的请求和不断的轮询的通信请求。In the traditional service data push process, the client requests data from the server, and then the server provides the data to the client. In the WebHook mode, the server updates the required resources, and then automatically pushes them to the client as service data. The client is not a requester, but a passive receiver. This inversion of control relationship can be used to facilitate many communication requests that would otherwise require more complex requests and constant polling at the remote server.
但是,在WebHook方式下推送数据和消息时,当一个或多个服务不 可用或表现出高延迟时,会导致整个系统出现级联故障。推送服务的重试 逻辑只会使情况更糟糕,并且可能导致系统彻底的崩溃。However, when pushing data and messages in the WebHook mode, when one or more services are unavailable or exhibit high latency, it will cause cascading failures in the entire system. The retry logic of the push service will only make the situation worse and may cause the system to completely crash.
针对相关技术中存在的推送服务数据容易造成级联故障,难以高效的 完成推送服务的技术问题,目前尚未提出有效的解决方案。Aiming at the technical problems that the push service data in the related technology is easy to cause cascading faults and it is difficult to efficiently complete the push service, no effective solution has been proposed yet.
发明内容Contents of the invention
本发明实施例提供了一种服务数据的推送方法、装置、存储介质以及 电子装置,以至少解决相关技术中存在的推送服务数据容易造成级联故障, 难以高效的完成推送服务的技术问题。Embodiments of the present invention provide a service data push method, device, storage medium, and electronic device to at least solve the technical problems in the related art that push service data is likely to cause cascading failures and it is difficult to efficiently complete the push service.
根据本发明的一个实施例,提供了一种服务数据的推送方法,包括: 在确定需要向接收节点推送目标服务数据的情况下,获取第一节点的运行 状态;在所述第一节点处于第一运行状态的情况下,将所述目标服务数据 推送至所述接收节点,其中,所述第一运行状态用于表示推送至所述接收 节点的服务数据连续发生异常的次数小于或等于第一阈值;在所述第一节 点处于第二运行状态的情况下,终止向所述第一节点推送所述目标服务数 据,其中,所述第二运行状态用于表示推送至所述接收节点的服务数据连 续发生异常的次数大于第一阈值。According to an embodiment of the present invention, a method for pushing service data is provided, including: obtaining the running status of the first node when it is determined that the target service data needs to be pushed to the receiving node; In the case of a running state, the target service data is pushed to the receiving node, wherein the first running state is used to indicate that the service data pushed to the receiving node has a continuous abnormal number of times less than or equal to the first Threshold; when the first node is in a second operating state, stop pushing the target service data to the first node, wherein the second operating state is used to represent the service pushed to the receiving node The number of consecutive data abnormalities is greater than the first threshold.
根据本发明的另一个实施例,提供了一种服务数据的推送装置,包括: 获取模块,用于在确定需要向接收节点推送目标服务数据的情况下,获取 第一节点的运行状态;推送模块,用于在所述第一节点处于第一运行状态 的情况下,将所述目标服务数据推送至所述接收节点,其中,所述第一运 行状态用于表示推送至所述接收节点的服务数据连续发生异常的次数小 于或等于第一阈值;终止模块,用于在所述第一节点处于第二运行状态的 情况下,终止向所述第一节点推送所述目标服务数据,其中,所述第二运 行状态用于表示推送至所述接收节点的服务数据连续发生异常的次数大 于第一阈值。According to another embodiment of the present invention, a device for pushing service data is provided, including: an acquisition module, configured to acquire the operating status of the first node when it is determined that target service data needs to be pushed to the receiving node; the push module , for pushing the target service data to the receiving node when the first node is in a first running state, wherein the first running state is used to represent the service pushed to the receiving node The number of consecutive data abnormalities is less than or equal to the first threshold; the termination module is configured to terminate pushing the target service data to the first node when the first node is in the second operating state, wherein the The second running state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold.
根据本发明的又一个实施例,还提供了一种计算机可读存储介质,所 述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被处 理器执行时实现上述任一项方法实施例中的步骤。According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, wherein, when the computer program is executed by a processor, any one of the above-mentioned methods is implemented Steps in the examples.
根据本发明的又一个实施例,还提供了一种电子装置,包括存储器、 处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序, 所述处理器执行所述计算机程序时实现上述任一项方法实施例中的步骤。According to yet another embodiment of the present invention, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and operable on the processor, and the processor executes the computer program The program implements the steps in any one of the above method embodiments.
通过本发明,采用在确定需要向接收节点推送目标服务数据的情况下, 获取第一节点的运行状态,在第一节点处于第一运行状态的情况下,将目 标服务数据推送至接收节点,在第一节点处于第二运行状态的情况下,终 止向第一节点推送目标服务数据,因此,可以解决相关技术中存在的推送 服务数据容易造成级联故障,难以高效的完成推送服务的技术问题,有助 于防止跨多个系统的级联故障,构建容错能力较高且具备弹性的系统,当关键服务不可用或具有高延迟时,系统仍然可以正常运行,达到提高数据 推送服务的健壮和稳定性、实现了服务的高可用性的技术效果。According to the present invention, when it is determined that the target service data needs to be pushed to the receiving node, the operation state of the first node is obtained, and when the first node is in the first operation state, the target service data is pushed to the receiving node, and the When the first node is in the second running state, the push of the target service data to the first node is terminated. Therefore, it can solve the technical problem that the push service data in the related art is likely to cause cascading failures and it is difficult to efficiently complete the push service. Helps prevent cascading failures across multiple systems, and builds a system with high fault tolerance and resilience. When key services are unavailable or have high latency, the system can still operate normally, so as to improve the robustness and stability of data push services performance and achieve high availability of services.
附图说明Description of drawings
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一 部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发 明的不当限定。在附图中:The accompanying drawings described here are used to provide a further understanding of the present invention, and constitute a part of the application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention, and do not constitute improper limitations to the present invention. In the attached picture:
图1是根据本发明实施例的一种可选的服务数据的推送方法的移动终 端的硬件结构框图;Fig. 1 is a hardware structural block diagram of a mobile terminal according to an optional method for pushing service data according to an embodiment of the present invention;
图2是根据本发明实施例的一种可选的服务数据的推送方法的流程示 意图;Fig. 2 is a schematic flow diagram of an optional method for pushing service data according to an embodiment of the present invention;
图3是根据本发明实施例的一种可选的服务数据的推送方法的示意图;FIG. 3 is a schematic diagram of an optional method for pushing service data according to an embodiment of the present invention;
图4是根据本发明实施例的一种可选的服务数据的推送装置的结构框 图;Fig. 4 is a structural block diagram of an optional device for pushing service data according to an embodiment of the present invention;
图5是根据本发明实施例的一种可选的电子设备的结构示意图。Fig. 5 is a schematic structural diagram of an optional electronic device according to an embodiment of the present invention.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本发明的实施例。Embodiments of the present invention will be described in detail below with reference to the drawings and in combination with the embodiments.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语 “第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序 或先后次序。It should be noted that the terms "first" and "second" in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence.
本申请实施例中所提供的方法实施例可以在移动终端、计算机终端或 者类似的运算装置中执行。以运行在移动终端上为例,图1是本发明实施 例的一种服务数据的推送方法的移动终端的硬件结构框图。如图1所示, 移动终端可以包括一个或多个(图1中仅示出一个)处理器102(处理器 102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理 装置)和用于存储数据的存储器104,其中,上述移动终端还可以包括用 于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员 可以理解,图1所示的结构仅为示意,其并不对上述移动终端的结构造成 限定。例如,移动终端还可包括比图1中所示更多或者更少的组件,或者 具有与图1所示不同的配置。The method embodiments provided in the embodiments of this application can be executed in mobile terminals, computer terminals or similar computing devices. Taking running on a mobile terminal as an example, Fig. 1 is a block diagram of a hardware structure of a mobile terminal according to a method for pushing service data according to an embodiment of the present invention. As shown in FIG. 1, the mobile terminal may include one or more (only one is shown in FIG. 1) processors 102 (processors 102 may include but not limited to processing devices such as microprocessor MCU or programmable logic device FPGA, etc.) and a
存储器104可用于存储计算机程序,例如,应用软件的软件程序以及 模块,如本发明实施例中的服务数据的推送方法对应的计算机程序,处理 器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应 用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器, 还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其 他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于 处理器102远程设置的存储器,这些远程存储器可以通过网络连接至移动 终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动 通信网及其组合。The
传输装置106用于经由一个网络接收或者发送数据。上述的网络具体 实例可包括移动终端的通信供应商提供的无线网络。在一个实例中,传输 装置106包括一个网络适配器(Network Interface Controller,简称为NIC), 其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例 中,传输装置106可以为射频(Radio Frequency,简称为RF)模块,其 用于通过无线方式与互联网进行通讯。The
在本实施例中提供了一种运行于移动终端、计算机终端或者类似的运 算装置的服务数据的推送方法,图2是根据本发明实施例的一种可选的服 务数据的推送方法的流程示意图,如图2所示,该流程包括如下步骤:In this embodiment, a method for pushing service data running on a mobile terminal, a computer terminal or a similar computing device is provided. FIG. 2 is a schematic flowchart of an optional method for pushing service data according to an embodiment of the present invention , as shown in Figure 2, the process includes the following steps:
S202,在确定需要向接收节点推送目标服务数据的情况下,获取第一 节点的运行状态;S202, when it is determined that the target service data needs to be pushed to the receiving node, obtain the running status of the first node;
S204,在第一节点处于第一运行状态的情况下,将目标服务数据推送 至接收节点,其中,第一运行状态用于表示推送至接收节点的服务数据连 续发生异常的次数小于或等于第一阈值;S204. When the first node is in the first operating state, push the target service data to the receiving node, wherein the first operating state is used to indicate that the service data pushed to the receiving node has a continuous abnormal number of times less than or equal to the first threshold;
S206,在第一节点处于第二运行状态的情况下,终止向第一节点推送 目标服务数据,其中,第二运行状态用于表示推送至接收节点的服务数据 连续发生异常的次数大于第一阈值。S206. When the first node is in the second operating state, stop pushing the target service data to the first node, where the second operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold .
其中,上述步骤的执行主体可以为基站、终端等,但不限于此。Wherein, the execution subject of the above steps may be a base station, a terminal, etc., but is not limited thereto.
可选地,在本实施例中,上述接收节点可以包括但不限于一个或者多 个,可以由工作人员在架设上述服务推送系统的过程中预先配置。Optionally, in this embodiment, the above-mentioned receiving nodes may include but not limited to one or more, which may be pre-configured by staff during the process of setting up the above-mentioned service push system.
可选地,在本实施例中,上述目标服务数据可以对应于一个接收节点, 也可以同一个目标服务数据对应于多个接收节点。Optionally, in this embodiment, the above target service data may correspond to one receiving node, or the same target service data may correspond to multiple receiving nodes.
可选地,在本实施例中,上述第一节点可以包括但不限于以应用程序 形式控制的断路器等。Optionally, in this embodiment, the above-mentioned first node may include, but is not limited to, a circuit breaker controlled in the form of an application program.
可选地,在本实施例中,上述第一节点的运行状态可以包括但不限于 打开(open)状态、关闭(close)状态、半打开(halfopen)状态等,可 以由工作人员根据应用场景或者服务器所要推送服务的类型进行预先配 置。Optionally, in this embodiment, the running state of the above-mentioned first node may include but not limited to open (open) state, closed (close) state, half-open (halfopen) state, etc., which can be determined by the staff according to the application scenario or The type of service to be pushed by the server is pre-configured.
可选地,在本实施例中,上述第一运行状态用于表示推送至接收节点 的服务数据连续发生异常的次数小于或等于第一阈值,也即,在检测到上 述推送至接收节点的服务数据连续发生异常的次数小于或等于第一阈值 的情况下,将上述第一节点的运行状态确定为上述第一运行状态,上述第 一阈值可以根据应用场景或者服务器所要推送服务的类型进行预先配置。Optionally, in this embodiment, the above-mentioned first running state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the first threshold, that is, when the service data pushed to the receiving node is detected When the number of consecutive data exceptions is less than or equal to the first threshold, the operating state of the first node is determined as the first operating state, and the first threshold can be pre-configured according to the application scenario or the type of service to be pushed by the server .
可选地,在本实施例中,上述终止向第一节点推送目标服务数据可以 包括但不限于终止将目标服务数据推送至第一节点,还可以包括但不限于 终止将目标服务数据推送至接收节点等,在终止将目标服务数据推送至接 收节点的情况下,可以包括但不限于将待推送的服务数据丢弃,以避免服 务器由于服务未能成功推送,造成的级联故障问题,提高系统的容错能力, 增加了系统的弹性。Optionally, in this embodiment, the above-mentioned termination of pushing the target service data to the first node may include but not limited to termination of pushing the target service data to the first node, and may also include but not limited to termination of pushing the target service data to the receiving node. Nodes, etc., in the case of terminating the push of the target service data to the receiving node, may include but not limited to discarding the service data to be pushed, so as to avoid cascading failure problems caused by the server’s failure to push the service and improve the system’s reliability. Fault tolerance increases the resilience of the system.
上述仅是一种示例,本实施例不进行任何具体的限定。The foregoing is only an example, and this embodiment does not make any specific limitations.
可选地,在本实施例中,上述第二运行状态用于表示推送至接收节点 的服务数据连续发生异常的次数大于第一阈值,也即,在检测到上述推送 至接收节点的服务数据连续发生异常的次数大于第一阈值的情况下,将上 述第一节点的运行状态确定为上述第二运行状态。Optionally, in this embodiment, the above-mentioned second running status is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold, that is, when it is detected that the service data pushed to the receiving node continues When the number of occurrences of abnormalities is greater than the first threshold, the operating state of the first node is determined as the second operating state.
通过本实施例,采用在确定需要向接收节点推送目标服务数据的情况 下,获取第一节点的运行状态,在第一节点处于第一运行状态的情况下, 将目标服务数据推送至接收节点,在第一节点处于第二运行状态的情况下, 终止向第一节点推送目标服务数据,因此,可以解决相关技术中存在的推 送服务数据容易造成级联故障,难以高效的完成推送服务的技术问题,有 助于防止跨多个系统的级联故障,构建容错能力较高且具备弹性的系统,当关键服务不可用或具有高延迟时,系统仍然可以正常运行,达到提高数 据推送服务的健壮和稳定性、实现了服务的高可用性的技术效果。Through this embodiment, when it is determined that the target service data needs to be pushed to the receiving node, the operating state of the first node is obtained, and when the first node is in the first operating state, the target service data is pushed to the receiving node, When the first node is in the second operating state, the push of the target service data to the first node is terminated. Therefore, it can solve the technical problem that the push service data in the related art is likely to cause cascading failures and it is difficult to efficiently complete the push service. , helps prevent cascading failures across multiple systems, and builds a system with high fault tolerance and resilience. When key services are unavailable or have high latency, the system can still operate normally, improving the robustness and Stability, the technical effect of achieving high availability of services.
作为一种可选的方案,在将所述目标服务数据推送至所述接收节点之 后,所述方法还包括:检测推送至所述接收节点的服务数据连续发生异常 的次数;在检测到所述推送至所述接收节点的服务数据连续发生异常的次 数小于或等于第二阈值的情况下,将所述第一节点的运行状态确定为第一 运行子状态,所述第二阈值小于所述第一阈值,所述第一运行状态包括所 述第一运行子状态;在检测到所述推送至所述接收节点的服务数据连续发 生异常的次数大于所述第二阈值,且小于所述第一阈值的情况下,将所述 第一节点的运行状态确定为第二运行子状态,所述第一运行状态包括所述 第二运行子状态;在检测到所述推送至所述接收节点的服务数据连续发生 异常的次数大于所述第一阈值的情况下,将所述第一节点的运行状态确定 为所述第二运行状态。As an optional solution, after the target service data is pushed to the receiving node, the method further includes: detecting the number of consecutive abnormal occurrences of the service data pushed to the receiving node; When the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to a second threshold, the operating state of the first node is determined as the first operating sub-state, and the second threshold is less than the second threshold A threshold, the first operating state includes the first operating sub-state; when it is detected that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the second threshold and less than the first In the case of a threshold value, the operating state of the first node is determined as the second operating sub-state, and the first operating state includes the second operating sub-state; when the service pushed to the receiving node is detected In a case where the number of consecutive occurrences of abnormal data is greater than the first threshold, the operating state of the first node is determined as the second operating state.
可选地,在本实施例中,上述第一节点的状态由之前推送服务数据的 过程中,该服务数据是否发生异常来确定。Optionally, in this embodiment, the status of the above-mentioned first node is determined by whether the service data is abnormal during the process of pushing the service data before.
可选地,在本实施例中,上述检测推送至接收节点的服务数据连续发 生异常的次数可以由服务器或者终端执行,以服务器是执行主体为例,在 检测过程中,通过获取上一次发送服务数据所花费的发送时长或者所发送 的服务数据是否可用来确定上述服务数据是否发生了异常,在发生异常的 情况下,记录一次异常次数,在连续发生异常的次数小于或等于第二阈值 的情况下,确定第一节点的运行状态为第一运行子状态,在连续发生异常的次数大于第二阈值,且小于第一阈值的情况下,确定第一节点的运行状 态为第二运行子状态。Optionally, in this embodiment, the above detection of the number of consecutive abnormal occurrences of the service data pushed to the receiving node can be performed by the server or the terminal. Taking the server as the execution subject as an example, during the detection process, by obtaining the last sent service The length of time spent sending the data or whether the sent service data can be used to determine whether the above-mentioned service data has an abnormality. In the case of an abnormality, record the number of abnormalities once. Next, determine that the operating state of the first node is the first operating sub-state, and determine that the operating state of the first node is the second operating sub-state when the number of consecutive abnormal occurrences is greater than the second threshold and less than the first threshold.
例如,可以将上述第二阈值配置为0,也即,当未连续发生异常时, 将第一节点的状态配置为上述第一运行子状态,当发生一次异常时,将第 一节点的状态配置为上述第二运行子状态。For example, the above-mentioned second threshold can be configured as 0, that is, when no abnormality occurs continuously, the state of the first node is configured as the above-mentioned first running sub-state, and when an abnormality occurs once, the state of the first node is configured as It is the above-mentioned second running sub-state.
通过本实施例,采用检测推送至接收节点的服务数据连续发生异常的 次数;在检测到推送至接收节点的服务数据连续发生异常的次数小于或等 于第二阈值的情况下,将第一节点的运行状态确定为第一运行子状态,第 二阈值小于第一阈值,第一运行状态包括第一运行子状态;在检测到推送 至接收节点的服务数据连续发生异常的次数大于第二阈值,且小于第一阈 值的情况下,将第一节点的运行状态确定为第二运行子状态,第一运行状 态包括第二运行子状态;在检测到推送至接收节点的服务数据连续发生异 常的次数大于第一阈值的情况下,将第一节点的运行状态确定为第二运行 状态,针对不同异常次数,确定不同的第一节点的运行状态,以解决数据 推送服务的健壮和稳定性问题,进而,能够解决相关技术中存在的推送服 务数据容易造成级联故障,难以高效的完成推送服务的技术问题,有助于 防止跨多个系统的级联故障,构建容错能力较高且具备弹性的系统,当关键服务不可用或具有高延迟时,系统仍然可以正常运行,达到提高服务的 可用性的技术效果。Through this embodiment, the number of consecutive abnormal occurrences of the service data pushed to the receiving node is detected; when it is detected that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the second threshold, the first node’s The running state is determined as the first running sub-state, the second threshold is less than the first threshold, and the first running state includes the first running sub-state; when it is detected that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the second threshold, and In the case of less than the first threshold, the operating state of the first node is determined as the second operating sub-state, and the first operating state includes the second operating sub-state; when it is detected that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than In the case of the first threshold, the operating state of the first node is determined as the second operating state, and different operating states of the first node are determined for different abnormal times, so as to solve the robustness and stability problems of the data push service, and then, It can solve the technical problems that the push service data in the related technology is easy to cause cascading failures and it is difficult to complete the push service efficiently. It helps to prevent cascading failures across multiple systems and build a system with high fault tolerance and flexibility. When critical services are unavailable or have high latency, the system can still operate normally, achieving the technical effect of improving service availability.
作为一种可选的方案,在获取第一节点的运行状态之后,所述方法还 包括:在所述第一节点处于所述第二运行状态的情况下,将预定数据推送 至所述接收节点;检测推送至所述接收节点的所述预定数据是否发生异常; 在确定推送至所述接收节点的所述预定数据未发生异常的情况下,调整所 述第一节点的状态为所述第一运行状态;在确定推送至所述接收节点的所 述预定数据发生了异常的情况下,维持所述第一节点的状态为所述第二运 行状态。As an optional solution, after obtaining the running state of the first node, the method further includes: when the first node is in the second running state, pushing predetermined data to the receiving node ; Detect whether the predetermined data pushed to the receiving node is abnormal; when it is determined that the predetermined data pushed to the receiving node is not abnormal, adjust the state of the first node to the first Running state: when it is determined that the predetermined data pushed to the receiving node is abnormal, maintaining the state of the first node as the second running state.
可选地,在本实施例中,上述预定数据可以包括但不限于上述在上述 第一节点处于第二运行状态的情况下,获取到的待推送的服务数据,还可 以包括但不限于用于检测是否发生异常的测试数据。Optionally, in this embodiment, the aforementioned predetermined data may include but not limited to the above-mentioned service data to be pushed obtained when the aforementioned first node is in the second running state, and may also include but not limited to Test data to detect whether anomalies occur.
例如,可以包括但不限于将上述预定数据配置为单字节的数据,以用 于测试当前服务推送的流程是否正常,还可以包括但不限于将待推送的部 分或全部服务数据用于测试当前服务推送的流程是否正常。For example, it may include but not limited to configuring the above predetermined data as single-byte data to test whether the current service push process is normal, and may also include but not limited to using part or all of the service data to be pushed to test the current Whether the process of service push is normal.
在将待推送的部分或全部服务数据作为预定数据时,一旦检测结果为 未发生异常,则可以调整第一节点的状态为第一运行状态,并完成服务数 据的发送,上述方案可以在服务数据较少的情况下使用,能够在不影响测 试效率的基础上,还能够快速推送服务数据。When some or all of the service data to be pushed is used as the predetermined data, once the detection result shows that no abnormality occurs, the state of the first node can be adjusted to the first running state, and the sending of the service data can be completed. It is used in less cases, and can quickly push service data without affecting test efficiency.
在将单字节的数据作为预定数据时,一旦检测结果为未发生异常,则 可以调整第一节点的状态为第一运行状态,并继续发送后续待推送的服务 数据,上述方案可以在服务数据较多的情况下使用,能够加快测试效率、 避免造成级联故障。When single-byte data is used as the predetermined data, once the detection result shows that no abnormality occurs, the state of the first node can be adjusted to the first running state, and continue to send subsequent service data to be pushed. The above scheme can be used in the service data Used in many cases, it can speed up the test efficiency and avoid cascading failures.
通过本实施例,采用在第一节点处于第二运行状态的情况下,将预定 数据推送至接收节点;检测推送至接收节点的预定数据是否发生异常;在 确定推送至接收节点的预定数据未发生异常的情况下,调整第一节点的状 态为第一运行状态;在确定推送至接收节点的预定数据发生了异常的情况 下,维持第一节点的状态为第二运行状态,因此,可以解决相关技术中存 在的推送服务数据容易造成级联故障,难以高效的完成推送服务的技术问题,有助于防止跨多个系统的级联故障,构建容错能力较高且具备弹性的 系统,当关键服务不可用或具有高延迟时,系统仍然可以正常运行,达到 提高数据推送服务的健壮和稳定性、实现了服务的高可用性的技术效果。Through this embodiment, when the first node is in the second operating state, push the scheduled data to the receiving node; detect whether the scheduled data pushed to the receiving node is abnormal; In case of abnormality, adjust the state of the first node to the first operating state; when it is determined that the scheduled data pushed to the receiving node is abnormal, maintain the state of the first node as the second operating state, therefore, the related The push service data in the technology is easy to cause cascading failures, and it is difficult to efficiently complete the technical problems of push services, which helps to prevent cascading failures across multiple systems, and builds a system with high fault tolerance and flexibility. When it is unavailable or has high latency, the system can still run normally, achieving the technical effect of improving the robustness and stability of the data push service and realizing the high availability of the service.
作为一种可选的方案,在获取第一节点的运行状态之后,所述方法还 包括:在所述第一节点处于所述第二运行状态的情况下,将预定数据推送 至所述接收节点;检测推送至所述接收节点的所述预定数据连续发生异常 的次数;在检测到推送至所述接收节点的所述预定数据连续发生异常的次 数小于第三阈值的情况下,调整所述第一节点的状态为所述第一运行状态; 在推送至所述接收节点的所述预定数据连续发生异常的次数大于或等于 所述第三阈值的情况下,维持所述第一节点的状态为所述第二运行状态。As an optional solution, after obtaining the running state of the first node, the method further includes: when the first node is in the second running state, pushing predetermined data to the receiving node ; Detect the number of consecutive abnormal occurrences of the predetermined data pushed to the receiving node; when it is detected that the number of consecutive abnormal occurrences of the predetermined data pushed to the receiving node is less than a third threshold, adjust the first The state of a node is the first running state; when the number of consecutive abnormal occurrences of the predetermined data pushed to the receiving node is greater than or equal to the third threshold, the state of the first node is maintained as the second operating state.
可选地,在本实施例中,还可以包括但不限于多次检测上述预定数据 发生异常的状态,在上述预定数据连续发生异常状态的次数小于或等于第 三阈值的情况下,才将上述第一节点的状态调整为第一运行状态。Optionally, in this embodiment, it may also include but is not limited to detecting the abnormal state of the above-mentioned predetermined data multiple times, and the above-mentioned The state of the first node is adjusted to the first running state.
例如,可以配置为上述预定数据连续发生异常的次数小于1次,也即, 在上述预定数据不连续发生异常的情况下,将上述第一节点的状态调整为 上述第一运行状态,在连续发生异常的情况下,维持上述第一节点的状态 为第二运行状态。For example, it may be configured such that the number of consecutive abnormal occurrences of the predetermined data is less than one time, that is, when the predetermined data does not occur continuously, the state of the first node is adjusted to the first operating state. In an abnormal situation, the state of the first node is maintained as the second running state.
还可以配置为上述预定数据连续发生异常的次数小于3次,也即,在 上述预定数据连续发生异常的次数小于3次的情况下,将上述第一节点的 状态调整为上述第一运行状态,在上述预定数据连续发生异常的次数大于 或等于3次的情况下,维持上述第一节点的状态为第二运行状态,使得上 述服务推送系统能够存在一定的容错率,在连续发生异常的情况下,也能 够尝试继续推送服务,在待推送的服务数据为关键的服务数据的情况下, 可以扩大上述服务推送方法的适用范围。It may also be configured such that the number of consecutive abnormal occurrences of the predetermined data is less than 3 times, that is, when the number of consecutive abnormal occurrences of the predetermined data is less than 3 times, the state of the first node is adjusted to the first operating state, In the case that the number of consecutive abnormal occurrences of the predetermined data is greater than or equal to 3 times, the state of the first node is maintained as the second operating state, so that the above-mentioned service push system can have a certain fault tolerance rate. , you can also try to continue to push the service. In the case that the service data to be pushed is the key service data, the scope of application of the above service pushing method can be expanded.
通过本实施例,采用在第一节点处于第二运行状态的情况下,将预定 数据推送至接收节点;检测推送至接收节点的预定数据连续发生异常的次 数;在检测到推送至接收节点的预定数据连续发生异常的次数小于或等于 第三阈值的情况下,调整第一节点的状态为第一运行状态;在推送至接收 节点的预定数据连续发生异常的次数大于第三阈值的情况下,维持第一节 点的状态为第二运行状态,因此,可以解决相关技术中存在的推送服务数 据容易造成级联故障,难以高效的完成推送服务的技术问题,有助于防止 跨多个系统的级联故障,构建容错能力较高且具备弹性的系统,当关键服 务不可用或具有高延迟时,系统仍然可以正常运行,达到提高数据推送服 务的健壮和稳定性、实现了服务的高可用性的技术效果。Through this embodiment, when the first node is in the second operating state, the scheduled data is pushed to the receiving node; the number of consecutive abnormal occurrences of the scheduled data pushed to the receiving node is detected; when the scheduled data pushed to the receiving node is detected, When the number of consecutive abnormal occurrences of the data is less than or equal to the third threshold, adjust the state of the first node to the first operating state; when the number of consecutive abnormal occurrences of the scheduled data pushed to the receiving node is greater than the third threshold, maintain The state of the first node is the second running state. Therefore, it can solve the technical problem that the push service data in the related technology is easy to cause cascading faults, and it is difficult to complete the push service efficiently, and it helps to prevent cascading across multiple systems. Faults, build a system with high fault tolerance and flexibility. When key services are unavailable or have high latency, the system can still operate normally, achieving the technical effect of improving the robustness and stability of data push services and achieving high availability of services. .
作为一种可选的方案,在所述第一节点处于第一运行状态的情况下, 将所述目标服务数据推送至所述接收节点之后,所述方法还包括:获取推 送所述目标服务数据的发送时长;在所述发送时长大于或等于第一时长阈 值的情况下,确定推送至所述接收节点的所述服务数据发生异常。As an optional solution, when the first node is in the first running state, after pushing the target service data to the receiving node, the method further includes: acquiring and pushing the target service data When the sending duration is greater than or equal to a first duration threshold, it is determined that the service data pushed to the receiving node is abnormal.
可选地,在本实施例中,上述发送时长可以包括但不限于由接收节点 主动向推送服务的执行主体反馈,还可以包括但不限于由推送服务的执行 主体向上述接收节点发送获取消息,以使得上述接收节点向推送服务的执 行主体返回记录上述发送时长的消息。Optionally, in this embodiment, the above-mentioned sending duration may include but not limited to active feedback from the receiving node to the execution subject of the push service, and may also include but not limited to sending an acquisition message to the above-mentioned receiving node by the execution subject of the push service, In order to make the receiving node return a message recording the sending time to the execution subject of the push service.
可选地,在本实施例中,上述第一时长阈值可以由工作人员根据实际 情况或者应用场景预设,还可以根据当前待推送服务的重要程度或者待推 送服务的数量进行动态调整。Optionally, in this embodiment, the above-mentioned first duration threshold can be preset by the staff according to the actual situation or the application scenario, and can also be dynamically adjusted according to the importance of the current service to be pushed or the number of services to be pushed.
通过本实施例,采用获取推送目标服务数据的发送时长;在发送时长 大于或等于第一时长阈值的情况下,确定推送至接收节点的服务数据发生 异常,因此,可以解决相关技术中存在的推送服务数据容易造成级联故障, 难以高效的完成推送服务的技术问题,有助于防止跨多个系统的级联故障, 构建容错能力较高且具备弹性的系统,当关键服务不可用或具有高延迟时, 系统仍然可以正常运行,达到提高数据推送服务的健壮和稳定性、实现了 服务的高可用性的技术效果。Through this embodiment, the sending duration of the push target service data is obtained; when the sending duration is greater than or equal to the first duration threshold, it is determined that the service data pushed to the receiving node is abnormal. Service data is easy to cause cascading failures, and it is difficult to efficiently complete the technical problems of push services. It helps to prevent cascading failures across multiple systems, and builds a system with high fault tolerance and flexibility. When key services are unavailable or have high When there is a delay, the system can still run normally, achieving the technical effect of improving the robustness and stability of the data push service and realizing the high availability of the service.
作为一种可选的方案,在所述第一节点处于第一运行状态的情况下, 将所述目标服务数据推送至所述接收节点之后,所述方法还包括:获取所 述目标服务数据所对应的目标服务的运行状态,其中,所述目标服务的运 行状态包括可用状态和不可用状态;在所述目标服务为不可用状态的情况 下,确定推送至所述接收节点的所述目标服务数据发生异常。As an optional solution, when the first node is in the first running state, after pushing the target service data to the receiving node, the method further includes: acquiring the target service data The running state of the corresponding target service, wherein the running state of the target service includes an available state and an unavailable state; when the target service is in an unavailable state, determine the target service pushed to the receiving node An exception occurred in the data.
可选地,在本实施例中,上述目标服务的运行状态可以包括但不限于 由接收节点主动向推送服务的执行主体反馈,还可以包括但不限于由推送 服务的执行主体向上述接收节点发送获取消息,以使得上述接收节点向推 送服务的执行主体返回记录上述目标服务的运行状态的消息,还可以包括 但不限于服务器获取与上述目标服务相关联的应用程序的运行状态以确 定上述目标服务数据是否发生异常。Optionally, in this embodiment, the running status of the above-mentioned target service may include, but not limited to, active feedback from the receiving node to the executive body of the push service, and may also include but not limited to sending Obtaining a message, so that the above-mentioned receiving node returns a message recording the running status of the above-mentioned target service to the execution subject of the push service, may also include but is not limited to the server obtaining the running status of the application program associated with the above-mentioned target service to determine the above-mentioned target service Whether the data is abnormal.
通过本实施例,采用获取目标服务数据所对应的目标服务的运行状态, 其中,目标服务的运行状态包括可用状态和不可用状态;在目标服务为不 可用状态的情况下,确定推送至接收节点的目标服务数据发生异常,因此, 可以解决相关技术中存在的推送服务数据容易造成级联故障,难以高效的 完成推送服务的技术问题,有助于防止跨多个系统的级联故障,构建容错 能力较高且具备弹性的系统,当关键服务不可用或具有高延迟时,系统仍 然可以正常运行,达到提高数据推送服务的健壮和稳定性、实现了服务的 高可用性的技术效果。Through this embodiment, the running state of the target service corresponding to the target service data is obtained, wherein the running state of the target service includes an available state and an unavailable state; when the target service is in an unavailable state, it is determined to push the Therefore, it can solve the technical problem that the push service data in the related technology is easy to cause cascading faults, and it is difficult to complete the push service efficiently, which helps to prevent cascading faults across multiple systems and build fault tolerance A system with high capability and flexibility, when the key service is unavailable or has high latency, the system can still run normally, achieving the technical effect of improving the robustness and stability of the data push service and realizing the high availability of the service.
下面结合具体的示例,对本发明进行进一步的解释说明:Below in conjunction with specific examples, the present invention is further explained:
图3是根据本发明实施例的一种可选的服务数据的推送方法的流程示 意图,如图3所示,该流程包括如下步骤:Fig. 3 is a schematic flow diagram of an optional method for pushing service data according to an embodiment of the present invention. As shown in Fig. 3, the flow includes the following steps:
1,数据推送服务(对应于前述的服务数据的推送方法的执行主体) 给接收数据服务A(对应于前述的接收节点)发送数据的时候,经过断路 器(对应于前述的第一节点),如果A的断路器是open(对应于前述的第 一运行子状态)状态,数据就直接发送给接收数据服务A,发送数据的时 候没有超时或者异常情况,断路器的状态还是open;1. When the data push service (corresponding to the execution subject of the aforementioned service data push method) sends data to the receiving data service A (corresponding to the aforementioned receiving node), it passes through the circuit breaker (corresponding to the aforementioned first node), If the circuit breaker of A is in the open state (corresponding to the aforementioned first running sub-state), the data is sent directly to the receiving data service A, and there is no timeout or abnormal situation when sending data, and the state of the circuit breaker is still open;
2,数据推送服务给接收数据服务B(对应于前述的接收节点)发送 数据的时候,经过断路器,如果B的断路器是open状态,数据就直接发 送给接收数据服务B,发送数据的时候出现超时或者异常情况,B的短路 器就会为HalfOpen(对应于前述的第二运行子状态)状态,在HalfOpen 状态下不影响对接手数据服务B的数据推送,只记录异常次数;2. When the data push service sends data to the receiving data service B (corresponding to the aforementioned receiving node), it passes through the circuit breaker. If the circuit breaker of B is in the open state, the data is directly sent to the receiving data service B. When sending data In the event of a timeout or abnormality, the short circuit of B will be in the HalfOpen state (corresponding to the aforementioned second running sub-state). In the HalfOpen state, the data push to the data service B will not be affected, and only the number of abnormalities will be recorded;
3,数据推送服务给接收数据服务B发送数据的时候,经过断路器, 如果B的断路器是HalfOpen状态,数据推送服务发送给接收数据服务B, 发送数据的时候没有超时或者异常情况,断路器的状态就会从HalfOpen 状态转为open状态;3. When the data push service sends data to the data receiving service B, it passes through the circuit breaker. If the circuit breaker of B is in the HalfOpen state, the data push service sends the data to the receiving data service B. If there is no timeout or abnormal situation when sending data, the circuit breaker The state will change from the HalfOpen state to the open state;
4,数据推送服务给接收数据服务B发送数据的时候,经过断路器, 如果B的断路器是HalfOpen状态,数据推送服务发送给接收数据服务B, 发送数据的时候出现超时或者异常情况的超过单位时间的阈值,断路器的 状态就会从HalfOpen状态转为Close(对应于前述的第二运行状态)状态;4. When the data push service sends data to the receiving data service B, it passes through the circuit breaker. If the circuit breaker of B is in the HalfOpen state, the data push service sends it to the receiving data service B. When sending data, there is a timeout or an abnormal situation exceeding the unit time threshold, the state of the circuit breaker will change from the HalfOpen state to the Close (corresponding to the aforementioned second operating state) state;
5,数据推送服务给接收数据服务C(对应于前述的接收节点)发送 数据的时候,经过断路器,如果C的断路器是Close状态,数据推送服务 会定期给接收数据服务C发送一条数据(对应于前述的预定数据),发送 数据的时候出现超时或者异常情况,停止给接收数据服务C推送数据,C 断路器的状态不变化还为Close状态;5. When the data push service sends data to the receiving data service C (corresponding to the aforementioned receiving node), after passing through the circuit breaker, if the circuit breaker of C is in the Close state, the data push service will periodically send a piece of data to the receiving data service C ( Corresponding to the aforementioned predetermined data), if there is a timeout or abnormal situation when sending data, stop pushing data to the receiving data service C, and the state of the circuit breaker of C does not change and remains in the Close state;
6,数据推送服务给接收数据服务C发送数据的时候,经过断路器, 如果C的断路器是Close状态,数据推送服务会定期给接收数据服务C发 送一条数据,发送数据的时候没有出现超时或者异常情况,C断路器的 状态就变化为Open状态。6. When the data push service sends data to the receiving data service C, it passes through the circuit breaker. If the circuit breaker of C is in the Close state, the data push service will periodically send a piece of data to the receiving data service C. When sending data, there is no timeout or In an abnormal situation, the state of the C circuit breaker changes to the Open state.
通过本实施例,能够解决WebHook方式下接收数据服务因为各种原 因出现超时或者异常情况下,数据推送服务的健壮和稳定性问题,实现了 服务的高可用。Through this embodiment, it is possible to solve the problem of the robustness and stability of the data push service when the receiving data service in the WebHook mode times out or is abnormal due to various reasons, and realizes the high availability of the service.
此外,由于设置的判定机制简便,能够高效解决系统在WebHook方 式出现灾难性级联故障的问题,能够达到提高WebHook方式下系统(包 括分布式系统)的容错能力,以及增加WebHook方式下系统(包括分布 式系统)的弹性。In addition, due to the simple setting of the judgment mechanism, it can efficiently solve the problem of catastrophic cascading failures in the system in the WebHook mode, improve the fault tolerance of the system (including distributed systems) in the WebHook mode, and increase the system (including distributed systems) in the WebHook mode. Distributed system) resilience.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根 据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当 然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理 解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软 件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如 ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可 以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所 述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products are stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to enable a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention.
在本实施例中还提供了一种服务数据的推送装置,该装置用于实现上 述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的, 术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例 所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的 实现也是可能并被构想的。In this embodiment, a device for pushing service data is also provided, which is used to implement the above embodiments and preferred implementation modes, and what has been described will not be repeated. As used below, the term "module" may be a combination of software and/or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
图4是根据本发明实施例的一种可选的服务数据的推送装置的结构框 图,如图4所示,该装置包括:Fig. 4 is a structural block diagram of an optional device for pushing service data according to an embodiment of the present invention. As shown in Fig. 4, the device includes:
获取模块402,用于在确定需要向接收节点推送目标服务数据的情况 下,获取第一节点的运行状态;Obtaining
推送模块404,用于在所述第一节点处于第一运行状态的情况下,将 所述目标服务数据推送至所述接收节点,其中,所述第一运行状态用于表 示推送至所述接收节点的服务数据连续发生异常的次数小于或等于第一 阈值;A
终止模块406,用于在所述第一节点处于第二运行状态的情况下,终 止向所述第一节点推送所述目标服务数据,其中,所述第二运行状态用于 表示推送至所述接收节点的服务数据连续发生异常的次数大于第一阈值。
作为一种可选的方案,在将所述目标服务数据推送至所述接收节点之 后,所述装置还用于:检测推送至所述接收节点的服务数据连续发生异常 的次数;在检测到所述推送至所述接收节点的服务数据连续发生异常的次 数小于或等于第二阈值的情况下,将所述第一节点的运行状态确定为第一 运行子状态,所述第二阈值小于所述第一阈值,所述第一运行状态包括所 述第一运行子状态;在检测到所述推送至所述接收节点的服务数据连续发 生异常的次数大于所述第二阈值,且小于所述第一阈值的情况下,将所述 第一节点的运行状态确定为第二运行子状态,所述第一运行状态包括所述 第二运行子状态;在检测到所述推送至所述接收节点的服务数据连续发生 异常的次数大于所述第一阈值的情况下,将所述第一节点的运行状态确定 为所述第二运行状态。As an optional solution, after pushing the target service data to the receiving node, the device is further configured to: detect the number of consecutive abnormal occurrences of the service data pushed to the receiving node; In the case that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the second threshold, the running state of the first node is determined as the first running sub-state, and the second threshold is less than the A first threshold, the first operating state includes the first operating sub-state; when it is detected that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the second threshold and less than the second threshold In the case of a threshold value, the operating state of the first node is determined as the second operating sub-state, and the first operating state includes the second operating sub-state; when the push to the receiving node is detected If the number of consecutive abnormal occurrences of the service data is greater than the first threshold, the operating state of the first node is determined as the second operating state.
作为一种可选的方案,在获取第一节点的运行状态之后,所述装置还 用于:在所述第一节点处于所述第二运行状态的情况下,将预定数据推送 至所述接收节点;检测推送至所述接收节点的所述预定数据是否发生异常; 在确定推送至所述接收节点的所述预定数据未发生异常的情况下,调整所 述第一节点的状态为所述第一运行状态;在确定推送至所述接收节点的所 述预定数据发生了异常的情况下,维持所述第一节点的状态为所述第二运 行状态。As an optional solution, after acquiring the running state of the first node, the device is further configured to: push predetermined data to the receiving node when the first node is in the second running state node; detecting whether the predetermined data pushed to the receiving node is abnormal; when it is determined that the predetermined data pushed to the receiving node is not abnormal, adjusting the state of the first node to the second A running state: when it is determined that the predetermined data pushed to the receiving node is abnormal, maintaining the state of the first node as the second running state.
作为一种可选的方案,在获取第一节点的运行状态之后,所述装置还 用于:在所述第一节点处于所述第二运行状态的情况下,将预定数据推送 至所述接收节点;检测推送至所述接收节点的所述预定数据连续发生异常 的次数;在检测到推送至所述接收节点的所述预定数据连续发生异常的次 数小于第三阈值的情况下,调整所述第一节点的状态为所述第一运行状态; 在推送至所述接收节点的所述预定数据连续发生异常的次数大于或等于 所述第三阈值的情况下,维持所述第一节点的状态为所述第二运行状态。As an optional solution, after acquiring the running state of the first node, the device is further configured to: push predetermined data to the receiving node when the first node is in the second running state node; detect the number of consecutive abnormal occurrences of the predetermined data pushed to the receiving node; and adjust the The state of the first node is the first operating state; when the number of consecutive abnormal occurrences of the predetermined data pushed to the receiving node is greater than or equal to the third threshold, the state of the first node is maintained is the second operating state.
作为一种可选的方案,在所述第一节点处于第一运行状态的情况下, 将所述目标服务数据推送至所述接收节点之后,所述装置还用于:获取推 送所述目标服务数据的发送时长;在所述发送时长大于或等于第一时长阈 值的情况下,确定推送至所述接收节点的所述服务数据发生异常。As an optional solution, when the first node is in the first running state, after pushing the target service data to the receiving node, the device is further configured to: acquire and push the target service The sending duration of data; when the sending duration is greater than or equal to a first duration threshold, it is determined that the service data pushed to the receiving node is abnormal.
作为一种可选的方案,在所述第一节点处于第一运行状态的情况下, 将所述目标服务数据推送至所述接收节点之后,所述装置还用于:获取所 述目标服务数据所对应的目标服务的运行状态,其中,所述目标服务的运 行状态包括可用状态和不可用状态;在所述目标服务为不可用状态的情况 下,确定推送至所述接收节点的所述目标服务数据发生异常。As an optional solution, when the first node is in the first running state, after pushing the target service data to the receiving node, the device is further configured to: acquire the target service data The running state of the corresponding target service, wherein the running state of the target service includes an available state and an unavailable state; when the target service is in an unavailable state, determine the target to be pushed to the receiving node An exception occurred in the service data.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于 后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器 中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。It should be noted that the above-mentioned modules can be realized by software or hardware. For the latter, it can be realized by the following methods, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules can be combined in any combination The forms of are located in different processors.
根据本发明实施例的又一个方面,还提供了一种用于实施上述服务数 据的推送方法的电子设备,该电子设备可以是图1所示的终端设备或服务 器。本实施例以该电子设备为服务器为例来说明。如图5所示,该电子设 备包括存储器502和处理器504,该存储器502中存储有计算机程序,该 处理器504被设置为通过计算机程序执行上述任一项方法实施例中的步骤。According to yet another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the above method for pushing service data, and the electronic device may be the terminal device or the server shown in FIG. 1 . This embodiment is described by taking the electronic device as a server as an example. As shown in Figure 5, the electronic device includes a
可选地,在本实施例中,上述电子设备可以位于计算机网络的多个网 络设备中的至少一个网络设备。Optionally, in this embodiment, the foregoing electronic device may be located in at least one network device among a plurality of network devices in the computer network.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执 行以下步骤:Optionally, in this embodiment, the aforementioned processor may be configured to execute the following steps through a computer program:
S1,在确定需要向接收节点推送目标服务数据的情况下,获取第一节 点的运行状态;S1, when it is determined that the target service data needs to be pushed to the receiving node, obtain the running status of the first node;
S2,在第一节点处于第一运行状态的情况下,将目标服务数据推送至 接收节点,其中,第一运行状态用于表示推送至接收节点的服务数据连续 发生异常的次数小于或等于第一阈值;S2. When the first node is in the first operating state, push the target service data to the receiving node, wherein the first operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the first threshold;
S3,在第一节点处于第二运行状态的情况下,终止向第一节点推送目 标服务数据,其中,第二运行状态用于表示推送至接收节点的服务数据连 续发生异常的次数大于第一阈值。S3. When the first node is in the second operating state, stop pushing the target service data to the first node, wherein the second operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold .
可选地,本领域普通技术人员可以理解,图5所示的结构仅为示意, 电子装置电子设备也可以是智能手机(如Android手机、iOS手机等)、平 板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、 PAD等终端设备。图5其并不对上述电子装置电子设备的结构造成限定。 例如,电子装置电子设备还可包括比图5中所示更多或者更少的组件(如 网络接口等),或者具有与图5所示不同的配置。Optionally, those of ordinary skill in the art can understand that the structure shown in FIG. 5 is only schematic, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, and a mobile Internet device (Mobile Internet Devices, MID), PAD and other terminal equipment. FIG. 5 does not limit the structure of the above-mentioned electronic device and electronic equipment. For example, the electronic device may also include more or fewer components than those shown in FIG. 5 (such as a network interface, etc.), or have a configuration different from that shown in FIG. 5 .
其中,存储器502可用于存储软件程序以及模块,如本发明实施例中 的服务数据的推送方法和装置对应的程序指令/模块,处理器504通过运行 存储在存储器502内的软件程序以及模块,从而执行各种功能应用以及数 据处理,即实现上述的服务数据的推送方法。存储器502可包括高速随机 存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪 存、或者其他非易失性固态存储器。在一些实例中,存储器502可进一步 包括相对于处理器504远程设置的存储器,这些远程存储器可以通过网络 连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、 移动通信网及其组合。其中,存储器502具体可以但不限于用于目标服务 数据与第一节点的运行状态等信息。作为一种示例,如图5所示,上述存 储器502中可以但不限于包括上述服务数据的推送装置中的获取模块402、 推送模块404以及终止模块406。此外,还可以包括但不限于上述服务数 据的推送装置中的其他模块单元,本示例中不再赘述。Wherein, the
可选地,上述的传输装置506用于经由一个网络接收或者发送数据。 上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装 置506包括一个网络适配器(Network Interface Controller,NIC),其可通 过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。 在一个实例中,传输装置506为射频(Radio Frequency,RF)模块,其用 于通过无线方式与互联网进行通讯。Optionally, the above-mentioned
此外,上述电子设备还包括:显示器508,用于显示上述目标服务数 据信息;和连接总线510,用于连接上述电子设备中的各个模块部件。In addition, the above-mentioned electronic device further includes: a
在其他实施例中,上述终端设备或者服务器可以是一个分布式系统中 的一个节点,其中,该分布式系统可以为区块链系统,该区块链系统可以 是由该多个节点通过网络通信的形式连接形成的分布式系统。其中,节点 之间可以组成点对点(P2P,Peer To Peer)网络,任意形式的计算设备, 比如服务器、终端等电子设备都可以通过加入该点对点网络而成为该区块 链系统中的一个节点。In other embodiments, the above-mentioned terminal device or server may be a node in a distributed system, wherein the distributed system may be a block chain system, and the block chain system may be composed of the multiple nodes communicating through the network A distributed system formed by connecting in the form of . Among them, nodes can form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing equipment, such as servers, terminals and other electronic devices, can become a node in the blockchain system by joining the peer-to-peer network.
本发明的实施例还提供了一种计算机可读存储介质,该计算机可读存 储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上 述任一项方法实施例中的步骤。Embodiments of the present invention also provide a computer-readable storage medium, in which a computer program is stored, wherein the computer program is set to execute the steps in any one of the above method embodiments when running.
在本实施例中,上述计算机可读存储介质可以被设置为存储用于执行 以下步骤的计算机程序:In this embodiment, the above-mentioned computer-readable storage medium may be configured to store a computer program for performing the following steps:
S1,在确定需要向接收节点推送目标服务数据的情况下,获取第一节 点的运行状态;S1, when it is determined that the target service data needs to be pushed to the receiving node, obtain the running status of the first node;
S2,在第一节点处于第一运行状态的情况下,将目标服务数据推送至 接收节点,其中,第一运行状态用于表示推送至接收节点的服务数据连续 发生异常的次数小于或等于第一阈值;S2. When the first node is in the first operating state, push the target service data to the receiving node, wherein the first operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the first threshold;
S3,在第一节点处于第二运行状态的情况下,终止向第一节点推送目 标服务数据,其中,第二运行状态用于表示推送至接收节点的服务数据连 续发生异常的次数大于第一阈值。S3. When the first node is in the second operating state, stop pushing the target service data to the first node, wherein the second operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold .
计算机可读存储介质还被设置为存储用于执行以下步骤的计算机程 序:The computer readable storage medium is also configured to store a computer program for performing the steps of:
S1,在确定需要向接收节点推送目标服务数据的情况下,获取第一节 点的运行状态;S1, when it is determined that the target service data needs to be pushed to the receiving node, obtain the running status of the first node;
S2,在第一节点处于第一运行状态的情况下,将目标服务数据推送至 接收节点,其中,第一运行状态用于表示推送至接收节点的服务数据连续 发生异常的次数小于或等于第一阈值;S2. When the first node is in the first operating state, push the target service data to the receiving node, wherein the first operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the first threshold;
S3,在第一节点处于第二运行状态的情况下,终止向第一节点推送目 标服务数据,其中,第二运行状态用于表示推送至接收节点的服务数据连 续发生异常的次数大于第一阈值。S3. When the first node is in the second operating state, stop pushing the target service data to the first node, wherein the second operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold .
在一个示例性实施例中,上述计算机可读存储介质可以包括但不限于: U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器 (Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各 种可以存储计算机程序的介质。In an exemplary embodiment, the above-mentioned computer-readable storage medium may include but not limited to: U disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM) , mobile hard disk, magnetic disk or optical disk and other media that can store computer programs.
本发明的实施例还提供了一种电子装置,包括存储器和处理器,该存 储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述 任一项方法实施例中的步骤。An embodiment of the present invention also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
在一个示例性实施例中,上述电子装置还可以包括传输设备以及输入 输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述 处理器连接。In an exemplary embodiment, the electronic device may further include a transmission device and an input and output device, wherein the transmission device is connected to the processor, and the input and output device is connected to the processor.
在一个示例性实施例中,上述处理器可以被设置为通过计算机程序执 行以下步骤:In an exemplary embodiment, the above-mentioned processor may be configured to perform the following steps through a computer program:
S1,在确定需要向接收节点推送目标服务数据的情况下,获取第一节 点的运行状态;S1, when it is determined that the target service data needs to be pushed to the receiving node, obtain the running status of the first node;
S2,在第一节点处于第一运行状态的情况下,将目标服务数据推送至 接收节点,其中,第一运行状态用于表示推送至接收节点的服务数据连续 发生异常的次数小于或等于第一阈值;S2. When the first node is in the first operating state, push the target service data to the receiving node, wherein the first operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is less than or equal to the first threshold;
S3,在第一节点处于第二运行状态的情况下,终止向第一节点推送目 标服务数据,其中,第二运行状态用于表示推送至接收节点的服务数据连 续发生异常的次数大于第一阈值。S3. When the first node is in the second operating state, stop pushing the target service data to the first node, wherein the second operating state is used to indicate that the number of consecutive abnormal occurrences of the service data pushed to the receiving node is greater than the first threshold .
本实施例中的具体示例可以参考上述实施例及示例性实施方式中所 描述的示例,本实施例在此不再赘述。For specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and exemplary implementation manners, and details will not be repeated here in this embodiment.
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤 可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者 分布在多个计算装置所组成的网络上,它们可以用计算装置可执行的程序 代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并 且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或 者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件 和软件结合。Obviously, those skilled in the art should understand that each module or each step of the above-mentioned present invention can be realized by a general-purpose computing device, and they can be concentrated on a single computing device, or distributed in a network formed by multiple computing devices In fact, they can be implemented in program code executable by a computing device, and thus, they can be stored in a storage device to be executed by a computing device, and in some cases, can be executed in an order different from that shown here. Or described steps, or they are fabricated into individual integrated circuit modules, or multiple modules or steps among them are fabricated into a single integrated circuit module for implementation. As such, the present invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于 本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的原 则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护 范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention can have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present invention shall be included within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011300195.3A CN112769889B (en) | 2020-11-18 | 2020-11-18 | Method, device, storage medium and electronic device for pushing service data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011300195.3A CN112769889B (en) | 2020-11-18 | 2020-11-18 | Method, device, storage medium and electronic device for pushing service data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112769889A CN112769889A (en) | 2021-05-07 |
CN112769889B true CN112769889B (en) | 2022-12-06 |
Family
ID=75693134
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011300195.3A Active CN112769889B (en) | 2020-11-18 | 2020-11-18 | Method, device, storage medium and electronic device for pushing service data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112769889B (en) |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8108537B2 (en) * | 2008-07-24 | 2012-01-31 | International Business Machines Corporation | Method and system for improving content diversification in data driven P2P streaming using source push |
CN104901955B (en) * | 2015-05-20 | 2017-09-26 | 腾讯科技(深圳)有限公司 | A kind of method for early warning, device and processing server |
US10169138B2 (en) * | 2015-09-22 | 2019-01-01 | Walmart Apollo, Llc | System and method for self-healing a database server in a cluster |
CN107171926B (en) * | 2017-03-23 | 2020-08-14 | 深圳市口袋网络科技有限公司 | Switching method and device of multi-platform message push service |
CN109218349A (en) * | 2017-06-29 | 2019-01-15 | 北京微影时代科技有限公司 | A kind of method and device of management server cluster |
CN109936613B (en) * | 2017-12-19 | 2021-11-05 | 北京京东尚科信息技术有限公司 | Disaster recovery method and device applied to server |
CN110557273A (en) * | 2018-06-04 | 2019-12-10 | 视联动力信息技术股份有限公司 | Terminal state warning method and device |
CN109600444A (en) * | 2018-12-14 | 2019-04-09 | 北京向上心科技有限公司 | Data push method, server, terminal, electronic equipment and readable storage medium storing program for executing |
CN111212391B (en) * | 2020-01-14 | 2022-04-29 | 中保车服科技服务股份有限公司 | Short message pushing method, device, equipment and readable medium |
CN111367521A (en) * | 2020-02-21 | 2020-07-03 | 国铁吉讯科技有限公司 | Message sending method and device and message receiving method and device |
CN111355802B (en) * | 2020-03-03 | 2023-04-18 | 中国邮政储蓄银行股份有限公司 | Information pushing method and device |
CN111711697A (en) * | 2020-06-17 | 2020-09-25 | 北京同邦卓益科技有限公司 | Message pushing method, device, equipment and storage medium |
-
2020
- 2020-11-18 CN CN202011300195.3A patent/CN112769889B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN112769889A (en) | 2021-05-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112422684B (en) | Target message processing method and device, storage medium and electronic device | |
US11425014B2 (en) | Scalable in-band telemetry metadata extraction | |
CN112612769A (en) | File processing method, device and storage medium | |
CN114338477B (en) | Communication link monitoring method, device, equipment and storage medium | |
CN113326154A (en) | Connection management method, device, electronic equipment and storage medium | |
EP3930267A1 (en) | Link aggregation port switching method, network device and computer storage medium | |
US20150067066A1 (en) | Provisioning Communication Services using Proxy Server in a Cloud | |
CN112769889B (en) | Method, device, storage medium and electronic device for pushing service data | |
KR20190051585A (en) | Sever and network system using the same | |
US20200412603A1 (en) | Method and system for managing transmission of probe messages for detection of failure | |
WO2020037607A1 (en) | Data transmission method and apparatus | |
CN117478720A (en) | Overtime reconnection method, device and application for SSE | |
CN114885373B (en) | A node data uploading method, device, equipment and storage medium | |
CN113596938B (en) | Network switching method and device for mobile terminal, storage medium, and electronic device | |
US20200169487A1 (en) | Method, device and system for monitoring node survival state | |
EP2951708B1 (en) | Reporting errors on serial interfaces to application layers for flexible error handling approach selection | |
CN115883466A (en) | Switch control method and device, storage medium and electronic device | |
CN112655178A (en) | Method, system and device for sending link aggregation control protocol message | |
CN108400897A (en) | network security configuration method and device | |
CN114125023A (en) | Data connection determination method and device, storage medium and electronic device | |
CN112437146A (en) | Equipment state synchronization method, device and system | |
KR101902075B1 (en) | Sever and network system using the same | |
CN111008173A (en) | Serial communication method, device and system | |
CN116032831B (en) | Link aggregation method and device | |
CN110120881B (en) | Data synchronization method and device |
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 |