3

我正在使用 Microsoft.AnalysisServices.Tabular 测试将数据刷新/加载到 azure 分析服务中。代码非常简单

while (true)
{
    var server = new Microsoft.AnalysisServices.Tabular.Server();
    server.Connect(
            "Provider=MSOLAP;Data Source=asazure://[...];Persist Security Info=True; Impersonation Level=Impersonate;");
    var m = server.Databases[0].Model;
    var tabs = m.Tables;
    tabs["Viewer"].RequestRefresh(RefreshType.DataOnly);
    tabs["EventClick"].RequestRefresh(RefreshType.DataOnly);
    [...]
    m.SaveChanges();
    server.Disconnect();
    Thread.Sleep(new TimeSpan(0,0,0,1));
}

模型最初约为 300MB,没有活跃的关系或复杂的度量。基本上它只是增长非常缓慢的数据(所有表中每秒少于 10 条记录)。

我预计内存利用率会增长一点并稳定在某个数字附近,但由于某种原因,数据库所需的内存只会随着每次刷新而增长和增长(以恒定速率),直到达到 azure AS 开发计划的 azure 内存限制(大约 3GB)。此时应用程序收到异常

Unhandled Exception: Microsoft.AnalysisServices.OperationException: Failed to save modifications to the server. Error returned: 'Memory error: Allocation failure : The paging file is too small for this operation to complete.

内存利用率

即使我停止刷新表/分区,内存利用率也保持不变。我注意到当我在 azure 门户中暂停并重新启动 azure AS 时,它会下降到 ~300MB 的原始值

DMV 结果并没有告诉我任何事情,但我还是会发布它(快照,其中 db 大约为 1.5GB)。也许有人会注意到一些奇怪的东西

车管所:SELECT top 10 * FROM $SYSTEM.DISCOVER_OBJECT_MEMORY_USAGE ORDER BY OBJECT_MEMORY_NONSHRINKABLE DESC

OBJECT_PARENT_PATH OBJECT_ID   OBJECT_MEMORY_SHRINKABLE OBJECT_MEMORY_NONSHRINKABLE OBJECT_VERSION OBJECT_DATA_VERSION OBJECT_TYPE_ID OBJECT_TIME_CREATED OBJECT_MEMORY_CHILD_SHRINKABLE OBJECT_MEMORY_CHILD_NONSHRINKABLE   OBJECT_GROUP
"Global"    "Big"   0   11026432    "-1"    "-1"    "2" 2016-12-13 12:01:26.000 0   0   "$System"
""  "Global"    0   5055222 "-1"    "-1"    "100011"    2016-12-13 12:01:26.000 0   15903456    "$System"
"Global"    "SystemHeap"    0   1396488 "-1"    "-1"    "2" 2016-12-13 12:01:26.000 0   0   "$System"
"ardev.Databases.mytestdb_90db7154-080a-4094-bd4b-cc6b35422d42.Dimensions.ProductImpression (28).In-Memory Table.Columns"   "ProductId (73)"    0   1068088 "0" "-1"    "703003"    2016-12-13 04:00:52.000 0   528 ""
"ardev.Databases.mytestdb_90db7154-080a-4094-bd4b-cc6b35422d42.Dimensions.Website Product Sale (31).In-Memory Table.Columns"    "ProductId (78)"    0   1066288 "-1"    "-1"    "703003"    2016-12-13 04:00:52.000 0   136 ""
"Global"    "IMBIData"  0   880640  "-1"    "-1"    "2001"  2016-12-13 12:01:26.000 0   0   "$System"
"Global"    "Aligned Global Heap"   0   619488  "0" "-1"    "2" 2016-12-13 12:01:26.000 0   0   "$System"
"ardev.Databases.mytestdb_90db7154-080a-4094-bd4b-cc6b35422d42.Dimensions.Visit (16).In-Memory Table.Columns"   "Url (56)"  0   508404  "-1"    "-1"    "703003"    2016-12-13 04:00:52.000 0   22040   ""
"Global"    "GeneralPurpose"    0   413480  "-1"    "-1"    "2" 2016-12-13 12:01:26.000 0   0   "$System"
"Global"    "Allocators"    0   404176  "-1"    "-1"    "2" 2016-12-13 12:01:26.000 0   0   "$System"

是什么导致了这种“内存泄漏”以及如何避免它们?我应该知道哪些问题?

// 编辑

当我不经常刷新时会发生什么?目前我们每 5 分钟刷新一次数据,每 3 小时重启一次实例。

内存指标如下所示:

最后一小时的记忆

基本上,当您每 x 分钟刷新一次时,问题仍然可见。我假设大多数每 x 天刷新一次数据的人都无法判断出问题所在。

4

0 回答 0