使用 TOM 处理 SSAS 表格模型时减少并行度

Reduce parallelism when processing a SSAS Tabular model using TOM

我使用 Tabular Object Model 和 powershell 脚本处理我们的表格模型(兼容级别 1200)。该脚本使用一些元数据来确定需要为给定 table 处理哪些分区,然后对这些分区执行 process full。在某些情况下,脚本会在整个 table 上执行 Process Full(例如,在第一次将模型部署到服务器之后)

当脚本处理整个 table 时,我希望能够控制在任何给定时间对数据源执行的并发查询数量,因此在我的脚本中,我创建了一个新实例a Microsoft.AnalysisServices.Tabular.SaveOptions 并将 MaxParallelism 属性 设置为 1 到 10 之间的数字。然后我将更改保存到服务器上的模型,并等待处理完成。

$serverTable.RequestRefresh([Microsoft.AnalysisServices.Tabular.RefreshType]::Full)
$db.Update( "ExpandFull")
$saveOptions = New-Object Microsoft.AnalysisServices.Tabular.SaveOptions
$saveOptions.MaxParallelism = $maxParallelism   
$result = $db.Model.SaveChanges($saveOptions)

如果我监控 table 正在连接的 SQL 服务器,无论我将 MaxParallelism 设置为什么,我都会从我的 SSAS 框中看到几个查询(大部分时间是 8 个)。通读提到并行的documentation on that property, This value doesn't guarantee parallelism, as the server may enforce other limits. I don't see any server properties。还有哪些limits/why这个属性不影响同时运行的查询数吗?

脚本调用方法的顺序错误,因此 $maxParallelism 值在处理完成后才在服务器上设置!

--Call the SaveChanges method with the SaveOptions before you RequestRefresh
$saveOptions = New-Object Microsoft.AnalysisServices.Tabular.SaveOptions
$saveOptions.MaxParallelism = $maxParallelism  
$result = $db.Model.SaveChanges($saveOptions)
$db.Update( "ExpandFull")
$serverTable.RequestRefresh([Microsoft.AnalysisServices.Tabular.RefreshType]::Full)

使用 $maxParallelism 的不同值对此进行测试我可以看到 SSAS 现在开始的查询数量与我传入的值相同。(最多 8 个)