WO2017114165A1 - 消息流量控制方法、装置及相关系统 - Google Patents

消息流量控制方法、装置及相关系统 Download PDF

Info

Publication number
WO2017114165A1
WO2017114165A1 PCT/CN2016/110051 CN2016110051W WO2017114165A1 WO 2017114165 A1 WO2017114165 A1 WO 2017114165A1 CN 2016110051 W CN2016110051 W CN 2016110051W WO 2017114165 A1 WO2017114165 A1 WO 2017114165A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
processing node
flow control
message
processing
Prior art date
Application number
PCT/CN2016/110051
Other languages
English (en)
French (fr)
Inventor
刘键
封仲淹
方孝健
王逸
伍翀
Original Assignee
阿里巴巴集团控股有限公司
刘键
封仲淹
方孝健
王逸
伍翀
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 阿里巴巴集团控股有限公司, 刘键, 封仲淹, 方孝健, 王逸, 伍翀 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017114165A1 publication Critical patent/WO2017114165A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/26Flow control; Congestion control using explicit feedback to the source, e.g. choke packets
    • H04L47/263Rate modification at the source after receiving feedback

Definitions

  • the present invention relates to the field of distributed real-time computing technologies, and in particular, to a message flow control method, apparatus, and related system.
  • the message sending rate of the upstream data source or processing node should match the message processing rate of the adjacent downstream processing node; if the upstream node has a message traffic peak and/or the downstream processing node has insufficient processing capacity, As a result, the upstream message sending rate is greater than the downstream message processing rate, which causes a large amount of message backlog, processor pressure increase, and even some messages are discarded due to processing timeout, and the actual effective processing capability of the system decreases.
  • the message traffic is constantly changing. When the traffic peak arrives, each node is required to process the received message as quickly as possible. Otherwise, it will affect other normal running nodes or Calculation task.
  • a flow control value R0 is configured in the data source to represent the number of outstanding messages allowed by the system, and an actual outstanding message is determined according to the message processing condition of the last processing node in the pipeline during system operation.
  • the quantity R if R>R0, indicates that the message traffic is too large, then the control data source reduces the number of message transmissions; conversely, if R ⁇ R0, indicating that the message traffic is too small, the control data source increases the number of message transmissions.
  • the above traffic control policy has serious drawbacks in practical applications; for example, if the flow control value is configured too high and the message discarding amount is too high, the system instability will still occur, but when the flow control value is configured too low, It also causes the computing resources to be idle.
  • the present application discloses a message flow control method, apparatus and related system.
  • a first aspect of the present application provides a message flow control method, the method being applied to a data processing system, where the data processing system includes a data source and a plurality of processing nodes; the method includes:
  • the upstream data node may be the data source or a processing node.
  • Corresponding flow control requests including:
  • the message sending rate of the upstream data node adjacent to the first processing node is adjusted according to the flow control request, include:
  • the flow control request is the traffic reduction request, determining a message sending delay time according to a message processing rate of the first processing node and an original message sending rate of the upstream data node;
  • the message sending rate of the upstream data node adjacent to the first processing node is adjusted according to the flow control request, include:
  • the message sending rate of the upstream data node is gradually increased according to a preset rate adjustment step to a preset normal rate.
  • the method before the adjusting the message sending rate of the upstream data node adjacent to the first processing node according to the flow control request, the method further includes:
  • the method further includes:
  • the sixth feasible in the first aspect In an implementation manner, determining, according to the sampling result, whether the actual message receiving amount of the corresponding processing node is within a preset traffic threshold threshold interval, including:
  • the ratio is greater than a preset threshold, it is determined that the actual message reception amount of the corresponding processing node is not within its preset traffic threshold interval.
  • a second aspect of the present application provides a message flow control apparatus, the apparatus being applied to a data processing system, the data processing system including a data source and a plurality of processing nodes; the apparatus comprising: a trigger and a controller;
  • the trigger is set in each processing node, and is used for sampling the message receiving quantity of the processing node where the processing node is located, and determining whether the actual message receiving quantity of the processing node where the processing node is located is within the preset traffic threshold threshold interval according to the sampling result. And generating a corresponding flow control request when the actual message receiving amount of the processing node at the processing node is not within the preset traffic threshold interval;
  • the controller is disposed in each of the data nodes having the downstream processing node, and is configured to adjust a message sending rate of the data node where the data node is located according to the flow control request of the downstream processing node corresponding to the data node where the data node is located; wherein the data node It can be the data source or processing node.
  • the triggering is performed to generate a corresponding flow control request, where the actual message receiving quantity of the processing node in the processing node is not within the preset traffic threshold interval.
  • the device is configured to:
  • a traffic increase request is generated when the actual message received by the processing node at which the node is located is greater than the preset minimum traffic threshold.
  • the message sending of the data node where the data node is located is adjusted according to the flow control request of the downstream processing node corresponding to the data node where the data node is located.
  • the controller is configured to:
  • the message processing rate of the point, and the original message sending rate of the data node where the data node is located determine the message sending delay time, and superimpose the message sending delay time and the original message sending rate to obtain the target message sending rate of the data node where the data node is located. .
  • the message sending of the data node where the data node is located is adjusted according to the flow control request of the downstream processing node corresponding to the data node where the data node is located.
  • the controller is configured to:
  • the step size is adjusted according to the preset rate to gradually increase the message sending rate of the data node where the data node is located to a preset normal rate.
  • the device further includes: a first coordinator;
  • the first coordinator is disposed in parallel with each processing node in the data processing system, configured to acquire a flow control request sent by the trigger, and forward the flow control request to a controller of a corresponding upstream data node;
  • the first coordinator acquires multiple flow control requests sent to the controller of the same upstream data node within a preset time period, the first coordinator determines that each flow control request is for the same upstream The amount of change in the message transmission rate caused by the data node, and the flow control request corresponding to the maximum value of the message transmission rate change is sent to the controller of the same upstream data node.
  • the device further includes: a second coordinator;
  • the second coordinator is disposed in parallel with each processing node in the data processing system, and configured to store the flow control state of each processing node to a preset storage module, and store the preset storage module according to a preset period.
  • the flow control state is synchronized to the corresponding processing node.
  • the trigger in order to determine whether the actual message receiving amount of the processing node where the processing node is located is within the preset traffic threshold interval according to the sampling result, the trigger is configured to:
  • a third aspect of the present application provides a data processing system including a data source, a plurality of processing nodes, and any of the above message flow control devices.
  • the embodiment of the present application samples the message receiving amount of each processing node, and generates a corresponding flow control once the actual message receiving amount of a processing node is not within the corresponding preset traffic threshold interval. And requesting, according to the flow control request, adjusting a message sending rate of the upstream data node corresponding to the processing node, so that dynamic control of message traffic between any two adjacent upstream and downstream data nodes can be implemented, compared with the prior art.
  • the control precision of the present application is higher, and any processing node does not have a message backlog or idle phenomenon, thereby reducing the amount of message discarding.
  • 1 is a topological structural diagram of an existing data processing system
  • FIG. 2 is a flowchart of a message flow control method according to an embodiment of the present application.
  • FIG. 3 is a topological structural diagram of a data processing system according to an embodiment of the present application.
  • FIG. 4 is a message flow control based on the topology shown in FIG. 3 according to an embodiment of the present application. Signal flow diagram of the method;
  • FIG. 5 is a schematic diagram of a working principle of a message flow control apparatus according to an embodiment of the present disclosure
  • FIG. 6 is a topological structural diagram of another data processing system according to an embodiment of the present application.
  • the method can be applied to any pipelined data processing system including a data source and a plurality of processing nodes, such as real-time computing systems such as Storm, Jstorm, and Spark streaming, to adjust message traffic between nodes in the pipeline to implement data sources and
  • the message transmission rate of any processing node matches the message processing rate of the corresponding downstream processing node.
  • FIG. 2 is a flowchart of a message flow control method according to an embodiment of the present disclosure; referring to FIG. 2, the method includes the following steps.
  • the embodiment sets a corresponding preset traffic threshold interval for each processing node in advance;
  • the topology diagram shown in 1 is taken as an example.
  • the node to be sampled includes all three processing nodes.
  • the preset traffic threshold interval corresponding to the processing node A is set to [A1, B1]
  • the processing node B is processed.
  • the corresponding preset traffic threshold interval is [A2, B2]
  • the preset traffic threshold interval corresponding to the processing node C is [A3, B3].
  • the message receiving amount of each processing node is respectively sampled, that is, the load of the corresponding processing node, and the processing node is judged according to the sampling result of each processing node respectively. Whether the actual message reception is within its preset traffic threshold interval. Still taking FIG. 1 as an example, it is determined according to the sampling result of the processing node A whether the actual message receiving amount of the processing node A is within the corresponding interval [A1, B1] of the processing node A, and correspondingly, according to the sampling result of the processing node B. Whether the actual message reception amount of the processing node B is within the interval [A2, B2], and so on. That is, it is detected in step S11 whether the load of each processing node and its processing capability match.
  • a corresponding flow control request is generated, and according to the The flow control request adjusts the message sending rate of the upstream data node corresponding to the processing node.
  • the upstream data node may be a data source or a processing node according to different locations of the processing nodes in the pipeline. Taking FIG. 1 as an example, for two nodes of the data source and the processing node A, the processing node A is equivalent to the first processing node, the data source S is equivalent to the upstream data node, and the processing node A and the processing node B are two nodes. The processing node B corresponds to the first processing node, and the processing node A corresponds to the upstream data node.
  • the embodiment of the present application samples the message receiving amount of each processing node, and generates a corresponding flow control once the actual message receiving amount of a processing node is not within the corresponding preset traffic threshold interval. And requesting, according to the flow control request, adjusting a message sending rate of the upstream data node corresponding to the processing node, so that dynamic control of message traffic between any two adjacent upstream and downstream data nodes can be implemented, compared with the prior art.
  • the control precision of the present application is higher, and any processing node does not have a message backlog or idle phenomenon, which reduces the amount of message discarding and improves the whole.
  • Data processing system stability Qualitative and processing efficiency.
  • a trigger may be separately set at each processing node of the data processing system, and the above steps S11 and S12 are performed by the trigger, and at the same time, a controller is set in the data source and each processing node, and The controller performs the above step S13.
  • the controller C_S is set in the data source S
  • the trigger T_A and the controller C_A are set in the processing node A
  • the trigger T_B is set in the processing node B.
  • the trigger T_C is set in node C, as shown in FIG.
  • the processing node A is equivalent to the first processing node
  • the data source S is equivalent to the upstream data node
  • step S111 the trigger T_A samples the message receiving amount of the processing node A, and determines whether the actual message receiving amount is within the corresponding preset traffic threshold threshold interval [A1, B1] according to the sampling result;
  • step S121 when the trigger T_A determines that the actual message reception amount of the processing node A is not within [A1, B1] (greater than B1, or less than A1), that is, the load and processing capability of the processing node A do not match, then the trigger T_A is generated. Flow control request and send it to data source S;
  • step S131 the controller C_S adjusts the message transmission rate of the data source S according to the flow control request sent by the trigger T_A.
  • the number of messages sent to the processing node A per unit time by the above steps S111, S121 and S131 that is, the actual message receiving amount of the processing node A per unit time, can be matched with the number of message processing of the processing node A, which can avoid When the message transmission rate of the data source S is too large, the message is accumulated in the processing node A, and the message transmission rate of the data source S is prevented from being too small, and the processing node A is idle.
  • the processing node B is equivalent to the first processing node
  • the processing node A is equivalent to the upstream data node
  • step S112 the trigger T_B samples the message receiving amount of the processing node B, and determines whether the actual message receiving amount is within the corresponding preset traffic threshold interval [A2, B2] according to the sampling result;
  • step S122 when the trigger T_B determines that the actual message reception amount of the processing node B is not within [A2, B2], then generates a flow control request and sends it to the processing node A;
  • step S132 the controller C_A adjusts the message transmission rate when the processing node A transmits a message to the processing node B according to the flow control request transmitted by the trigger T_B. That is, the actual message reception amount of the processing node B per unit time is matched with the number of message processing by the above-described steps S112, S122, and S132.
  • the message flow control process is similar to the above steps S112, S122 and S132, and will not be further described herein.
  • the step S11 determines whether the actual message receiving amount of the corresponding processing node is within the preset traffic threshold threshold according to the sampling result, and specifically includes the following steps:
  • any processing node For any processing node, calculating a ratio between the number of sampled values that are not in the preset flow threshold range and the total number of sampled values in the preset sampling period that are collected in the preset sampling period; If the ratio is greater than the preset threshold, it is determined that the actual message reception amount of the corresponding processing node is not within the preset traffic threshold interval.
  • a flow control request is generated for each sampling value that is not within the preset traffic threshold interval.
  • the proportion of the sample value exceeding the preset traffic threshold interval in a preset sampling period is greater than a preset threshold
  • the flow control request is generated to initiate the adjustment of the message sending rate of the upstream data node, which can avoid frequent adjustments such as system jitter and processing capability.
  • the determining, according to the sampling result corresponding to the first processing node, that the actual message receiving amount of the first processing node is not within the preset traffic threshold interval, generating corresponding traffic may specifically include the following two situations:
  • a traffic reduction request is generated to control the upstream data node to reduce the message sending rate; and the message is sent by the upstream data node.
  • the rate is decreased, the actual message receiving amount of the processing node is also decreased.
  • a traffic increase request is generated to stop the control of the lowering of the message sending rate of the upstream data node, so that the message is stopped.
  • the send rate is gradually increased until it returns to normal.
  • the foregoing flow control request includes not only information for indicating that the upstream data node raises or lowers the message sending rate, but also a message processing rate of the processing node that generates the flow control request;
  • the flow control request is the foregoing traffic reduction request
  • the method for adjusting the message sending rate of the upstream data node in the foregoing step S13 is:
  • the flow control request is the traffic reduction request, determining a message sending delay time according to a message processing rate of the first processing node and an original message sending rate of the upstream data node;
  • the message processing rate of the first processing node is TPS_DownStream
  • the original message sending rate of the corresponding upstream data node is TPS_UpStream
  • the traffic control request is a traffic reduction request, which can be inferred.
  • UpStream_TPS>TPS_DownStream so you need to delay the T_delay (that is, the above message sending delay time) when the upstream node sends a message to reduce the UpStream_TPS.
  • T_delay 1/TPS_DownStream-1/UpStream_TPS.
  • the above T_delay and UpStream_TPS are superimposed to obtain an adjusted message sending rate, that is, the target message sending rate UpStream_TPS';
  • the superposition calculation formula can be:
  • UpStream_TPS' 1/[(1/UpStream_TPS)+T_delay].
  • the network or other intermediate links have a certain impact on the message sending rate or the message processing rate, so that the upstream data node still receives the flow control of the downstream processing node after applying the adjusted message sending rate.
  • the method for adjusting the message sending rate of the upstream data node in step S13 is: adjusting the step according to the preset rate.
  • the message transmission rate of the upstream data node is gradually increased to a preset normal rate.
  • the message sending rate of the upstream data node is gradually increased, instead of being restored to the preset normal rate at one time; compared to the above-mentioned adjustment method based on the message sending delay time T_delay, the received traffic is increased.
  • T_delay When requesting, gradually reduce the value of T_delay until 0, and UpStream_TPS' is gradually increased to UpStream_TPS.
  • the response information may be fed back to the corresponding downstream processing node to notify the downstream processing node that the control ends; correspondingly, downstream The processing node receives the response letter After the message, the request is no longer sent, but it is still sampled to detect whether the actual message reception amount of itself is within the preset traffic threshold interval.
  • the flow control request generated in step S12 may be directly sent by the first processing node to the corresponding upstream data node.
  • the flow control request may also be The flow control request is forwarded by an independent node, and the independent node receives the flow control request of each processing node, determines its corresponding upstream data node, and forwards the flow control request to the upstream data node.
  • the trigger and the controller are set in the node according to the foregoing embodiment, and the independent node in this embodiment may be a coordinator disposed in the system.
  • a certain upstream data node may have multiple downstream processing nodes.
  • multiple downstream processing nodes may detect their actual conditions in the same detection period.
  • the message receiving quantity is not in the preset traffic threshold interval, so that the flow control request is generated accordingly. If the message sending rate of the upstream data node is adjusted according to the flow control request of each downstream processing node, it needs to be adjusted multiple times, not only The workload is large, and the system may be unstable due to frequent adjustments.
  • the message flow control method may further include the following steps:
  • the processing node A has two downstream processing nodes, that is, the processing node B and the processing node C, which may occur in the same detection period, and the processing node Both B and the processing node C detect that the actual message reception amount of the device is not within the preset traffic threshold interval, and generates a flow control request; for the two flow control requests, the message transmission to the processing node A is selected through calculation and comparison.
  • a flow control request having the largest rate change, and adjusting the message sending rate of the processing node A according to the selected flow control request.
  • the message transmission rate change amount caused by the flow control request to the corresponding processing node may be measured by the message transmission delay time T_delay described above.
  • the same upstream data node receives multiple flow control requests, and filters a flow control request for the amount of change caused by the message sending rate of the upstream data node according to each flow control request, and is used to adjust the upstream data node.
  • the message transmission rate can reduce the number of adjustments, which can reduce the workload of flow control, avoid system jitter caused by frequent adjustments in a short period of time, and improve system stability.
  • the above steps S14 and S15 can be performed by the coordinator described in the above embodiments, and the target flow control request determined in step S15 is sent to the controller of the corresponding upstream data node to avoid the screening process on the upstream data node.
  • the occupation of resources such as memory.
  • the foregoing message flow control method may further include the following steps:
  • the preset storage module may be a coordination server external to the real-time computing system, such as ZooKeeper.
  • the flow control state includes at least two types: for any processing node, if it receives the traffic reduction request, it corresponds to The flow control state is the downflow control state (ie, the processing node sends a message to the downstream processing node at a message transmission rate lower than the default value); if it receives the traffic increase request or does not receive any flow control request, then its The corresponding flow control state is an uncontrolled state (ie, the processing node sends a message to the downstream processing node at a default message sending rate).
  • the above steps S16 and S17 can also be performed by the coordinator described above.
  • the embodiment of the present application further provides a message flow control device applied to a pipelined data processing system, and the pipelined data processing system includes a data source and a plurality of processing nodes;
  • the data source and each processing node are collectively referred to as data nodes hereinafter.
  • the message flow control apparatus includes: triggers respectively disposed in each of the processing nodes, and controllers respectively disposed in each of the data nodes having the downstream processing nodes.
  • the topology of the data processing system provided with the above message flow control device can be referred to FIG.
  • the trigger is configured to sample the message receiving quantity of the processing node where the processing node is located, and determine, according to the sampling result, whether the actual message receiving quantity of the processing node where the processing node is located is within the preset traffic threshold threshold interval, and is in the processing node where the processing node is located.
  • a corresponding flow control request is generated.
  • the controller is configured to adjust a message sending rate of the data node where the data node is located according to the flow control request of the downstream processing node corresponding to the data node where the data node is located.
  • FIG. 5 a block diagram of any one of the upstream data node 510 and a downstream data node 520 adjacent thereto in the data processing system provided with the message flow control device; wherein, in a specific case, the upstream data Both node 510 and downstream data node 520 are processing nodes. In another specific case, the upstream data node 510 is a data source and the downstream data node 520 is a processing node.
  • the dashed box and the dashed arrow in Fig. 5 indicate the structure and information flow that exist in one case and not exist in the other case.
  • the operation of the message flow control device is as follows: the trigger 521 of the downstream data node 520 samples the message reception amount of the downstream data node 520, and determines the downstream data according to the sampling result.
  • Node 520 Whether the actual message reception amount is within the preset traffic threshold interval of the downstream data node 520, if not, generating a corresponding flow control request, and transmitting the flow control request to the controller 512 of the upstream data node 510; the controller 512 After receiving the flow control request sent by the trigger 521, the message sending rate of the upstream data node 510 is adjusted according to the flow control request, so that the actual message receiving amount of the downstream data node 520 can be controlled to the preset traffic of the downstream data node 520. Within the threshold interval.
  • the embodiment of the present application samples the message receiving amount of each processing node, and generates a corresponding flow control once the actual message receiving amount of a processing node is not within the corresponding preset traffic threshold interval. And requesting, according to the flow control request, adjusting a message sending rate of the upstream data node corresponding to the processing node, so that dynamic control of message traffic between any two adjacent upstream and downstream data nodes can be implemented, compared with the prior art.
  • the control precision of the present application is higher, and any processing node does not have a message backlog or idle phenomenon, which reduces the amount of message discarding and improves the whole.
  • the stability and processing efficiency of the data processing system is higher, and any processing node does not have a message backlog or idle phenomenon, which reduces the amount of message discarding and improves the whole.
  • the trigger in order to determine whether the actual message receiving amount of the processing node where the processing node is located is within the preset traffic threshold interval according to the sampling result, the trigger may be configured to: calculate the preset sampling period. The ratio between the number of sampled values that are not within the preset flow threshold range and the total number of sampled values in the preset sampling period, and determines that the processing is performed when the ratio is greater than a preset threshold. The actual message reception of the node is not within its preset traffic threshold interval.
  • a proportion of the sample value exceeding the preset traffic threshold interval in a preset sampling period is generated with respect to generating a flow control request for each sample value that is not within the preset traffic threshold interval.
  • the threshold is greater than the preset threshold, the traffic control request is generated, and the rate of sending the message to the upstream data node is adjusted. This prevents frequent system adjustments and system degradation.
  • the corresponding flow control request is generated.
  • the above trigger can be configured to:
  • a traffic increase request is generated when the actual message received by the processing node at which the node is located is greater than the preset minimum traffic threshold.
  • the controller in order to implement a flow control request of a downstream processing node corresponding to the data node in which the data node is located, and adjust a message sending rate of the data node where the data node is located, the controller may be configured to: When the request is the traffic reduction request, determining a message sending delay time according to the message processing rate of the downstream processing node and the original message sending rate of the data node where the data node is located, and sending the message sending delay time and the original message The rate is superimposed to obtain the target message transmission rate of the data node where it is located.
  • the controller in order to implement a flow control request of a downstream processing node corresponding to the data node in which the data node is located, and adjust a message sending rate of the data node where the data node is located, the controller may be configured to:
  • the step size is adjusted according to the preset rate to gradually increase the message sending rate of the data node where the data node is located to a preset normal rate.
  • the message flow control apparatus may further include a coordinator, which is disposed in parallel with each processing node in the data processing system, and the coordinator is configured to acquire the generated by each trigger.
  • a flow control request forwards the flow control request to a corresponding upstream data node.
  • FIG. 6 is a topological structural diagram of the system topology structure provided with the message flow control device shown in FIG. 3 after adding a coordinator.
  • the coordinator K acquires the flow control request of the trigger T_A, the trigger T_B, and the trigger T_C, respectively, and forwards the flow control request of the trigger T_A to the controller C_S of the data source S, and triggers the trigger T_B and the trigger
  • the flow control request of the T_C is forwarded to the controller C_A of the processing node A, respectively.
  • the coordinator may be configured to: obtain a plurality of flow control requests sent to a controller of the same upstream data node within a preset time period, where the first coordinator determines Each flow control request sends a message change rate to the same upstream data node, and sends a flow control request corresponding to the maximum value of the message transmission rate change to the controller of the same upstream data node.
  • the coordinator K acquires both the flow control request Q_B of the trigger T_B and the flow control request Q_C of the trigger T_C in a preset time period, in order to reduce the message of the common upstream processing node A thereof.
  • the number of transmission rate adjustments is ensured to ensure the stability of the system.
  • the coordinator K determines the amount of change in the message transmission rate caused by the flow control request Q_B and Q_C to the processing node A, and selects a flow control request with a large change in the message transmission rate, which is assumed to be The flow control request Q_B, the coordinator K only forwards the flow control request Q_B to the controller C_A, and discards the flow control request Q_C; accordingly, the controller C_A only needs to adjust the message sending rate of the processing node A according to the flow control request Q_B.
  • the coordinator is further configured to: store the flow control state of each processing node to the preset storage module, and store the preset storage module according to a preset period.
  • the flow control state is synchronized to the corresponding processing node; thus, the processing node can still be in the correct flow control state after the failure restart, thereby ensuring the stability of the system.
  • the embodiment of the present application further provides a data processing system, including a data source, multiple processing nodes, and the message flow control apparatus described in any of the above embodiments.
  • a data processing system including a data source, multiple processing nodes, and the message flow control apparatus described in any of the above embodiments.
  • the structure of the system can be referred to FIG. 3 and FIG. 6.
  • flow control process reference may be made to the above method and device embodiment, and details are not described herein.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请公开了一种消息流量控制方法、装置及相关系统,其通过对每个处理节点的消息接收量进行采样,一旦某个处理节点的实际消息接收量不在其对应的预设流量阈值区间内,则生成相应的流量控制请求,并根据该流量控制请求调整该处理节点对应的上游数据节点的消息发送速率,从而实现对任意两个相邻上下游数据节点之间的消息流量的动态控制,相对于现有技术只根据最后一个处理节点的未处理消息数量来调整数据源的消息发送速率的方式,本申请控制精度更高,任意一个处理节点都不会出现消息积压或空闲的现象,从而可以减少消息丢弃量,提高整个数据处理系统的稳定性及处理效率。

