监控仓库负载

Web 界面提供 查询负载 图表,描述仓库在两周内处理的并发查询。仓库查询负载用于测量在特定时间间隔内运行或排队的查询的平均数量。

You can customize the time period and time interval during which to evaluate warehouse performance by querying the Account Usage QUERY_HISTORY view.

查看负载监控图表

Note

要查看负载监控图表,您必须使用对仓库具有 MONITOR 权限的角色。

要查看图表,请执行以下步骤:

In the navigation menu, select Compute » Warehouses » <warehouse_name>

The Warehouse Activity tile appears with a bar chart and lets you select a window of time to view in the chart. By default, the chart displays the past two weeks in 1-day intervals.

您可以选择的范围介于 1 小时(下限)到 2 周(上限)之间。图表以 1 分钟到 1 天的间隔显示总查询负载,具体取决于您选择的范围。

了解条形图

将鼠标悬停在条形上,可查看所表示的时间段内仓库处理的平均查询数。条形显示间隔内发生的每个查询状态的单独负载:

查询状态描述
Running在间隔内正在积极运行的查询。请注意,这些查询可能在间隔之前就开始运行,并在间隔之后继续运行。
Queued (Provisioning)当仓库预置计算资源时正在等待的查询。通常仅在仓库恢复后的最初几分钟内发生。
Blocked在间隔内因事务锁定而被阻止的查询。
Queued因仓库过载而等待运行的查询(即,等待其他查询完成运行并释放计算资源)。

查询负载的计算方式

查询负载的计算方式是间隔内所有查询的执行时间(以秒为单位)除以间隔的总时间(以秒为单位)。

例如,下表说明如何根据 5 分钟间隔内对仓库负载产生影响的 5 个查询来计算查询负载。正在运行的查询的负载为 0.92,(因仓库过载)加入队列的查询为 0.08。

查询状态执行时间/间隔(以秒为单位)查询负载
查询 1正在运行30 / 3000.10
查询 2正在运行201/3000.67
查询 3正在运行15 / 3000.05
查询 4正在运行30 / 3000.10
正在运行的负载0.92
查询 5已排队24 / 3000.08
已排队的负载0.08
TOTAL WAREHOUSE LOAD1.00

To determine the actual number of running queries (and the duration of each query) during a specific interval, consult the History History tab page. On the page, filter the query history by warehouse, then scroll down to the interval you specified in the load monitoring chart.

使用负载监控图表做出决策

负载监控图表可以显示当前和历史使用模式,帮助您做出管理仓库的决策。

查询性能慢

当您发现查询运行缓慢时,请检查超载的仓库是否导致查询竞争资源或排队:

  • If the running query load is high or there’s queuing, consider starting a separate warehouse and moving queued queries to that warehouse. Alternatively, if you are using multi-cluster warehouses, you could change your multi-cluster settings to add additional clusters to handle higher concurrency going forward.
  • If the running query load is low and query performance is slow, you could resize the warehouse to provide more compute resources. You would need to restart the query once all the new resources were fully provisioned to take advantage of the added resources.

峰值查询性能

分析过去两周仓库每天的工作负载。如果您看到重复出现的使用高峰,请考虑将部分峰值工作负载转移到专用的仓库,并且可在较小的仓库上运行剩余的工作负载。或者,您可以更改多集群设置,添加其他集群以处理未来更高的并发性。

If you notice that your current workload is considerably higher than normal, open the History History tab page to investigate which queries are contributing to the higher load.

过度使用 Credit

分析过去两周仓库每天的工作负载。如果图表显示在多个时间段内,仓库运行并使用 credit,但总查询负载在相当长的时间内小于 1,则表明仓库使用效率低下。您可以考虑以下任意操作:

  • 缩小仓库规模。请注意,缩小仓库规模通常会增加查询执行时间。
  • 对于多集群仓库,减少 MIN_CLUSTER_COUNT 参数值。

使用 Account Usage QUERY_HISTORY 视图评估仓库性能

You can query the QUERY_HISTORY view to calculate virtual warehouse performance metrics such as throughput and latency for specific statement types. For more information, see Examples: Warehouse performance.