gpt4 book ai didi

azure - 流分析: How can I start and stop a TUMBLINGWINDOW aggregation job inorder to reduce costs while still getting the same aggregation results?

转载 作者:行者123 更新时间:2023-12-03 02:15:40 28 4
gpt4 key购买 nike

上下文

我使用 Azure 门户创建了一个流作业,该门户使用每日 TUMBLINGWINDOW 聚合数据。下面附上了一个代码片段,修改自 docs ,这显示了类似的逻辑。

SELECT
DATEADD(day, -1, System.Timestamp()) AS WindowStart
System.Timestamp() AS WindowEnd,
TollId,
COUNT(*)
FROM Input TIMESTAMP BY EntryTime
GROUP BY TumblingWindow(day, 1), TollId

既然作业已经运行并且可以看到它产生输出,我希望能够通过设置某种时间安排来理想地降低成本,以便作业可以运行并仍然产生相同的输出,而无需在所有时间。

唯一真正的限制是每个 TUMBLINGWINDOW 末尾的聚合输出必须保持相同,就好像它一直在运行一样(停止启动对输出没有影响)。

这让我想到了我的问题。

Update: 2021-02-28

Before going into the question another thing that drove me was that through Azure portal you can manually start and stop a job. When you start/restart a job you can set a custom start time for the job/query. With this level of control say I start a job (or have a job running) and then decide to stop it for majority of the day and then turn it on at say 11:30pm each day with a custom start time of midnight of the current day then it would be able to be on for approx 30min before it would output the results (yet still to my understanding produce the same aggregation results/effect compared to if it was on the whole day up until that point). This job could then be paused again at 00:30am ( the next day for which it stays paused for the majority of the day (1380min total until 11:30pm again) upon which the same above logic is applied.This way it remains off the majority of the day yet still can produce the same output for each day wise window (correct me if I am wrong in my thinking). The only issue with this to me seems to be the fact someone would have to manually perform this. Thus I was driven to the docs looking for a way to automate this.

问题

如何以自动方式启动和停止作业,以便所需的输出仍然保持不变,但作业不必一直保持开启状态(就像目前一样)?

鉴于上述上下文,上面链接的文档是否足够,如果足够,N 分钟(开启)和 M 分钟(关闭)时间变量的一些可能安排是什么?

考虑到我想要在一天的 TUMBLINGWINDOW 窗口上聚合的情况(我希望每个窗口按照其默认行为在每天的午夜开始和结束),这是否可能?

例如

窗口开始:2022-02-20 00:00:00 窗口结束:2022-02-21 00:00:00(执行聚合),

窗口开始:2022-02-21 00:00:00 窗口结束:2022-02-22 00:00:00(执行聚合),

窗口开始:2022-02-22 00:00:00 窗口结束:2022-02-23 00:00:00(执行聚合),

...等等

想法

我从 Microsoft 找到了有关 auto-pausing jobs using a few methods 的文档

然而,我遇到了一段(下面引用的),这让我怀疑它在我的特定用例中是否合理(如我的问题部分所述,TUMBLING 1 天窗口)。

Note

There are downsides to auto-pausing a job. The main ones being the loss of the low latency /real time capabilities, and the potential risks from allowing the input event backlog to grow unsupervised while a job is paused. Auto-pausing should not be considered for most production scenarios running at scale.

这个方法可以吗

最佳答案

有 3 种降低成本的方法:

  • 缩小你的作业规模,你的延迟会更高,但成本更低,直到你的作业崩溃,因为它随着时间的推移耗尽内存和/或无法 catch 其积压的工作。在这里,您需要密切关注您的指标,以确保您可以在为时已晚之前使用react
  • 更进一步,您可以将多个查询重新组合到一个作业中。此作业很可能不会在分区中对齐,因此它无法线性扩展(添加 SU 并不能保证为您提供更好的性能)。与上面的评论相同,而且您需要记住,当您需要扩展时,您可能必须将该作业分解为多个作业,以便再次能够以线性方式扩展
  • 最后,您可以自动暂停作业,这是实现该功能的一种方法,在doc中进行了解释。你链接了。我写了那个文档,我的意思是,如果作业不能运行足够长的时间来处理积压的事件,那么您将再次面临作业重载的风险。对于大多数生产场景来说,这是一个有风险的提议

但是,如果您知道自己在做什么,并且正在密切监视适当的指标(如文档中所述),那么这绝对是您应该探索的内容。

最后,所有这些方法,包括自动暂停方法,都将为您透明地处理翻滚的窗口。

更新:2022-03-03 此处有以下评论

更新:2022-03-04 以下评论 there

这里有 3 个时间维度:

  • 作业何时运行:挂钟
  • 预计时间窗口输出结果时:Tumbling(day,1) -> 每天 00:00AM,这是绝对的(当天、每小时、每分钟)。 ..)并且与下面的作业开始时间无关
  • 您希望通过 job start time 从作业中产生什么输出

假设您的作业连续几个月 24/7 运行,并决定在 3 月 1 日中午 (12:00PM) 停止它。

它已生成 2 月最后一天(3 月 1 日上午 00:00)的输出。

直到第二天,即 3 月 2 日上午 00:00,您才会看到输出差异,此时您预计会看到 3 月 1 日的每日窗口,但由于作业已停止,因此不会输出。

让我们在挂钟时间 3 月 2 日凌晨 01:00 开始工作。如果您想要缺少时间窗口,您应该选择“最后一次停止时”(前一天中午)的开始时间,或者 3 月 1 日下午 23:59 之前的任意时间选择自定义时间。你驾驶的是你想要的输出窗口。在这里,您告诉 ASA 您想要从该点开始的所有窗口。

ASA 将 reload all the data it needs生成该窗口(确保事件中心有足够的保留时间,我们不会在作业重新启动之间缓存数据):Azure 流分析将自动查看输入源中的数据。例如,如果“立即”开始一项作业,并且查询使用 5 分钟的滚动窗口,Azure 流分析将在输入中查找 5 分钟前的数据。第一个可能的输出事件的时间戳等于或大于当前时间,并且 ASA 保证所有逻辑上可能对输出有贡献的输入事件都已被考虑在内。。

关于azure - 流分析: How can I start and stop a TUMBLINGWINDOW aggregation job inorder to reduce costs while still getting the same aggregation results?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71266175/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com