MDX查询是SLOWER,带有热缓存

时间:2015-03-05 06:34:07

标签: performance ssas mdx

我有一个MDX查询,在冷缓存上执行的速度比暖缓存快。

如果我在重新启动MDX后运行相同的SSAS查询,则需要14秒。然后,同一语句的所有后续运行需要50秒。

服务器上没有负载,并且有大量可用的RAM和默认的SSAS内存设置。

我不知道为什么会出现这种情况?

更新

来自SSRS报告的MDX追踪声明:

SELECT 
  NON EMPTY 
    {
      [Measures].[Total GP %]
     ,[Measures].[Trading GP %]
     ,[Measures].[Closing Stock Value]
     ,[Measures].[Opening Stock Value]
     ,[Measures].[Trading GP]
     ,[Measures].[Total GP]
     ,[Measures].[Purchases Value]
     ,[Measures].[Shortage Value]
     ,[Measures].[Adjustments Value]
     ,[Measures].[Wastage Value]
     ,[Measures].[Sales Value]
    } ON COLUMNS
 ,NON EMPTY 
    {
        [Item].[Item Code].[Item Code].ALLMEMBERS
      * 
        [Item].[Item Description].[Item Description].ALLMEMBERS
    }
  DIMENSION PROPERTIES 
    MEMBER_CAPTION
   ,MEMBER_UNIQUE_NAME
   ON ROWS
FROM 
(
  SELECT 
    Filter
    (
      [Item].[Item Name].[Item Name].ALLMEMBERS
     ,
        Instr
        (
          [Item].[Item Name].CurrentMember.Properties('Member_Caption'),@ItemItemName
        )
      > 0
    ) ON COLUMNS
  FROM 
  (
    SELECT 
      StrToSet
      (@ItemGroupDescription2
       ,CONSTRAINED
      ) ON COLUMNS
    FROM 
    (
      SELECT 
        StrToSet
        (@ItemGroupDescription
         ,CONSTRAINED
        ) ON COLUMNS
      FROM 
      (
        SELECT 
          StrToSet
          (@BranchBranchName
           ,CONSTRAINED
          ) ON COLUMNS
        FROM 
        (
          SELECT 
            StrToSet
            (@BranchStoreCategory
             ,CONSTRAINED
            ) ON COLUMNS
          FROM 
          (
            SELECT 
              StrToSet
              (@BranchRegion
               ,CONSTRAINED
              ) ON COLUMNS
            FROM 
            (
              SELECT 
                StrToSet
                (@BranchCountry
                 ,CONSTRAINED
                ) ON COLUMNS
              FROM 
              (
                SELECT 
                  StrToSet
                  (@PeriodPeriodWeek
                   ,CONSTRAINED
                  ) ON COLUMNS
                FROM 
                (
                  SELECT 
                    StrToSet
                    (@PeriodPeriodYear
                     ,CONSTRAINED
                    ) ON COLUMNS
                  FROM [DWH]
                )
              )
            )
          )
        )
      )
    )
  )
)
WHERE 
  (
    IIF
    (
      StrToSet(@PeriodPeriodYear,CONSTRAINED).Count = 1
     ,StrToSet
      (@PeriodPeriodYear
       ,CONSTRAINED
      )
     ,[Period].[Period Year].CurrentMember
    )
   ,IIF
    (
      StrToSet(@PeriodPeriodWeek,CONSTRAINED).Count = 1
     ,StrToSet
      (@PeriodPeriodWeek
       ,CONSTRAINED
      )
     ,[Period].[Period Week].CurrentMember
    )
   ,IIF
    (
      StrToSet(@BranchCountry,CONSTRAINED).Count = 1
     ,StrToSet
      (@BranchCountry
       ,CONSTRAINED
      )
     ,[Branch].[Country].CurrentMember
    )
   ,IIF
    (
      StrToSet(@BranchRegion,CONSTRAINED).Count = 1
     ,StrToSet
      (@BranchRegion
       ,CONSTRAINED
      )
     ,[Branch].[Region].CurrentMember
    )
   ,IIF
    (
      StrToSet(@BranchStoreCategory,CONSTRAINED).Count = 1
     ,StrToSet
      (@BranchStoreCategory
       ,CONSTRAINED
      )
     ,[Branch].[Store Category].CurrentMember
    )
   ,IIF
    (
      StrToSet(@BranchBranchName,CONSTRAINED).Count = 1
     ,StrToSet
      (@BranchBranchName
       ,CONSTRAINED
      )
     ,[Branch].[Branch Name].CurrentMember
    )
   ,IIF
    (
      StrToSet(@ItemGroupDescription,CONSTRAINED).Count = 1
     ,StrToSet
      (@ItemGroupDescription
       ,CONSTRAINED
      )
     ,[Item].[Group 1 Description].CurrentMember
    )
   ,IIF
    (
      StrToSet(@ItemGroupDescription2,CONSTRAINED).Count = 1
     ,StrToSet
      (@ItemGroupDescription2
       ,CONSTRAINED
      )
     ,[Item].[Group 2 Description].CurrentMember
    )
  )