Description

消息流量控制方法、装置及相关系统 技术领域
本发明涉及分布式实时计算技术领域,特别是涉及消息流量控制方法、装置及相关系统。
背景技术
现有数据处理系统大多采用流水线式处理方式,如图1所示拓扑图,消息从数据源S发出后,依照各个处理节点之间的逻辑关系逐步向下游流动;处理节点的总个数及每条流水线上的节点个数根据实际数据处理逻辑而定,图1仅以A、B和C的三个处理节点为例,箭头表示消息流动方向。
正常情况下,处于上游的数据源或处理节点的消息发送速率应当与相邻的下游处理节点的消息处理速率相匹配;如果因上游节点出现消息流量高峰和/或下游处理节点的处理能力不够,导致上游的消息发送速率大于下游的消息处理速率,则会造成大量的消息积压、处理器压力增加,甚至导致部分消息因处理超时而被丢弃,系统实际有效处理能力下降。特别是Storm、Jstorm、Spark streaming等实时计算系统,消息流量不断变化,在流量高峰到来时,要求每个节点都能都能尽快有效的处理接收到的消息,否则将影响其他正常运行的节点或计算任务。
相关技术中采用如下流量控制策略:在数据源配置一个流控值R0,表征系统允许的未完成消息数量,在系统运行过程中,根据流水线中最后一个处理节点的消息处理情况确定实际未完成消息数量R,如果R>R0,说明消息流量过大,则控制数据源减少消息发送数量;反之,如果R<R0,说明消息流量过小,则控制数据源增加消息发送数量。上述流量控制策略在实际应用中存在较严重的弊端;例如:如果上述流控值配置的太高,消息丢弃量过高,仍然会造成系统的不稳定,但是流控值配置的太低时,又会造成计算资源的空闲。
发明内容
为了解决上述技术问题,本申请公开了一种消息流量控制方法、装置及相关系统。
本申请第一方面提供了一种消息流量控制方法,所述方法应用于数据处理系统,所述数据处理系统包括数据源和多个处理节点;所述方法包括:
分别对每个处理节点的消息接收量进行采样,并根据采样结果判断相应处理节点的实际消息接收量是否在其预设流量阈值区间内;
在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求;
根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率;其中,所述上游数据节点可以为所述数据源或者处理节点。
结合第一方面,在第一方面第一种可行的实施方式中,在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量不在预设流量阈值区间内时,生成相应的流量控制请求,包括:
在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量大于预设最高流量阈值时,生成流量降低请求;
在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量小于预设最低流量阈值时,生成流量升高请求。
结合第一方面第一种可行的实施方式,在第一方面第二种可行的实施方式中,根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率,包括:
在所述流量控制请求为所述流量降低请求时,根据所述第一处理节点的消息处理速率和所述上游数据节点的原始消息发送速率确定消息发送延迟时间;
将所述消息发送延迟时间与所述原始消息发送速率进行叠加,得到所述上游数据节点的目标消息发送速率。
结合第一方面第一种可行的实施方式,在第一方面第三种可行的实施方式中,根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率,包括:
在所述流量控制请求为所述流量升高请求时,根据预设速率调整步长逐步提高所述上游数据节点的消息发送速率至预设正常速率。
结合第一方面,或者第一方面第一种可行的实施方式,或者第一方面第二种可行的实施方式,或者第一方面第三种可行的实施方式,在第一方面第四种可行的实施方式中,在根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率之前,所述方法还包括:
如果在预设时段内所述上游数据节点对应的多个下游处理节点均生成相应的流量控制请求,则确定每个下游处理节点对应的流量控制请求对所述上游数据节点造成的消息发送速率变化量;
确定消息发送速率变化量最大值对应的目标流量控制请求,以根据所述目标流量控制请求调整所述上游数据节点的消息发送速率。
结合第一方面,或者第一方面第一种可行的实施方式,或者第一方面第二种可行的实施方式,或者第一方面第三种可行的实施方式,在第一方面第五种可行的实施方式中,所述方法还包括:
将各个处理节点的流量控制状态存储至预设存储模块;
根据预设周期将所述预设存储模块存储的所述流量控制状态同步至相应的处理节点。
结合第一方面,或者第一方面第一种可行的实施方式,或者第一方面第二种可行的实施方式,或者第一方面第三种可行的实施方式,在第一方面第六种可行的实施方式中,根据采样结果判断相应处理节点的实际消息接收量是否满足在其预设流量阈值区间内,包括:
对于任一处理节点,计算预设采样周期内采集到的不在其预设流量阈值区间内的采样值个数与所述预设采样周期内的采样值总个数之间的比值;
如果所述比值大于预设阈值,则判定相应处理节点的实际消息接收量不在其预设流量阈值区间内。
本申请第二方面提供了一种消息流量控制装置,所述装置应用于数据处理系统,所述数据处理系统包括数据源和多个处理节点;所述装置包括:触发器和控制器;
所述触发器设置于每个处理节点中,用于对自身所在处理节点的消息接收量进行采样,并根据采样结果判断自身所在处理节点的实际消息接收量是否在其预设流量阈值区间内,并在自身所在处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求;
所述控制器设置于每个具有下游处理节点的数据节点中,用于根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率;其中,所述数据节点可以为所述数据源或者处理节点。
结合第二方面,在第二方面第一种可行的实施方式中,为实现在自身所在处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求,所述触发器被配置为:
在自身所在处理节点的实际消息接收量大于预设最高流量阈值时,生成流量降低请求;
在自身所在处理节点的实际消息接收量大于预设最低流量阈值时,生成流量升高请求。
结合第二方面第一种可行的实施方式,在第二方面第二种可行的实施方式中,为实现根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率,所述控制器被配置为:
在所述流量控制请求为所述流量降低请求时,根据所述下游处理节 点的消息处理速率,以及自身所在数据节点的原始消息发送速率确定消息发送延迟时间,并将所述消息发送延迟时间与所述原始消息发送速率进行叠加,得到自身所在数据节点的目标消息发送速率。
结合第二方面第一种可行的实施方式,在第二方面第三种可行的实施方式中,为实现根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率,所述控制器被配置为:
在所述流量控制请求为所述流量升高请求时,根据预设速率调整步长逐步提高自身所在数据节点的消息发送速率至预设正常速率。
结合第二方面,或者第二方面第一种可行的实施方式,或者第二方面第二种可行的实施方式,或者第二方面第三种可行的实施方式,在第二方面第四种可行的实施方式中,所述装置还包括:第一协调器;
所述第一协调器与各个处理节点并列设置于所述数据处理系统中,用于获取所述触发器发送的流量控制请求,并将所述流量控制请求转发至相应上游数据节点的控制器;
其中,如果所述第一协调器在预设时段内获取到多条向同一上游数据节点的控制器发送的流量控制请求,则所述第一协调器确定每条流量控制请求对所述同一上游数据节点造成的消息发送速率变化量,并将消息发送速率变化量最大值对应的流量控制请求发送至所述同一上游数据节点的控制器。
结合第二方面,或者第二方面第一种可行的实施方式,或者第二方面第二种可行的实施方式,或者第二方面第三种可行的实施方式,在第二方面第五种可行的实施方式中,所述装置还包括:第二协调器;
所述第二协调器与各个处理节点并列设置于所述数据处理系统中,用于将各个处理节点的流量控制状态存储至预设存储模块,并根据预设周期将所述预设存储模块存储的所述流量控制状态同步至相应的处理节点。
结合第二方面,或者第二方面第一种可行的实施方式,或者第二方面第二种可行的实施方式,或者第二方面第三种可行的实施方式,在第 二方面第六种可行的实施方式中,为实现根据采样结果判断自身所在处理节点的实际消息接收量是否满足在其预设流量阈值区间内,所述触发器被配置为:
计算预设采样周期内采集到的不在其预设流量阈值范围内的采样值个数与所述预设采样周期内的采样值总个数之间的比值,并在所述比值大于预设阈值时,判定自身所在处理节点的实际消息接收量不在其预设流量阈值区间内。
本申请第三方面提供一种数据处理系统,该系统包括数据源、多个处理节点,以及上述任一种消息流量控制装置。
由以上技术方案可知,本申请实施例通过对每个处理节点的消息接收量进行采样,一旦某个处理节点的实际消息接收量不在其对应的预设流量阈值区间内,则生成相应的流量控制请求,并根据该流量控制请求调整该处理节点对应的上游数据节点的消息发送速率,从而可以实现对任意两个相邻上下游数据节点之间的消息流量的动态控制,相对于现有技术只根据最后一个处理节点的未处理消息数量来调整数据源的消息发送速率的方式,本申请控制精度更高,任意一个处理节点都不会出现消息积压或空闲的现象,从而可以减少消息丢弃量,提高整个数据处理系统的稳定性及处理效率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为现有数据处理系统的一种拓扑结构图;
图2为本申请实施例提供的一种消息流量控制方法的流程图;
图3为本申请实施例提供的一种数据处理系统的拓扑结构图;
图4为本申请实施例提供的基于图3所示拓扑结构的消息流量控制 方法的信号流图;
图5为本申请实施例提供的消息流量控制装置的工作原理示意图;
图6为本申请实施例提供的另一种数据处理系统的拓扑结构图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。
首先对本申请提供的消息流量控制方法的实施例进行说明。该方法可以应用于任一包括数据源和多个处理节点的流水线式数据处理系统,例如Storm、Jstorm、Spark streaming等实时计算系统,以调节流水线中各个节点之间的消息流量,实现数据源及任一处理节点的消息发送速率与相应下游处理节点的消息处理速率相匹配。
图2为本申请一个实施例提供的消息流量控制方法的流程图;参照图2,该方法包括如下步骤。
S11、分别对每个处理节点的消息接收量进行采样,并根据采样结果判断相应处理节点的实际消息接收量是否在其预设流量阈值区间内。
由于数据处理流水线中各个处理节点的处理能力及需要处理的消息数量(即该处理节点的负载)不尽相同,本实施例预先针对每个处理节点分别设置对应的预设流量阈值区间;以图1所示拓扑图为例,需要采样的节点包括所有的三个处理节点,根据节点的处理能力及其负载,设置处理节点A对应的预设流量阈值区间为[A1,B1],处理节点B对应的预设流量阈值区间为[A2,B2],处理节点C对应的预设流量阈值区间为[A3,B3]。
在系统运行过程中,分别采样每个处理节点的消息接收量,即相应处理节点的负载,并分别根据各个处理节点的采样结果判断该处理节点 的实际消息接收量是否在其预设流量阈值区间内。仍以图1为例,根据处理节点A的采样结果判断处理节点A的实际消息接收量是否在处理节点A的对应的区间[A1,B1]内,相应的,根据处理节点B的采样结果判断处理节点B的实际消息接收量是否在区间[A2,B2]内,依此类推。也即,通过步骤S11检测每个处理节点的负载和其处理能力是否相匹配。
S12、在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求。
S13、根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率。
本实施例在检测到任一处理节点的实际消息接收量不在其对应的预设流量阈值区间内,也即该处理节点的负载与其处理能力不匹配时,生成相应的流量控制请求,并根据该流量控制请求调整该处理节点对应的上游数据节点的消息发送速率。
其中,根据各个处理节点在流水线中所处的位置不同,所述上游数据节点可能为数据源,也可能为处理节点。以图1为例,对于数据源和处理节点A两个节点,处理节点A相当于上述第一处理节点,数据源S相当于上述上游数据节点;而对于处理节点A和处理节点B两个节点,处理节点B相当于上述第一处理节点,处理节点A相当于上述上游数据节点。
由以上技术方案可知,本申请实施例通过对每个处理节点的消息接收量进行采样,一旦某个处理节点的实际消息接收量不在其对应的预设流量阈值区间内,则生成相应的流量控制请求,并根据该流量控制请求调整该处理节点对应的上游数据节点的消息发送速率,从而可以实现对任意两个相邻上下游数据节点之间的消息流量的动态控制,相对于现有技术只根据最后一个处理节点的未处理消息数量来调整数据源的消息发送速率的方式,本申请控制精度更高,任意一个处理节点都不会出现消息积压或空闲的现象,减少消息丢弃量,提高整个数据处理系统的稳 定性及处理效率。
在本申请一个可行的实施例中,可以在数据处理系统的各个处理节点分别设置触发器,通过该触发器执行上述步骤S11和S12,同时,在数据源及各个处理节点中设置控制器,通过该控制器执行上述步骤S13。仍以图1为例,在本申请实施例中,在数据源S中设置控制器C_S,在处理节点A中设置触发器T_A和控制器C_A,在处理节点B中设置触发器T_B,在处理节点C中设置触发器T_C,如图3所示。图3中实线箭头表示各个节点之间的消息传输方向,虚线箭头表示各个节点之间的流量控制请求传输方向。需要说明的是,在图3所示系统中,由于处理节点B和C的下游无其他处理节点,不需要发送消息,故处理节点B和C中可以不设置相应的控制器,在其他实施例中,如果处理节点B和C的下游还存在其他处理节点,则可以在处理节点B和C中增设相应的控制器。基于图3所示系统,各节点间消息流量控制过程如图4所示。
参照图3和4,对于数据源和处理节点A两个节点,处理节点A相当于上述第一处理节点,数据源S相当于上述上游数据节点,则:
在步骤S111中,触发器T_A对处理节点A的消息接收量进行采样,并根据采样结果判断其实际消息接收量是否在对应的预设流量阈值区间[A1,B1]内;
在步骤S121中,触发器T_A在判定处理节点A的实际消息接收量不在[A1,B1]内(大于B1,或者小于A1)时,也即处理节点A的负载和处理能力不匹配,则生成流量控制请求,并将其发送至数据源S;
在步骤S131中,控制器C_S根据触发器T_A发送的流量控制请求调整数据源S的消息发送速率。通过上述步骤S111、S121和S131使得单位时间内发送至处理节点A的消息数量,也即单位时间内处理节点A的实际消息接收量,可以与处理节点A的消息处理数量相匹配,既可以避免数据源S的消息发送速率过大时,消息在处理节点A中积压,也可以避免数据源S的消息发送速率过小时,处理节点A空闲。
相应的,对于处理节点A和处理节点B两个节点,处理节点B相当于上述第一处理节点,处理节点A相当于上述上游数据节点,则:
在步骤S112中,触发器T_B对处理节点B的消息接收量进行采样,并根据采样结果判断其实际消息接收量是否在对应的预设流量阈值区间[A2,B2]内;
在步骤S122中,触发器T_B在判定处理节点B的实际消息接收量不在[A2,B2]内时,则生成流量控制请求,并将其发送至处理节点A;
在步骤S132中,控制器C_A根据触发器T_B发送的流量控制请求调整处理节点A向处理节点B发送消息时的消息发送速率。即,通过上述步骤S112、S122和S132使得单位时间内处理节点B的实际消息接收量与消息处理数量相匹配。
对于处理节点A和处理节点C两个节点,其消息流量控制过程与上述步骤S112、S122和S132类似,本文不再赘述。
在本申请一个可行的实施例中,上述步骤S11所述的根据采样结果判断相应处理节点的实际消息接收量是否满足在其预设流量阈值区间内,具体包括以下步骤:
对于任一处理节点,计算预设采样周期内采集到的不在其预设流量阈值区间内的采样值个数与所述预设采样周期内的采样值总个数之间的比值;如果所述比值大于预设阈值,则判定相应处理节点的实际消息接收量不在其预设流量阈值区间内。
相对于针对每个不在其预设流量阈值区间内的采样值生成一条流量控制请求,上述实施例在一个预设采样周期内超出预设流量阈值区间的采样值所占的比例大于预设阈值时,才生成流量控制请求,启动对上游数据节点的消息发送速率的调整,可以避免频繁调整导致系统抖动、处理能力下降等问题。
在本申请一个可行的实施例中,上述步骤S12所述的根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量不在预设流量阈值区间内时,生成相应的流量控制请求,具体可以包括以下两种情况:
在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量大于预设最高流量阈值时,生成流量降低请求;
在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量小于预设最低流量阈值时,生成流量升高请求。
即,在系统流量高峰时段内,某个处理节点的实际消息接收量大于预设最高流量阈值,则生成流量降低请求,以控制其上游数据节点降低消息发送速率;随着上游数据节点的消息发送速率的降低,该处理节点的实际消息接收量也降低,当其降低至预设最低流量阈值以下时,生成流量升高请求,以停止对上游数据节点的消息发送速率的降低控制,使其消息发送速率逐步升高,直到恢复至正常值。
在本申请一个可行的实施例中,上述流量控制请求中不仅包括用于指示上游数据节点升高或降低消息发送速率的信息,还包括生成该流量控制请求的处理节点的消息处理速率;相应的,当流量控制请求为上述流量降低请求时,上述步骤S13所述的调整上游数据节点的消息发送速率的方法为:
在所述流量控制请求为所述流量降低请求时,根据所述第一处理节点的消息处理速率和所述上游数据节点的原始消息发送速率确定消息发送延迟时间;
将所述消息发送延迟时间与所述原始消息发送速率进行叠加,得到所述上游数据节点的目标消息发送速率。
具体的,假设上述流量降低请求中包含第一处理节点的消息处理速率为TPS_DownStream,相应上游数据节点的原始消息发送速率为TPS_UpStream,由于流量控制请求为流量降低请求,可以推断 UpStream_TPS>TPS_DownStream,故需要在上游节点发送消息时延迟一段时间T_delay(即上述消息发送延迟时间),以降低UpStream_TPS;可以采用如下公式计算消息发送延迟时间T_delay:
T_delay=1/TPS_DownStream-1/UpStream_TPS。
将上述T_delay与UpStream_TPS叠加可以得到调整后的消息发送速率,也即上述目标消息发送速率UpStream_TPS’;叠加计算公式可以为:
UpStream_TPS’=1/[(1/UpStream_TPS)+T_delay]。
另外,在实际的应用中,由于网络或者其他中间环节对消息发送速率或者消息处理速率有一定的影响,导致上游数据节点在应用调整后的消息发送速率后,仍然收到下游处理节点的流量控制请求,故在本申请其他实施例中,还可以对在消息发送延迟时间进行微调,即在T_delay的基础上增加最小延迟单位T_min_adjust(可以为1毫秒)的微调,即:T_delay=1/TPS_DownStream-1/UpStream_TPS+T_min_adjust。
在本申请另一个可行的实施例中,当所述流量控制请求为所述流量升高请求时,上述步骤S13所述的调整上游数据节点的消息发送速率的方法为:根据预设速率调整步长逐步提高所述上游数据节点的消息发送速率至预设正常速率。
即在收到流量升高请求时,逐步提高上游数据节点的消息发送速率,而不是一次性恢复至预设正常速率;相对于上述基于消息发送延迟时间T_delay的调整方式,在收到流量升高请求时,逐步减小T_delay的取值直至0,UpStream_TPS’也随之逐步提高至UpStream_TPS。采用这种逐步提高消息发送速率的方式,可以避免消息积压,保证系统的稳定。
另外,在根据所述流量升高请求将上游数据节点的的消息发送速率恢复至预设正常速率时,可以向相应的下游处理节点反馈响应信息,以通知下游处理节点控制结束;相应的,下游处理节点在接收到该响应信 息后,不再发送请求,但仍然通过采样检测自身的实际消息接收量是否在预设流量阈值区间内。
在本申请一个可行的实施例中,步骤S12生成的流量控制请求可以直接由第一处理节点发送至相应的上游数据节点;在本申请另一个可行的实施例中,所述流量控制请求还可以通过一个独立节点对流量控制请求进行转发,该独立节点接收各个处理节点的流量控制请求,确定其对应的上游数据节点,并将该流量控制请求转发至该上游数据节点。可选的,基于上文实施例所述的在节点中设置触发器及控制器,本实施例所述的独立节点可以为设置于系统中的协调器。
实际应用中,某个上游数据节点可能存在多个下游处理节点,则通过上述独立节点接收并转发流量控制请求的过程中,在同一检测时段内,可能多个下游处理节点都检测到自身的实际消息接收量不在预设流量阈值区间内,从而都相应生成流量控制请求,如果分别依据每个下游处理节点的流量控制请求对该上游数据节点的消息发送速率进行调整,则需要调整多次,不仅工作量大,还可能因频繁调整导致系统不稳地。
有鉴于此,,在本申请一个可行的实施例中可以对发向同一上游数据节点的多条流量控制请求进行筛选,即,在根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率(步骤S13)之前,上述消息流量控制方法还可以包括如下步骤:
S14、如果在预设时段内所述上游数据节点对应的多个下游处理节点均生成相应的流量控制请求,则确定每个下游处理节点对应的流量控制请求对所述上游数据节点造成的消息发送速率变化量;
S15、确定消息发送速率变化量最大值对应的目标流量控制请求,以根据所述目标流量控制请求调整所述上游数据节点的消息发送速率。
参照图1或图3所示系统,处理节点A存在两个下游处理节点,即处理节点B和处理节点C,则可能出现在同一个检测时段内,处理节点 B和处理节点C都检测到自身的实际消息接收量不在预设流量阈值区间内,都生成流量控制请求;对于这两条流量控制请求,通过计算比较,选出对处理节点A造成的消息发送速率变化量最大的一条流量控制请求,并根据选出的流量控制请求来调整处理节点A的消息发送速率。
优选的,可以通过上文所述的消息发送延迟时间T_delay衡量流量控制请求对相应处理节点造成的消息发送速率变化量大小。
上述实施例在同一上游数据节点收到多条流量控制请求,根据各条流量控制请求对该上游数据节点的消息发送速率造成的变化量大小进行筛选出一条流量控制请求,用于调整上游数据节点的消息发送速率,从而可以减少调整次数,既可以减少流量控制的工作量,又可以避免短时间内频繁调整导致的系统抖动,提高系统的稳定性。
优选的,可以通过上文实施例所述的协调器执行上述步骤S14和S15,并将步骤S15确定的目标流量控制请求发送至相应上游数据节点的控制器,以避免筛选过程对上游数据节点的内存等资源的占用。
在本申请一个可行的实施例中,上述消息流量控制方法还可以包括如下步骤:
S16、将各个处理节点的流量控制状态存储至预设存储模块;
S17、根据预设周期将所述预设存储模块存储的所述流量控制状态同步至相应的处理节点。
以Storm、Jstorm等实时计算系统为例,上述预设存储模块可以为实时计算系统外部的协调服务器,如ZooKeeper。对应于上文所述的两种流量控制请求,即流量降低请求和流量升高请求,所述流量控制状态至少包括两种:对于任一处理节点,如果其接收到流量降低请求,则其对应的流量控制状态为降流控制状态(即该处理节点以低于默认值的消息发送速率向下游处理节点发送消息);如果其接收到流量升高请求或未接收到任何流量控制请求,则其对应的流量控制状态为无控制状态(即该处理节点以默认的消息发送速率向下游处理节点发送消息)。
以上技术方案中,通过对各个处理节点的流量控制状态的实时存储并定期同步,可以保证处理节点在失效重启后,仍然可以处于正确的流量控制状态下,进而保证系统的稳定性。
优选的,上述步骤S16和S17也可以通过上文所述的协调器执行。
与上述消息流量控制方法的实施例相对应,本申请实施例还提供了一种应用于流水线式数据处理系统的消息流量控制装置,且该流水线式数据处理系统包括数据源和多个处理节点;为便于描述,下文将所述数据源和各个处理节点统称为数据节点。所述消息流量控制装置包括:分别设置于所述每个处理节点中的触发器,和分别设置于每个具有下游处理节点的数据节点中的控制器。设置有上述消息流量控制装置的数据处理系统的拓扑结构可参照图3。
其中,所述触发器用于,对自身所在处理节点的消息接收量进行采样,并根据采样结果判断自身所在处理节点的实际消息接收量是否在其预设流量阈值区间内,并在自身所在处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求。
所述控制器用于,根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率。
具体的,如图5所示的设置有消息流量控制装置的数据处理系统中任意一个上游数据节点510和与其相邻的一个下游数据节点520结构框图;其中,一种具体情况下,该上游数据节点510和下游数据节点520都为处理节点,另一种具体情况下,该上游数据节点510为数据源,下游数据节点520为处理节点。图5中的虚线框及虚线箭头表示在一种情况下存在,另一种情况下不存在的结构及信息流向。
基于该上游数据节点510和下游数据节点520,上述消息流量控制装置的工作过程如下:下游数据节点520的触发器521对该下游数据节点520的消息接收量进行采样,并根据采样结果判断下游数据节点520 的实际消息接收量是否在下游数据节点520的预设流量阈值区间内,如果不在,则生成相应的流量控制请求,并将该流量控制请求发送至上游数据节点510的控制器512;控制器512在接收到触发器521发送的流量控制请求后,根据该流量控制请求调整上游数据节点510的消息发送速率,从而可以将下游数据节点520的实际消息接收量控制在下游数据节点520的预设流量阈值区间内。
由以上技术方案可知,本申请实施例通过对每个处理节点的消息接收量进行采样,一旦某个处理节点的实际消息接收量不在其对应的预设流量阈值区间内,则生成相应的流量控制请求,并根据该流量控制请求调整该处理节点对应的上游数据节点的消息发送速率,从而可以实现对任意两个相邻上下游数据节点之间的消息流量的动态控制,相对于现有技术只根据最后一个处理节点的未处理消息数量来调整数据源的消息发送速率的方式,本申请控制精度更高,任意一个处理节点都不会出现消息积压或空闲的现象,减少消息丢弃量,提高整个数据处理系统的稳定性及处理效率。
在本申请一个可行的实施例中,为实现根据采样结果判断自身所在处理节点的实际消息接收量是否满足在其预设流量阈值区间内,上述触发器可以被配置为:计算预设采样周期内采集到的不在其预设流量阈值范围内的采样值个数与所述预设采样周期内的采样值总个数之间的比值,并在所述比值大于预设阈值时,判定自身所在处理节点的实际消息接收量不在其预设流量阈值区间内。
基于以上技术方案,相对于针对每个不在其预设流量阈值区间内的采样值生成一条流量控制请求,上述实施例在一个预设采样周期内超出预设流量阈值区间的采样值所占的比例大于预设阈值时,才生成流量控制请求,启动对上游数据节点的消息发送速率的调整,可以避免频繁调整导致系统抖动、处理能力下降等问题。
在本申请一个可行的实施例中,为实现在自身所在处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求, 上述触发器可以被配置为:
在自身所在处理节点的实际消息接收量大于预设最高流量阈值时,生成流量降低请求;
在自身所在处理节点的实际消息接收量大于预设最低流量阈值时,生成流量升高请求。
在本申请一个可行的实施例中,为实现根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率,上述控制器可以被配置为:在所述流量控制请求为所述流量降低请求时,根据所述下游处理节点的消息处理速率,以及自身所在数据节点的原始消息发送速率确定消息发送延迟时间,并将所述消息发送延迟时间与所述原始消息发送速率进行叠加,得到自身所在数据节点的目标消息发送速率。
在本申请另一个可行的实施例中,为实现根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率,上述控制器可以被配置为:
在所述流量控制请求为所述流量升高请求时,根据预设速率调整步长逐步提高自身所在数据节点的消息发送速率至预设正常速率。
除上述触发器和控制器外,本申请提供的消息流量控制装置还可以包括协调器,该协调器与各个处理节点并列设置于所述数据处理系统中,该协调器用于获取各个触发器生成的流量控制请求,并将所述流量控制请求转发至相应的上游数据节点。
图6为在图3所示设置有消息流量控制装置的系统拓扑结构上增设协调器后的拓扑结构图。参照图6,协调器K分别获取触发器T_A、触发器T_B和触发器T_C的流量控制请求,并将触发器T_A的流量控制请求转发至数据源S的控制器C_S,将触发器T_B和触发器T_C的流量控制请求分别转发至处理节点A的控制器C_A。
在本申请一个可行的实施例中,上述协调器具体可以被配置为:在预设时段内获取到多条向同一上游数据节点的控制器发送的流量控制请求,则所述第一协调器确定每条流量控制请求对所述同一上游数据节点造成的消息发送速率变化量,并将消息发送速率变化量最大值对应的流量控制请求发送至所述同一上游数据节点的控制器。
仍参照上图6,在预设时段内协调器K既获取到触发器T_B的流量控制请求Q_B,又获取到触发器T_C的流量控制请求Q_C,为减少对其共同的上游处理节点A的消息发送速率调整次数,保证系统的稳定,协调器K分别确定流量控制请求Q_B和Q_C对处理节点A造成的消息发送速率变化量,并选出消息发送速率变化量较大的流量控制请求,假设为流量控制请求Q_B,则协调器K只将流量控制请求Q_B转发至控制器C_A,将流量控制请求Q_C丢弃;相应的,控制器C_A只需根据流量控制请求Q_B调整处理节点A的消息发送速率。
在本申请另一个可行的实施例中,上述协调器还被配置为:将各个处理节点的流量控制状态存储至预设存储模块,并根据预设周期将所述预设存储模块存储的所述流量控制状态同步至相应的处理节点;从而可以保证处理节点在失效重启后,仍然可以处于正确的流量控制状态下,进而保证系统的稳定性。
另外,本申请实施例还提供了一种数据处理系统,该系统包括包括数据源、多个处理节点,以及上文任一实施例所述的消息流量控制装置。该系统的结构图可以参照图3和图6所示,其流量控制过程可参照上文方法及装置实施例,本文不再赘述。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置和系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述的本发明实施方式,并不构成对本发明保护范围的限定。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (15)

  1. 一种消息流量控制方法,其特征在于,应用于数据处理系统,所述数据处理系统包括数据源和多个处理节点;所述方法包括:
    分别对每个处理节点的消息接收量进行采样,并根据采样结果判断相应处理节点的实际消息接收量是否在其预设流量阈值区间内;
    在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求;
    根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率;其中,所述上游数据节点可以为所述数据源或者处理节点。
  2. 根据权利要求1所述的方法,其特征在于,在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量不在预设流量阈值区间内时,生成相应的流量控制请求,包括:
    在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量大于预设最高流量阈值时,生成流量降低请求;
    在根据第一处理节点对应的采样结果判定所述第一处理节点的实际消息接收量小于预设最低流量阈值时,生成流量升高请求。
  3. 根据权利要求2所述的方法,其特征在于,根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率,包括:
    在所述流量控制请求为所述流量降低请求时,根据所述第一处理节点的消息处理速率和所述上游数据节点的原始消息发送速率确定消息发送延迟时间;
    将所述消息发送延迟时间与所述原始消息发送速率进行叠加,得到 所述上游数据节点的目标消息发送速率。
  4. 根据权利要求2所述的方法,其特征在于,根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率,包括:
    在所述流量控制请求为所述流量升高请求时,根据预设速率调整步长逐步提高所述上游数据节点的消息发送速率至预设正常速率。
  5. 根据权利要求1至4任一项所述的方法,其特征在于,在根据所述流量控制请求调整与所述第一处理节点相邻的上游数据节点的消息发送速率之前,所述方法还包括:
    如果在预设时段内所述上游数据节点对应的多个下游处理节点均生成相应的流量控制请求,则确定每个下游处理节点对应的流量控制请求对所述上游数据节点造成的消息发送速率变化量;
    确定消息发送速率变化量最大值对应的目标流量控制请求,以根据所述目标流量控制请求调整所述上游数据节点的消息发送速率。
  6. 根据权利要求1至4任一项所述的方法,其特征在于,还包括:
    将各个处理节点的流量控制状态存储至预设存储模块;
    根据预设周期将所述预设存储模块存储的所述流量控制状态同步至相应的处理节点。
  7. 根据权利要求1至4任一项所述的方法,其特征在于,根据采样结果判断相应处理节点的实际消息接收量是否满足在其预设流量阈值区间内,包括:
    对于任一处理节点,计算预设采样周期内采集到的不在其预设流量 阈值区间内的采样值个数与所述预设采样周期内的采样值总个数之间的比值;
    如果所述比值大于预设阈值,则判定相应处理节点的实际消息接收量不在其预设流量阈值区间内。
  8. 一种消息流量控制装置,其特征在于,应用于数据处理系统,所述数据处理系统包括数据源和多个处理节点;所述装置包括:触发器和控制器;
    所述触发器设置于每个处理节点中,用于对自身所在处理节点的消息接收量进行采样,并根据采样结果判断自身所在处理节点的实际消息接收量是否在其预设流量阈值区间内,并在自身所在处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求;
    所述控制器设置于每个具有下游处理节点的数据节点中,用于根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率;其中,所述数据节点可以为所述数据源或者处理节点。
  9. 根据权利要求8所述的装置,其特征在于,为实现在自身所在处理节点的实际消息接收量不在其预设流量阈值区间内时,生成相应的流量控制请求,所述触发器被配置为:
    在自身所在处理节点的实际消息接收量大于预设最高流量阈值时,生成流量降低请求;
    在自身所在处理节点的实际消息接收量大于预设最低流量阈值时,生成流量升高请求。
  10. 根据权利要求9所述的装置,其特征在于,为实现根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节 点的消息发送速率,所述控制器被配置为:
    在所述流量控制请求为所述流量降低请求时,根据所述下游处理节点的消息处理速率,以及自身所在数据节点的原始消息发送速率确定消息发送延迟时间,并将所述消息发送延迟时间与所述原始消息发送速率进行叠加,得到自身所在数据节点的目标消息发送速率。
  11. 根据权利要求9所述的系统,其特征在于,为实现根据自身所在数据节点对应的下游处理节点的流量控制请求,调整自身所在数据节点的消息发送速率,所述控制器被配置为:
    在所述流量控制请求为所述流量升高请求时,根据预设速率调整步长逐步提高自身所在数据节点的消息发送速率至预设正常速率。
  12. 根据权利要求8至11任一项所述的系统,其特征在于,还包括:第一协调器;
    所述第一协调器与各个处理节点并列设置于所述数据处理系统中,用于获取所述触发器发送的流量控制请求,并将所述流量控制请求转发至相应上游数据节点的控制器;
    其中,如果所述第一协调器在预设时段内获取到多条向同一上游数据节点的控制器发送的流量控制请求,则所述第一协调器确定每条流量控制请求对所述同一上游数据节点造成的消息发送速率变化量,并将消息发送速率变化量最大值对应的流量控制请求发送至所述同一上游数据节点的控制器。
  13. 根据权利要求8至11任一项所述的系统,其特征在于,还包括:第二协调器;
    所述第二协调器与各个处理节点并列设置于所述数据处理系统中,用于将各个处理节点的流量控制状态存储至预设存储模块,并根据预设 周期将所述预设存储模块存储的所述流量控制状态同步至相应的处理节点。
  14. 根据权利要求8至11任一项所述的系统,其特征在于,为实现根据采样结果判断自身所在处理节点的实际消息接收量是否满足在其预设流量阈值区间内,所述触发器被配置为:
    计算预设采样周期内采集到的不在其预设流量阈值范围内的采样值个数与所述预设采样周期内的采样值总个数之间的比值,并在所述比值大于预设阈值时,判定自身所在处理节点的实际消息接收量不在其预设流量阈值区间内。
  15. 一种数据处理系统,包括数据源和多个处理节点,其特征在于,所述系统还包括权利要求8至14任一项所述的消息流量控制装置。
