监视并缩减限制,以减少 Azure 时序见解中的延迟Monitor and mitigate throttling to reduce latency in Azure Time Series Insights

传入数据量超过环境配置时,Azure 时序见解中可能会出现延迟或限制。When the amount of incoming data exceeds your environment's configuration, you may experience latency or throttling in Azure Time Series Insights.

可以根据要分析的数据量,适当地配置环境,从而避免延迟和限制。You can avoid latency and throttling by properly configuring your environment for the amount of data you want to analyze.

以下情况最有可能出现延迟和限制:You are most likely to experience latency and throttling when you:

  • 添加包含超出所分配入口速率(时序见解需要追赶)的旧数据的事件源。Add an event source that contains old data that may exceed your allotted ingress rate (Time Series Insights will need to catch up).
  • 将较多事件源添加到一个环境中,导致其他事件出现激增(可能超过环境容量)。Add more event sources to an environment, resulting in a spike from additional events (which could exceed your environment’s capacity).
  • 将大量历史事件推送到一个事件源,导致延迟(时序见解需要追赶)。Push large amounts of historical events to an event source, resulting in a lag (Time Series Insights will need to catch up).
  • 将引用数据和遥测结合,导致事件大小较大。Join reference data with telemetry, resulting in larger event size. 允许的最大数据包大小为 32 KB;大于 32 KB 的数据包会被截断。The maximum allowed packet size is 32 KB; data packets larger than 32 KB are truncated.

使用警报监视延迟和限制Monitor latency and throttling with alerts

警报有助于诊断并缓解环境中出现的延迟问题。Alerts can help you to diagnose and mitigate latency issues occurring in your environment.

  1. 在 Azure 门户中,选择时序见解环境。In the Azure portal, select your Time Series Insights environment. 然后选择“警报” 。Then select Alerts.

    向时序见解环境添加警报Add an alert to your Time Series Insights environment

  2. 选择“+ 新建警报规则”。 Select + New alert rule. 然后将显示“创建规则” 面板。The Create rule panel will then be displayed. 在“条件” 下选择“添加” 。Select Add under CONDITION.

    添加警报窗格Add alert pane

  3. 接下来,配置信号逻辑的确切条件。Next, configure the exact conditions for the signal logic.

    配置信号逻辑Configure signal logic

    在此处,可以使用以下一些条件配置警报:From there, you can configure alerts using some of the following conditions:

    指标Metric 说明Description
    入口收到的字节数 Ingress Received Bytes 从事件源读取的原始字节数。Count of raw bytes read from event sources. 原始计数通常包括属性名称和值。Raw count usually includes the property name and value.
    入口收到的无效消息数 Ingress Received Invalid Messages 从所有 Azure 事件中心或 Azure IoT 中心事件源读取的无效消息的计数。Count of invalid messages read from all Azure Event Hubs or Azure IoT Hub event sources.
    入口收到的消息数 Ingress Received Messages 从所有事件中心或 IoT 中心事件源读取的消息的计数。Count of messages read from all Event Hubs or IoT Hubs event sources.
    入口存储的字节数 Ingress Stored Bytes 已存储且可用于查询的事件的总大小。Total size of events stored and available for query. 仅根据属性值计算大小。Size is computed only on the property value.
    入口存储的事件数    Ingress Stored Events       已存储并可供查询的平展事件计数。Count of flattened events stored and available for query.    
    入口收到消息时间延迟    Ingress Received Message Time Lag      消息在事件源中排队的时间与消息在入口中处理之间的时间差(以秒为单位)。Difference in seconds between the time that the message is enqueued in the event source and the time it is processed in Ingress.    
    入口收到消息计数延迟    Ingress Received Message Count Lag      上次排队的消息在事件源分区中的序列号与在入口中进行处理的消息的序列号之间的差异。Difference between the sequence number of last enqueued message in the event source partition and sequence number of message being processed in Ingress.    

    选择“完成” 。Select Done.

  4. 配置所需的信号逻辑后,直观地查看所选的警报规则。After configuring the desired signal logic, review the chosen alert rule visually.

    延迟视图和图表Latency view and charting

限制和入口管理Throttling and ingress management

  • 如果你受到限制,则会注册“入口收到消息时间延迟” 的值,以通知你消息到达事件源的实际时间比时序见解环境晚多少秒(不包括索引时间,该时间大约为If you're being throttled, a value for the Ingress Received Message Time Lag will be registered informing you about how many seconds behind your TIme Series Insights environment are from the actual time the message hits the event source (excluding indexing time of appx. 30-60 秒)。30-60 seconds).

    入口收到消息计数延迟也应该有一个值,用于确定你在消息数方面落后多少。Ingress Received Message Count Lag should also have a value, allowing you to determine how many messages behind you are. 若要赶上来,最容易的方式是增加环境的容量,使之达到能够克服此差异的规模。The easiest way to get caught up is to increase your environment's capacity to a size that will enable you to overcome the difference.

    例如,如果 S1 环境显示有 5,000,000 条消息的延迟,那么你可以将环境的大小增加到 6 个单元,以便在大约一天的时间内赶上进度。For example, if your S1 environment is demonstrating lag of 5,000,000 messages, you might increase the size of your environment to six units for around a day to get caught up. 甚至可以增加更多,这样追赶速度会更快。You could increase even further to catch up faster. 在一开始预配某个环境时,尤其是在将其连接到某个事件源,而该事件源中已经有事件时,或者在批量上传大量历史数据时,追赶期是常见的现象。The catch-up period is a common occurrence when initially provisioning an environment, particularly when you connect it to an event source that already has events in it or when you bulk upload lots of historical data.

  • 另一种方法是将“入口已存储事件”警报设置为在 2 小时的时间内 >= 略低于总环境容量的阈值 。Another technique is to set an Ingress Stored Events alert >= a threshold slightly below your total environment capacity for a period of 2 hours. 此警报有助于了解是否持续达到容量要求,指示很可能存在延迟。This alert can help you understand if you are constantly at capacity, which indicates a high likelihood of latency.

    例如,如果预配了三个 S1 单位(或每分钟入口容量为 2100 个事件),则可以将“入口存储的事件数”警报设置为 2 小时 >= 1900 个事件 。For example, if you have three S1 units provisioned (or 2100 events per minute ingress capacity), you can set an Ingress Stored Events alert for >= 1900 events for 2 hours. 如果因不断超过该阈值而触发警报,很可能是由于预配不足。If you are constantly exceeding this threshold, and therefore, triggering your alert, you are likely under-provisioned.

  • 如果怀疑受到限制,可以将“入口收到的消息数”和事件源的出口消息数相比较 。If you suspect you are being throttled, you can compare your Ingress Received Messages with your event source’s egressed messages. 如果传入事件中心的消息数大于“入口收到的消息数”,时序见解很可能受到了限制 。If ingress into your Event Hub is greater than your Ingress Received Messages, your Time Series Insights are likely being throttled.

改善性能Improving performance

要减少限制和延迟,最佳的更正方法是增加环境容量。To reduce throttling or experiencing latency, the best way to correct it is to increase your environment's capacity.

可以根据要分析的数据量,适当地配置环境,从而避免延迟和限制。You can avoid latency and throttling by properly configuring your environment for the amount of data you want to analyze. 有关如何为环境添加容量的更多信息,请阅读缩放环境For more information about how to add capacity to your environment, read Scale your environment.

后续步骤Next steps