CELL PROPERTIES 
  VALUE
 ,BACK_COLOR
 ,FORE_COLOR
 ,FORMATTED_VALUE
 ,FORMAT_STRING
 ,FONT_NAME
 ,FONT_SIZE
 ,FONT_FLAGS;
<Parameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-analysis">
  <Parameter>
    <Name>PeriodPeriodYear</Name>
    <Value xsi:type="xsd:string">[Period].[Period Year].&amp;[2014]</Value>
  </Parameter>
  <Parameter>
    <Name>PeriodPeriodWeek</Name>
    <Value xsi:type="xsd:string">[Period].[Period Week].&amp;[52]</Value>
  </Parameter>
  <Parameter>
    <Name>BranchBranchName</Name>
    <Value xsi:type="xsd:string">[Branch].[Branch Name].&amp;[Test Branch]</Value>
  </Parameter>
  <Parameter>
    <Name>BranchCountry</Name>
    <Value xsi:type="xsd:string">[Branch].[Country].[All]</Value>
  </Parameter>
  <Parameter>
    <Name>BranchStoreCategory</Name>
    <Value xsi:type="xsd:string">[Branch].[Store Category].&amp;[Test Cat]</Value>
  </Parameter>
  <Parameter>
    <Name>BranchRegion</Name>
    <Value xsi:type="xsd:string">[Branch].[Region].[All]</Value>
  </Parameter>
  <Parameter>
    <Name>ItemGroupDescription</Name>
    <Value xsi:type="xsd:string">[Item].[Group 1 Description].[All]</Value>
  </Parameter>
  <Parameter>
    <Name>ItemGroupDescription2</Name>
    <Value xsi:type="xsd:string">[Item].[Group 2 Description].[All]</Value>
  </Parameter>
  <Parameter>
    <Name>ItemItemName</Name>
    <Value xsi:type="xsd:string"></Value>
  </Parameter>
</Parameters>

以下是通过MDX Studio的perfmon计数器:

Cold cache execution

Time              : 5 sec 125 ms
Calc covers       : 0
Cells calculated  : 24843
Sonar subcubes    : 7700
NON EMPTYs        : 3824
Autoexists        : 42
EXISTINGs         : 3824
SE queries        : 3833
Flat cache insert : 0
Cache hits        : 11513
Cache misses      : 11
Cache inserts     : 1
Cache lookups     : 11524
Memory Usage KB   : 98324

Warm cache execution

Time              : 41 sec 906 ms
Calc covers       : 0
Cells calculated  : 24843
Sonar subcubes    : 7698
NON EMPTYs        : 3824
Autoexists        : 42
EXISTINGs         : 3824
SE queries        : 3825
Flat cache insert : 0
Cache hits        : 11516
Cache misses      : 0
Cache inserts     : 0
Cache lookups     : 11516
Memory Usage KB   : -53232

Percent cold caches :0.00%
Percent warm caches :100.00%

UPDATE2

我还注意到,暖缓存版本在NON EMPTY操作和冷缓存版本上花费的时间要多得多。

enter image description here

UPDATE3

SSAS进程似乎使用非常少的内存。 SSAS内存设置是默认设置,主机有可用内存。

enter image description here enter image description here enter image description here

UPDATE4

从查询

中删除NON EMPTY的次数
Cold cache execution

Time              : 23 sec 874 ms
Calc covers       : 0
Cells calculated  : 934213
Sonar subcubes    : 7711
NON EMPTYs        : 3822
Autoexists        : 45
EXISTINGs         : 3823
SE queries        : 3833
Flat cache insert : 0
Cache hits        : 11519
Cache misses      : 9
Cache inserts     : 3
Cache lookups     : 11528
Memory Usage KB   : 115700

Warm cache execution

Time              : 58 sec 905 ms
Calc covers       : 0
Cells calculated  : 934213
Sonar subcubes    : 7695
NON EMPTYs        : 3822
Autoexists        : 45
EXISTINGs         : 3823
SE queries        : 3825
Flat cache insert : 0
Cache hits        : 11518
Cache misses      : 0
Cache inserts     : 0
Cache lookups     : 11518
Memory Usage KB   : -54496

Percent cold caches :0.00%
Percent warm caches :100.00%

0 个答案:

没有答案