PCT/CN2016/110051 2015-12-28 2016-12-15 消息流量控制方法、装置及相关系统 WO2017114165A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510999121.6 2015-12-28
CN201510999121.6A CN106921587B (zh) 2015-12-28 2015-12-28 消息流量控制方法、装置及相关系统

Publications (1)

Publication Number Publication Date
WO2017114165A1 true WO2017114165A1 (zh) 2017-07-06

Family

ID=59224508

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/110051 WO2017114165A1 (zh) 2015-12-28 2016-12-15 消息流量控制方法、装置及相关系统

Country Status (2)

Country Link
CN (1) CN106921587B (zh)
WO (1) WO2017114165A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109428901A (zh) * 2017-08-22 2019-03-05 中国电信股份有限公司 消息处理方法以及消息处理装置
CN111245732A (zh) * 2018-11-29 2020-06-05 阿里巴巴集团控股有限公司 一种流量控制方法、装置及设备
CN111343100A (zh) * 2020-03-07 2020-06-26 深圳市中天网景科技有限公司 一种基于物联网卡月流量套餐的限速方法、系统及设备
CN111355664A (zh) * 2020-02-19 2020-06-30 中国农业银行股份有限公司 一种流量控制方法及装置
CN111385214A (zh) * 2018-12-27 2020-07-07 阿里巴巴集团控股有限公司 一种流量控制方法、装置及设备
CN111988348A (zh) * 2019-05-22 2020-11-24 深圳顺丰泰森控股(集团)有限公司 数据采集方法及车联网控制系统
CN114448901A (zh) * 2020-10-19 2022-05-06 北京金山云网络技术有限公司 流量削峰方法、装置、服务器、介质和电子设备
CN115664951A (zh) * 2022-12-08 2023-01-31 中冶南方(武汉)自动化有限公司 一种自适应工业数据采集方法、系统及存储介质

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108900477B (zh) * 2018-06-08 2020-10-30 北京安控科技股份有限公司 一种基于网关抑制外部网络干扰的方法
CN110858844A (zh) * 2018-08-22 2020-03-03 阿里巴巴集团控股有限公司 服务请求处理方法、控制方法、装置、系统及电子设备
CN110213137A (zh) * 2019-06-28 2019-09-06 北京威努特技术有限公司 一种网络设备的传输限速检测方法、装置及电子设备
CN110377508A (zh) * 2019-06-28 2019-10-25 北京威努特技术有限公司 一种提高数据传输端口的扫描速度方法、装置及电子设备
CN110572299B (zh) * 2019-08-30 2021-10-22 北京奇艺世纪科技有限公司 设备测试方法、系统、装置、网络节点、终端及存储介质
CN114553792B (zh) * 2020-11-25 2024-07-05 华为技术有限公司 调度参数的调整方法、装置、设备及计算机可读存储介质
CN113364648B (zh) * 2021-06-04 2024-02-13 百果园技术(新加坡)有限公司 流量控制方法、系统、装置、服务设备及存储介质
CN114928572A (zh) * 2022-02-28 2022-08-19 中国农业银行股份有限公司 一种分布式系统的流量控制方法、装置、介质及设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1547360A (zh) * 2003-12-10 2004-11-17 北京邮电大学 在弹性分组环上保证各个站点公平分享带宽的方法
CN101340358A (zh) * 2007-07-04 2009-01-07 鼎桥通信技术有限公司 一种流量控制方法、系统及流量控制实体
CN102422607A (zh) * 2009-05-12 2012-04-18 阿尔卡特朗讯 高速分组交换系统中的与流量负荷有关的功率减少
CN103944833A (zh) * 2013-01-21 2014-07-23 中兴通讯股份有限公司 流量控制的方法、装置及流量整形系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1547360A (zh) * 2003-12-10 2004-11-17 北京邮电大学 在弹性分组环上保证各个站点公平分享带宽的方法
CN101340358A (zh) * 2007-07-04 2009-01-07 鼎桥通信技术有限公司 一种流量控制方法、系统及流量控制实体
CN102422607A (zh) * 2009-05-12 2012-04-18 阿尔卡特朗讯 高速分组交换系统中的与流量负荷有关的功率减少
CN103944833A (zh) * 2013-01-21 2014-07-23 中兴通讯股份有限公司 流量控制的方法、装置及流量整形系统

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109428901A (zh) * 2017-08-22 2019-03-05 中国电信股份有限公司 消息处理方法以及消息处理装置
CN109428901B (zh) * 2017-08-22 2021-07-30 中国电信股份有限公司 消息处理方法以及消息处理装置
CN111245732A (zh) * 2018-11-29 2020-06-05 阿里巴巴集团控股有限公司 一种流量控制方法、装置及设备
CN111245732B (zh) * 2018-11-29 2024-04-19 阿里巴巴集团控股有限公司 一种流量控制方法、装置及设备
CN111385214A (zh) * 2018-12-27 2020-07-07 阿里巴巴集团控股有限公司 一种流量控制方法、装置及设备
CN111385214B (zh) * 2018-12-27 2023-11-17 阿里巴巴集团控股有限公司 一种流量控制方法、装置及设备
CN111988348A (zh) * 2019-05-22 2020-11-24 深圳顺丰泰森控股(集团)有限公司 数据采集方法及车联网控制系统
CN111988348B (zh) * 2019-05-22 2023-06-20 深圳顺丰泰森控股(集团)有限公司 数据采集方法及车联网控制系统
CN111355664A (zh) * 2020-02-19 2020-06-30 中国农业银行股份有限公司 一种流量控制方法及装置
CN111343100A (zh) * 2020-03-07 2020-06-26 深圳市中天网景科技有限公司 一种基于物联网卡月流量套餐的限速方法、系统及设备
CN114448901A (zh) * 2020-10-19 2022-05-06 北京金山云网络技术有限公司 流量削峰方法、装置、服务器、介质和电子设备
CN115664951A (zh) * 2022-12-08 2023-01-31 中冶南方(武汉)自动化有限公司 一种自适应工业数据采集方法、系统及存储介质

