我正在使用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 dev计划的天蓝色内存限制(大约3GB) )。此时,apllication会收到异常
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 AS时,它会降低到~300MB的原始值
DMV结果并没有告诉我什么,但我会发布它(快照,其中db约为1.5GB)。也许有人会发现奇怪的事情
DMV: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天刷新一次数据就无法判断出出现了什么问题。