Also Published As

Publication number Publication date
CN106921587A (zh) 2017-07-04
CN106921587B (zh) 2020-07-10

Similar Documents

Publication Publication Date Title
WO2017114165A1 (zh) 消息流量控制方法、装置及相关系统
KR101881409B1 (ko) 소프트웨어 정의 네트워크에서 멀티-마스터 선택
WO2021012869A1 (zh) 传输速率的确定方法、装置、设备和存储介质
CN106301684B (zh) 一种媒体数据传输方法及装置
JP5010739B2 (ja) 集約帯域幅制御のための方法及びシステム
WO2015096149A1 (zh) Tcp链路配置方法、装置及设备
WO2014194616A1 (en) Systems and methods for data transmission
WO2022121469A1 (zh) 一种流量控制方法、装置、设备及可读存储介质
EP3560207A1 (en) Managing congestion response during content delivery
WO2016101825A1 (zh) 一种分布式保护中控制器热备份的方法和装置
WO2016182772A1 (en) Uplink performance management
TWI777938B (zh) 訊息流量控制方法、裝置及相關系統
JP2007180891A (ja) 通信装置及びそれに用いるパケット送信制御方法並びにそのプログラム
WO2016049809A1 (zh) 一种流量控制方法及系统
US8095228B2 (en) Data distribution apparatus, its control method, program, and storage medium
US20130311668A1 (en) Methods And Systems For Providing Fairness And Stability To Video Streams
US11258716B1 (en) System and method for optimizing dynamic multi-stream network connections
CN110784417A (zh) 拥塞控制方法、设备及系统
CN109787861B (zh) 网络数据延迟控制方法
JP6885463B2 (ja) 送信装置、可用帯域推定装置、可用帯域推定システム、方法
CN114095126A (zh) 一种数据发送速率调整方法、系统及装置
CN113810383B (zh) Web应用防火墙及拥塞控制方法、介质及电子设备
JP6348377B2 (ja) コンテンツ配信ネットワークの通信装置及びプログラム
JP2015216498A (ja) コンテンツ配信ネットワークの通信装置、クライアント装置及びプログラム
RU2543565C1 (ru) Способ формирования канала передачи данных

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16880955

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16880955

Country of ref document: EP

Kind code of ref document: A1