﻿<?xml version="1.0" encoding="utf-8"?><!--RSS Genrated: Thu, 15 Oct 2026 10:55:29 GMT--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Enterprise Software Solutions - Complete Business Intelligence Solutions -  MS Analysis Server (SSAS)</title><link>http%3a%2f%2fwww.entsoftsol.com%2fDefault.aspx%3ftabid%3d118%26ctl%3dRSS%26mid%3d613%26evl%3d0%26CategoryID%3d6%26CategoryName%3d-MS-Analysis-Server-SSAS%26language%3den-US</link><atom:link href="http%3a%2f%2fwww.entsoftsol.com%2fDefault.aspx%3ftabid%3d118%26ctl%3dRSS%26mid%3d613%26evl%3d0%26CategoryID%3d6%26CategoryName%3d-MS-Analysis-Server-SSAS%26language%3den-US" rel="self" type="application/rss+xml" /><description>RSS document</description><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[Time Span Formatting in SSAS]]></title><link>http://www.entsoftsol.com/Home/Blog/time-span-formatting-in-ssas</link><description><![CDATA[<p>ESS offers a BI Solution based on a SSAS Cube using the 3CX phone data.&nbsp; One of the challenges in the cube implementation is the display of time span values in SSAS. The available &ldquo;Format_string&rdquo; options are limited and do not allow extensions.&nbsp; The call data from the 3CX phone system is recorded in seconds. Some of the measures, such a&nbsp; &ldquo;Ringing Duration&rdquo; and &ldquo;Talking Duration&rdquo;, require custom formatting when displayed on the client. The preferred format is the Time Span: &ldquo;Days.Hours:Minutes:Seconds&rdquo; or &ldquo;DD.HH:MM:SS&rdquo;.&nbsp; This makes it very easy for the end user to comprehend the duration times compared to seeing a really big number, representing seconds (i.e. 4.11:03:13 vs. 9,834,132 sec).&nbsp; </p>
<p>The BI Portal offers custom value formatting, which makes support for Time Spans easy.&nbsp; Here is a snapshot of the 3CX cube data, displaying Talking Durations as well as common Time Calculations, automatically done in the cube:</p>
<p>&nbsp;</p>]]></description><pubDate>Thu, 02 Apr 2015 14:53:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/time-span-formatting-in-ssas</guid></item><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[Logical "AND" in SSAS]]></title><link>http://www.entsoftsol.com/Home/Blog/logical-and-in-ssas</link><description><![CDATA[<p>I was working with a large manufacturer when I faced an interesting business requirements.&nbsp; The client stated that they had a lot of products with a lot of features available in one or more products.&nbsp; For example: the same model car may come with an MP3 player or without one.&nbsp;&nbsp; The end user would select the desired features when configuring the product.&nbsp; The client wanted to do analysis on an ad-hoc selected combination of features.&nbsp; The challenge was to treat the selection as a group in an &ldquo;all-or-nothing&rdquo; fashion.&nbsp; In other words, either all features were present or the product should not be selected.&nbsp; For example: Product 1 might have only Feature 1 while Product 2 had Feature 1 and Feature 2.&nbsp;&nbsp; For the analysis, if both Future 1 and Feature 2 are selected then ONLY Product 2 should be selected. </p>
<p>SSAS handles by default the selection using a logical &ldquo;OR&rdquo;. In the previous example, both products will be displayed since both of them contain Feature 1.&nbsp;&nbsp; The resulting matrix from cross joining the products with the features generated in unusable number of records, even after applying the &ldquo;Feature&rdquo; filter.&nbsp; This was an acceptable solution.&nbsp; The client wanted to see ONLY the products, which had all the selected features.&nbsp;&nbsp; In technical specs, a logical &ldquo;AND&rdquo; must be applied on the &ldquo;Features&rdquo; filter.&nbsp;&nbsp; </p>
<p>I came with a solution using the &ldquo;Existing&rdquo; function to detect what features were selected in the filter and then count them.&nbsp; The products and features dimensions were joined thru a regular relationship to a measure group called &ldquo;ProductFeatures&rdquo;.&nbsp; The measure group contained &ldquo;Feature Count&rdquo; measure, which did simple count of how many features were in a given product.&nbsp;&nbsp; If the feature count and the &ldquo;existing&rdquo; count were the SAME, then the product should be displayed.&nbsp; So the MDX prototype was &ldquo;with member [Current Feature Count] as iif(count(existing [Features]) = [Measures].[Feature Count] , [Measures].[Feature Count], NULL) select non empty [Current Feature Count] on 0, [Products] on 1 from [Features]&rdquo; and worked fine in most cases. </p>
<p>In some cases, the above solution does not work.&nbsp;&nbsp; The reason for that was the difference in the behavior of the &ldquo;Existing&rdquo; function.&nbsp; If the &ldquo;Feature&rdquo; filter selection was placed in the &ldquo;WHERE&rdquo; clause of the MDX statement, then it worked as expected.&nbsp; BUT if the filter selection was placed in the sub-cube clause, then the &ldquo;Existing&rdquo; function returned all feature members (unless the Feature dimension was placed on one of the Axis).&nbsp; That made no sense but there was nothing to be done to change the &ldquo;Existing&rdquo; behavior.</p>
<p>Here are some examples of the &ldquo;Existing&rdquo; function behavior:</p>
<p>a)&nbsp; &ldquo;select&hellip;from&hellip;where ({Feature1,Feature2})&rdquo; &ndash; this works fines with a count of two (out of 10 total features) &ndash; since the &ldquo;feature&rdquo; dimension is the &ldquo;WHERE&rdquo; clause (i.e. one of the Axis).<br />
b) &ldquo;select {Feature1,Feature2} on 0 from&hellip;&rdquo; &ndash; this works fines with a count of two (out of 10 total features) since the &ldquo;feature&rdquo; dimension is selected on one of the Axis.<br />
c) &ldquo;select&hellip;from (select {Feature1,Feature2} on 0 from&hellip;.)&rdquo; &ndash; this does NOT work and comes with a count of 10 (out of 10 total features) since the &ldquo;feature&rdquo; dimension is NOT placed on one of the Axis. </p>
<p>Again, the solution with counting the existing members works fine for most cases.&nbsp; If the client software generates MDX with a &ldquo;sub-select/sub-cube/&rdquo; then the above solution will NOT work due to the misbehaving &ldquo;Existing&rdquo; function.&nbsp; </p>
<p>I took it as a challenge to make the solution suitable for all client tools (including filters in the sub-select/sub-cube).&nbsp;&nbsp; I did some digging and found that ASSPs were needed to detect what members were selected in the &ldquo;sub-select/sub-cube&rdquo;; basically fix the &ldquo;Existing&rdquo; behavior issues.&nbsp; I added some new functions to the BI Portal SSAS DLL and was able to implement the solution with success.&nbsp; Yes, it&rsquo;s possible but it&rsquo;s not an easy task.&nbsp; Here is a snapshot of my end result:</p>
<p>&nbsp;</p>]]></description><pubDate>Thu, 02 Apr 2015 13:45:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/logical-and-in-ssas</guid></item><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[Custom Security and Data Driven Subscription (DDS)]]></title><link>http://www.entsoftsol.com/Home/Blog/custom-security-and-data-driven-subscription-dds</link><description><![CDATA[<p>
What is a Data-Driven Subscriptions (DDS) in SSRS?  Let&rsquo;s start with the definition for a Standard Subscription, which is a time based delivery of a report.  The user subscribes to a report to be delivered on a schedule. For example, the daily sales report can be prepared in off-peak hours during the night and emailed to the user at &nbsp;a predefined time.  There  are several advantages of using a subscription: a) server resources can be better utilized during off-peak hours; b) less stress for the server during the normal hours; c) the user doesn't have to constantly log into the system to review the same report; d) the user can review the report at any time/including offline/, which implies better productivity.
<br />
<br />
How can we create a subscription in SSRS?  In the BI Portal, the user can right-click on a SSRS report, select the &ldquo;Subscriptions&rdquo; menu option, and click on the &ldquo;Create Report Subscription&rdquo;.  Here is a snapshot:</p>
<br />

<br />
<p>
The popup dialog box (shown below) allows the user to configure the subscription. Most of the configuration options are intuitive and self-explaining. For example: a) Description (i.e. Daily Sales Report Delivered at 4am via Email);  b) Delivery Method: Email or File Share; c) Recipients email addresses; d) Rendering Format (i.e. PDF, Excel, Word, Image, HTML, etc.); e) Delivery Schedule (i.e. Time, Frequency, Private or Shared); f) Report Parameters values;  and more.  The options are well documented in the SSRS on-line help.
<br />
<br />
The BI Portal extends the default subscription capabilities by offering the option of report delivery based on a condition or business rule. The condition is defined either by a) using a statement (which can be configured by selecting the data source and providing the statement); or b) using a report (the UI allows for report selection) &ndash; in both cases, the statement and the report needs to return a single cell, which evaluates to either &ldquo;0/1&rdquo; or &ldquo;True/False&rdquo;).   If the value is &ldquo;1/True&rdquo;, the report will be sent.  This is a powerful feature, which allows the user to receive reports ONLY when a certain condition is met &ndash; for example: if the Sales are down 10 percent  from last week, then the report will be sent.  This will eliminate a lot of unneeded reports, saving the server resources in preparing &nbsp;them and user time in reviewing them.
<br />
<br />
The final step is for the user to save the  new subscription and optionally,  test it by clicking on the &ldquo;Run&rdquo; button.  Hint: all the user subscriptions are listed in the left panel; each subscriptions has a different icon indicating its type.  If the icon contains a database image, the subscription is data-driven.  The user can also click on the &ldquo;Refresh&rdquo; button and check the status of the selected subscription in the right panel at the top &ldquo;Status&rdquo; label (i.e. after Running the subscription manually)
<br />
<br />
<br />
<br />
The DDS is a variation, which allows the distribution of a given report to multiple users while customizing its content for each user.   The user needs to provide a SQL statement, which retrieves a list of users as well as their preferences for the report customization/rendering.   Any of the options listed under the Standard Subscription (and described above) can be customized.  For example:  the SQL statement &ldquo;select 'User1' as [To], 'PDF' as RenderFormat union select 'admin' as [To], 'Excel' as RenderFormat&rdquo; can be used to create a DDS, which will target &ldquo;User1&rdquo; and &ldquo;admin&rdquo; as the recipients, and the report will be rendered in PDF and Excel formats for each user correspondingly.  Think of the DDS as a preliminary step, during which the SSRS engine executes a statement and retrieves a record set from a relational database; for each record, the engine create on-the-fly standard subscription using the values in the different fields (i.e. [To], [RenderFormat], [IncludeLink], etc.). Note:  For options which are not included the statement, the engine will use the default option provided in the standard subscription definition.  The user needs to provide a mapping between the resulting set columns and the subscriptions options.
<br />
<br />
How can we create a DDS in SSRS?  The steps are the same as for a Standard Subscription, but in the context menu the user needs to select &ldquo;Create Data-Driven Subscription&rdquo;.  The popup dialog and settings are the same as before, except for &ldquo;Data-Driven Parameters&rdquo; extra button at the bottom (highlighted in Red in the snapshot below).  This button allows the DDS specific options to be configured; clicking it will display the dialog below.  The user first needs to select what Data Source will be used for executing the SQL statement/query and retrieving the users&rsquo; specific settings.  The Query/SQL statement is provided next; it defines what fields/columns will be returned as well as the actual data (which usually comes from a relational DB table).   The &ldquo;Get Fields&rdquo; button will execute the statement against the &ldquo;Data Source&rdquo; and will retrieve a list of fields/columns; this list will be available in the combo boxes in the next section. (Note: The dropped down combo box in the snapshot displays the list of returned columns after clicking on the &ldquo;Get Fields&rdquo; button.)  The user then needs to provide the mapping between the returned fields/columns/ and the DDS settings/options/.  In the example below, only the &ldquo;To&rdquo; and &ldquo;Render Format&rdquo; settings are mapped/set/ - this basically says: for each record in the returned set, use the &ldquo;To&rdquo; column value to get the recipient list, and the &ldquo;RenderFormat&rdquo; column value to specify the user preferred report format (i.e. PDF, Excel, etc).  The final step is for the user to save the subscription and optionally test it by hitting the &ldquo;Run&rdquo; button and &ldquo;Refresh&rdquo; to check for errors.</p>
<p></p>
<p>
To summarize the DDS execution flow: the SSRS engine uses the selected Data Source to execute the specified &ldquo;Query&rdquo;. The returned records are iterated, and for each record, the specified mapping is used to &ldquo;fill in&rdquo;/configure/ the currently created subscription &ndash; i.e. the &ldquo;To&rdquo; column will give the recipients list, the &ldquo;RenderFormat&rdquo; column will provide the current user preference, and so on.  IMPORTANT: the Data Source MUST NOT require any user input (such as credentials) or any configurations coming from the assumption of an active user; the data source (DS) is used WITHOUT a current user or any user interactions. &nbsp;The engine should be able to open the DS connection directly in &ldquo;lights-out&rdquo; fashion. In other words, specify in the DS definition the user credentials &ndash; do NOT use &ldquo;current user identity&rdquo; settings since there is no current user during the DDS execution!
<br />
<br />
Everything so far is standard DDS functionality.  The BI Portal adds the &ldquo;Report Delivery Condition&rdquo;, which is a very powerful feature in controlling when a report will be sent out to a given user; this option is covered above and it&rsquo;s behavior is the same with DDS.  A good example will be the distribution of the &ldquo;Daily Sales&rdquo; report to all the sales managers in a company; if the business rule for sending the report is the same one from above, only the managers with declining sales from last week will get the report!
<br />
<br />
The information so far is a coverage of the Report Subscription and the DDS topics.  The blog is about Custom Security and DDS.  This is where the BI Portal solution shines.
<br />
<br />
The DDS is a very powerful feature for the Windows-Domain Enterprise Environment but it&rsquo;s not very Internet friendly. In other words, it does not work well with Custom/ASP.NET Membership/ security,  The BI Portal extends the DDS and makes this feature available for Internet Users.  I have covered in a previous blog how our solution offers a custom security with a Single-Sign-On (SSO) for SSRS, SQL, and SSAS.  This functionality is extended to cover the DDS as well. When a Data Source is define with the ESS Data Source Extensions for MS SQL and SSAS (and OLEDB Sources), there is an option, which says that &ldquo;Credentials are not required&rdquo; &ndash; this enables the SSO identity and its flow into the DDS.
<br />
When the DDS is executed, each user is impersonated when the data source connection is opened, and the data is filtered using the user&rsquo;s identity!  This customizes the report content to match the security clearance of each user. (Note: the alternative solution are a) to create multiple data sources (with different credentials) and matching reports (not a DDS solution); or b) to use &ldquo;Expression Based&rdquo; connection string, or c)&hellip; in any case, the resulting solution is very complicated and difficult to support and extend)
<br />
Here are some examples of the BI Portal DDS solution at work. The snapshot bellows shows several pre-defined subscriptions; the top three are DDS&rsquo; (with the DB image in the icon).  All of them have been created with the steps described above.  The BI Portal Data Source Extensions are used in the reports so SSO can be used during the DDS. Two users are used in the tests: &ldquo;User1&rdquo; and &ldquo;Admin&rdquo;.  Both MS SQL and SSAS data sources are used by the subscribed reports to demonstrate the data filtering capabilities for the different users.
<br />
<span style="text-align: justify;"></span>
</p>
<p>Let&rsquo;s start with the &ldquo;GIS Report&rdquo; report, which uses the SSAS as a data source ; custom security is in place.  When I click the &ldquo;Run&rdquo; button, I receive two reports: one for &ldquo;User1&rdquo;; and another one for &ldquo;Admin&rdquo;.   Here is a snapshot of these reports.  A you can see, &ldquo;User1&rdquo; gets the report as a PDF file and can only see &ldquo;US and Canada&rdquo;, while &ldquo;Admin&rdquo; can see all the regions and prefers the Excel format. One Data Source, One Report &ndash; multiple users served.&nbsp;</p>
<p>
<br />

<br />
<span style="font-family: 'Segoe UI', Tahoma, arial, sans-serif; font-size: 13px;">The second report is the &ldquo;Sql Security Test&rdquo;, which uses the MS SQL as a data source and custom security with SSO.  Running the subscription results in two emails with embedded report. Here is a snapshot of the reports.  Again, each user only sees the records, for which s/he&rsquo;s been given security clearance.&nbsp;</span></p>
<p>
<br />

<br />
The DDS feature requires the Enterprise Edition of SSRS.  The BI Portal solutions brings this feature to the MS SQL Standard and Express/Free/ Editions.   One of our clients requested the DDS concept but with custom reports; the BI Portal offers ad-hoc reports based on SSAS.   We offered  a custom service, which prepares and sends ad-hoc and other custom reports (i.e. by &ldquo;custom&rdquo;, I mean non-SSRS reports).  Eventually, we discovered that the DDS boils down to executing a SQL statement against a Datasource and retrieving a record set. &nbsp;Then for each records (after making the mapping adjustments), we can fire an event in SSRS and accomplish the same functionality offered by the standard DDS.   Since we don&rsquo;t have any SSRS version dependencies, our DDS implementation supports all version of SSRS including the free edition.  In other words, we bring DDS to everyone.
<br />
<br />
In summary, the BI Portal solution offers custom/asp.net/ security for the Data-Driven Subscription in SSRS. With a single identity (aka SSO), the user can access data in both MS SQL and SSAS. There is no need for the administrator to create multiple data sources and reports &ndash; one for each security requirement.  The data is securely served on the Internet with filtering done for each user or assigned role. The DDS takes advantage of the custom security and the SSO.  With one report and one data source, unlimited number of users with different security needs can be served.
</p>]]></description><pubDate>Mon, 15 Dec 2014 11:00:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/custom-security-and-data-driven-subscription-dds</guid></item><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[Memory Analysis and Caching in SSAS]]></title><link>http://www.entsoftsol.com/Home/Blog/memory-analysis-and-caching-in-ssas</link><description><![CDATA[<p style="margin: 0.15pt 0in 0pt;"><span>If you have a MS SQL Server background, analyzing the SSAS memory usage patterns can be confusing. Even if you have to wait for the SQL service to zero out (being sarcastic about slow AWE allocations years ago) the allocated memory, at the end you will see in the Task Manager that the memory has been allocated and will get the warm feeling that things are working as expected. Well, don&rsquo;t use the same approach with SSAS or you will be&nbsp;disappointed. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>SSAS is a file-based database engine. &nbsp;It reads data from different files, makes the joins, and services the requests.&nbsp; All the files requests are going the System File Cache so the overall used memory may not be necessarily found only in the SSAS process.&nbsp; I have already blogged about how file reading and memory usage is done at the OS level. The same applies for SSAS &ndash; it makes a file a request to the OS for file; the OS checks to see if the file is in the Cache.&nbsp; If it&rsquo;s not,&nbsp;the file is&nbsp;retrieved from Disk, placed in the Cache, and returned back to the SSAS (aka hard fault).&nbsp; If it&rsquo;s found in the Cache, it&rsquo;s returned back to the process (aka soft fault).&nbsp; Hence, when analyzing SSAS memory usage, we need to consider the System File Cache.&nbsp;&nbsp; There is an excellent tool &ldquo;RAMMap.exe&rdquo; from Sysinternals, which gives you a list of&nbsp;all cached files.&nbsp; You can use the tool to view what SSAS files are cached at the OS level. Note: If you run the exe with a text file name as a parameter (i.e. &ldquo;RAMMap.exe output.txt&rdquo;), the tool will export all the file paths into a text file; we considered embeding the tool&nbsp;and giving you this list into our app, but we gave up on the idea due to the size of the output file (300Mb on 450GB cube) and the limited value delivered by the report.</span></p>
<p style="margin: 0in 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0in 0in 0pt;"><span>I am going to use a server with 1TB of physical memory&nbsp;in the&nbsp;examples to follow. It makes it easier to see the difference in memory behavior when events happened.&nbsp; Speaking about System File Cache, there is an option in the msmdsrv.ini file called &ldquo;LimitSystemFileCacheSizeMB&rdquo;, which controlls how&nbsp;many of the SSAS files will be cached; the cache usage limitation is at the OS level and affects other processes. In the Companion snapshot below, we set the&nbsp;option to &ldquo;0&rdquo; which means, that there is no limit; the OS will cache as much as it can (note: this may affect other processes; on the same server, there is a SQL instance running with 100/300GB configured for&nbsp;Max Memory, which is&nbsp;dynamically changed during the ETL). &nbsp;</span></p>
<span><br clear="all" />
</span>
<p style="margin: 0in 0in 0pt;"><span></span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>So let&rsquo;s start with several common scenarios, displaying the memory usage and its variations in SSAS:</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<ol style="list-style-type: decimal;">
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>Min/Max Memory: The SSAS properties allow the configuration of the Min and Max memory settings. This is a bit confusing if you apply common sense. The Minimum Memory does NOT mean that this is the minimum amount of memory that will be used by SSAS.&nbsp; It means that SSAS will start trimming its cache and start&nbsp;taking some other&nbsp;actions if this&nbsp;value is reached!&nbsp; in my experience, the&nbsp;SSAS will stop accepting new connection when&nbsp;its memory consumption goes above this value. &nbsp;Compared to MS SQL, there is not YET a concept of an administrator connection in SSAS, so if the server decides not to take new connection requests, you are out of luck. (Note: inside our service, we do maintain an open connection, which we call Admin connection, so we can be sure that we can talk to the server, when new connections are NOT accepted.&nbsp; This allows us to perform management tasks if needed.)&nbsp;&nbsp; So when the &ldquo;LowMemoryLimit&rdquo; is surpassed by the current usage, the server will stop accepting new connection; in other word, it will NOT talk to anyone new.&nbsp;&nbsp; It continues to execute its currently running queries, and as far as the outside world is concerned, the service is simply NOT responding &ndash; so the usual approach is:&nbsp;let&rsquo;s kill the process and restart it! Note: Our software handles this condition automatically, by terminating the most expensive queries until the server becomes &ldquo;responsive&rdquo; &ndash; please, see the blog on Resource Governor for SSAS, which we introduced as a concept back in 2004! When the &ldquo;HighMemoryLimit&rdquo; is reached, the SSAS is supposed to start automatically terminating queries&hellip;but the exact details about the server behavior&nbsp;with this setting&nbsp;as well as the &ldquo;TotalMemoryLimit&rdquo;&nbsp;one&nbsp;are not&nbsp;very clear. &nbsp;Anyway, we have in production our software, which successfully prevent the &ldquo;non-responsive server condition&rdquo; and automatically handles it! Put it differently, without our software, the SSAS is restarted multiple times a DAY due to clients complains; with our software, the server is NEVER restarted due to non-responsiveness!&nbsp; So if your server is not responding, most likely it&rsquo;s processing expensive queries&hellip;check your PerfMon counters.&nbsp; &nbsp;&nbsp;</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>&nbsp;</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>Here is an example of when the sever becomes non-responsive but in reality, it simply continues to process the current requests,&nbsp;while refusing&nbsp;new work due to lack of resources. The &ldquo;Active Requests&rdquo; chart show &ldquo;bubbles/requests&rdquo;, which represent current actively-processed requests with diameter representing their duration times (i.e. the bigger, the longer the duration of the request). The drop in the Memory usage below the &ldquo;Limit Low&rdquo; represents our software taking proactive actions and terminating expensive requests until the server is back to a responsive state! Please, notice that we are talking about 900GB of physical RAM; check also&nbsp;the &ldquo;In Use&rdquo; System Memory, &ldquo;Standby Cache&rdquo;, and &ldquo;Free&rdquo; Memory. &nbsp;</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>&nbsp;</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;">&nbsp;</p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"> </p>
    <table align="left" cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td style="border: #000000; border-image: none; width: 48px; height: 0px; text-align: left; background-color: transparent;"></td>
            </tr>
            <tr>
                <td style="border: #000000; border-image: none; text-align: left; background-color: transparent;"></td>
                <td style="border: #000000; border-image: none; text-align: left; background-color: transparent;"></td>
            </tr>
        </tbody>
    </table>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"> </p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><br clear="ALL" />
    </p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>The High and Low memory setting can be changed dynamically without a server restart and as you can see from the snapshot below, the changes will take effect immediately:</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>&nbsp;</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>&nbsp;</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;">&nbsp;</p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"> </p>
    <table cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td style="border: #000000; border-image: none; width: 48px; height: 0px; text-align: left; background-color: transparent;"></td>
            </tr>
            <tr>
                <td style="border: #000000; border-image: none; text-align: left; background-color: transparent;"></td>
                <td style="border: #000000; border-image: none; text-align: left; background-color: transparent;"></td>
            </tr>
        </tbody>
    </table>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"> </p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><br clear="ALL" />
    <span><br />
    <br />
    </span></p>
    </li>
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>Normal Memory with a Query: below is a snapshot of a single query and the IO footprint it causes.&nbsp;&nbsp; Let me point you to the interesting facts.&nbsp; a) The CPU usage is high which most likely means that data is retrieved from the Storage Engine (since it&rsquo;s a multi-threaded data access); b) The &ldquo;System Files/IO&rdquo; chart shows high Logical IO&nbsp;but NO physical IO, which means that&nbsp;the data is coming from the System File Cache and the process memory containing cached data! </span></p>
    </li>
</ol>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><br clear="ALL" />
</p>
<ol style="list-style-type: decimal;">
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>Backup:&nbsp; Below is an example of Memory and IO&nbsp;usage while a Backup is taking place. There are several interesting observations to point out.&nbsp;&nbsp; Let&rsquo;s start with the &ldquo;Stanby&rdquo;(593GBs) and &ldquo;In Use&rdquo;(293GBs) memory in the System Memory chart, and a total of 193GB in "Shrinkable,Nonshrinkable, and Other" memory&nbsp;used by SSAS in the "Usage[GB]" chart. 100GBs are allocated to MS SQL so we get a good match between what&rsquo;s reported at the OS level and at the SSAS level (293GBs vs. 193GBs). &nbsp;&nbsp;At this point, the&nbsp;logical question from an MS SQL&nbsp;professional will be: why only 193GB when the cube is close to 880GBs?&nbsp; Check out the 592GBs of Standby cache; further analysis with the &ldquo;RAMMap&rdquo; tool will reveal that the OS has cached all the SSAS file, and the reported &ldquo;592GBs&rdquo; of Stanby cache is actually used for caching SSAS files!&nbsp;This is very helpful&nbsp;if you need to&nbsp;restart&nbsp;the SSAS instance&nbsp; or reprocess of the SSAS files; the cached files are still cached (i.e. 592GBs) after the restart! Note: another interesting observation is the central chart &ldquo;Logical IO by Process&rdquo; and its neighboring chart &ldquo;System IO&rdquo;. The &ldquo;Logical IO by Process&rdquo; chart displays what processes are causing the Logical IO on the System; hovering the mouse over the chart will give you this dynamic information. In our case, we have SSAS causing the most of the IO (i.e. SQL is the other process on this server, which may be responsible for high IO).&nbsp; The&nbsp;&ldquo;System IO&rdquo; chart allows us to compare the&nbsp;&ldquo;Logical&rdquo; vs. &ldquo;Physical&rdquo; vs. &ldquo;Cached&rdquo; IOs on the system; in this case, we ca see that the Logical and the Physical IOs are overlapping, which is common when we are doing a Backup of the cubes. The Cached IO is of little use in this case. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
    </li>
</ol>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><br clear="ALL" />
</p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<ol style="list-style-type: decimal;">
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>The Famous Storage Engine (SE) vs. Formula Engine (FE) processing times:&nbsp; This is a common topic worth covering.&nbsp; Below are&nbsp; a&nbsp;couple of snapshots&nbsp;with&nbsp;SE and FE queries. Here is a brief review. The first chart represents an SE query. Characteristic: Multi-threaded data retrieval from the storage engine (i.e. higher CPU utilization), high IO, and not much processing of the data (i.e. calculated cells are low!).&nbsp; As you can see, the CPU is relatively high on a 64 CPU system! The Logical IO is also high (even though it&rsquo;s coming from Cache!).&nbsp;&nbsp; The second snapshot represents a FE query.&nbsp; Characteristics: Single-threaded data processing (i.e. Lower CPU utilization), lower IO, and high &ldquo;Calculated Cells&rdquo; count (see Total Cells Calculated/sec)! &nbsp;What is important to point out here is the fact that the SSAS service is using very little physical memory (i.e. Zero = 100Gb Total &ndash; 100Gb SQL usage) and yet, there is NO physical IO on the system! All data is coming mostly from System File Cache!</span></p>
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>&nbsp;</span></p>
    </li>
</ol>
<p style="margin: 0.15pt 0in 0pt;"><span>Storage Engine Query:</span></p>
<p style="margin: 0.15pt 0in 0pt;"><br clear="ALL" />
</p>
<p style="margin: 0.15pt 0in 0pt;"><span>Formula Engine Query:</span></p>
<p style="margin: 0.15pt 0in 0pt;"><br clear="ALL" />
</p>
<ol style="list-style-type: decimal;">
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>Processing Command and Memory Behavior:&nbsp; Below is a snapshot of the SSAS server behavior during multiple-partition processing. Here are some highlights: a) The SSAS process memory usage will drop since most of the cached data and aggregations will be invalidated (note: two Usage charts are placed next to each other to show the change in memory usage). b) the bottom&nbsp;left "Raw Data"&nbsp;chart shows the connection between the number of rows retrieved from SQL and the number of rows processed by the SSAS sever when processing the partitions &ndash; as you can see they match exactly! When you issue a ProcessData/ProcessFull/ProcessDefault command against partitions, the number of SQL/data source/ records will match this counter. When the aggregations are processed, the number of records read from the cube will be shown in the chart next to the right - "Aggregatioins". &nbsp;This will give you a sense of the processing command progress.&nbsp;&nbsp; Note: the software contains the &ldquo;Partition Processing&rdquo;&nbsp;node, which&nbsp;will give you a visual progress on the&nbsp;raw data/records retrieval from the data source&nbsp;as well as estimate completion times. There will be a separate blog on the topic. </span></p>
    </li>
</ol>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><br clear="ALL" />
</p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>The above examples shows some of my observations.&nbsp;&nbsp;&nbsp;How can you draw your own conclusions?&nbsp;&nbsp; We give you the tools to run your own tests.&nbsp; There are a couple of features of our software that can assist you with these tasks. The first one with the &ldquo;Stress Test&rdquo;; it allows you to select queries, parameterize them (optional), and execute them in parallel against the server while watching its behavior (note: there is a separate blog on this task). Second, the &ldquo;Cache Warmer&rdquo; allows you pre-warm the SSAS and System File Cache with commonly used data; the tool also allows you to empty either &nbsp;the SSAS or/and the System File cache, so you can&nbsp;analyze queries behavior under different conditions and scenarios (Note: there is a separate blog on this task)&nbsp; Both features give you the option to empty either the SSAS or/and the System File Cache. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<span>Going back to the beginning to complete the full circle, SSAS relies on the OS to cache the files that are commonly used. To better understand SSAS Memory needs, we need to monitor the Physical IOs, Logical IOs, and Cached Data. </span>]]></description><pubDate>Sun, 07 Dec 2014 23:47:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/memory-analysis-and-caching-in-ssas</guid></item><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[Memory and Disk IO in Windows]]></title><link>http://www.entsoftsol.com/Home/Blog/memory-and-disk-io-in-windows</link><description><![CDATA[<p style="margin: 0.15pt 0in 0pt;"><span>I started writing about analyzing memory usage in SSAS when I realized that I should give some background of my understanding about memory and disk usage in the Windows OS.&nbsp; Hence I decided to split the blog into two. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>Memory is an interesting and common topic. I am going to start it with the famous question &ldquo;Who is going to need more than 64K of RAM?&rdquo;&nbsp; My response is that I am able to cause an OutOfMemory exception on a box with 1TB of physical RAM.&nbsp; Luckily, the operating systems were written when memory was a very scarce resource.&nbsp; As a foreign student, I did not have the right to work off campus so I was making a good 2.50$/hour after taxes.&nbsp; Spending 800$ on 16Mb memory chip from the Gateway outlet was a major investment, which eventually paid off with good dividends. &nbsp;The OS was working with very little memory, attempting to make all the processes happy and satisfy their memory allocation requests. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>So how is memory working in Windows? When a process is started, it sees a flat directly addressable memory space with addresses ranging from 0 to the max of its bit-ness (i.e. 32-bit gives 2^32 or 4GBs; 64-bit gives 2^64, etc.). This means that at any time the process executing code can request the content from any of these addresses. This is also known as virtual address space since in reality there are only a few MBs behind it.&nbsp; So how the OS can trick the process that this space exists?&nbsp;&nbsp; The main smoke and mirrors are Physical Memory (aka Random Access Memory &ndash; RAM) and disk files. &nbsp;There is the concept of Memory Mapped Files (MMF), which basically map disk files into the process virtual address space.&nbsp; What that means?&nbsp; The OS create a map between a starting memory address (say 101) and the first byte of the file; if the file is 50bytes long, then then address 150 will correspond to the end of the file. Every time the process requests the content of an address between 101 and 150, the OS will retrieve the corresponding byte(s) from the file.&nbsp; Hence it&rsquo;s called a map &ndash; i.e. when you request &ldquo;a&rdquo;, it&rsquo;s looked up in the map, &ldquo;b&rdquo; is returned.&nbsp; </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>What is the need for this complexity? There are a few reasons:</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<ol style="list-style-type: decimal;">
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>&nbsp;The OS does NOT have to read the whole file. Have you wondered how a file that is 1GB in size can be opened by some processes instantly, while Notepad chokes on it?&nbsp; The 1GB can be mapped into the process address space, and ONLY what the process need will be requested by the file (with issuing a memory read request which will be mapped back to the offset within the file). Hence, the OS only needs to make an instant metadata entry, creating the map, and the process is ready to access the file. Alternatively, physically reading the file and copying it into memory will take a while&hellip;think Notepad. </span></p>
    </li>
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>The same file can be shared among multiple processes.&nbsp; The same file/or already cached bytes/ can be mapped into multiple processes. A good example is a Terminal Server with a 100 active clients using MS Word.&nbsp; Without the MMF, the server needs to load 100 copies of MS Word binaries; instead only ONE copy is loaded and it&rsquo;s mapped to 100processes. As you can see, this makes a very efficient use of the available memory, not to mentioned excellent performance and user experience. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
    </li>
    <li style="color: #000000;">
    <p style="color: #000000; margin-top: 0.15pt; margin-bottom: 0pt;"><span>The mapped file is used as an extension to the physical memory, to which the process has access.&nbsp; Think of it as a page file (indeed it&rsquo;s an extension the system page file; it uses the same concepts).&nbsp; &nbsp;Instead of loading the file into physical memory, it mapped to the process and can be access as if it was a physical memory. </span></p>
    </li>
</ol>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>Now that we have our 100 TS clients starting MS Word at the same time, what will the OS do? Read a 100 times the same file bytes?&nbsp; It doesn&rsquo;t sound very efficient. Instead the OS uses a buffer using the physical memory (RAM), aka Cache, to store the bytes so it will physically read only once from the disk, cache the bytes and on subsequent requests, it will avoid the need to access the disk.&nbsp; Why avoiding the disk sounds like a big deal?&nbsp; Memory access is a 1000+ times faster than disk access so there is considerable performance difference. (Note: SSD&rsquo;s are shrinking this difference.) &nbsp;The used buffer/cache/ is called File System Cache (i.e. it caches read bytes from files).&nbsp; Since the Cache is using physical memory, at one point the system may decide to take away the physical memory (which may be needed by a process MemAlloc request). Hence it&rsquo;s called &ldquo;Stand-By Cache&rdquo;. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>Let take some of this concept, put them together and map them to the more common terminology used in Windows.&nbsp; The process has Virtual Memory but only some of this memory is actually backed up by Physical Ram or Disk Files.&nbsp; When a file can be mapped to one or more processes, then the memory it consumed is called &ldquo;Shared&rdquo;, since it is NOT specific to the given process.&nbsp; Some of the data is specific to the process; hence it's called "Private". An example will be a user&nbsp;Word document.&nbsp;&nbsp;When the user makes modifications to&nbsp;the&nbsp;document,&nbsp;then the memory, storing the document,&nbsp;is called &ldquo;Modified&rdquo; (as well as Private).&nbsp; The combination of Shared plus Private memory is known as a process Working Set. &nbsp;When a file/bytes/ is requested, it is first checked if it&rsquo;s present in the File System Cache. If it&rsquo;s not found, it is physically read from disk, placed in the Cache, and returned to the process.&nbsp; This is also known as Hard Fault &ndash; when a memory page cannot be found in memory and needs to be retrieved with physically access to the disk.&nbsp; When a requested file is found, then it&rsquo;s returned from the Cache &ndash; this is also known as Soft Fault. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>With this in mind, when analyzing memory, we need to be aware of the flow of bytes in the OS.&nbsp; &nbsp;To summarize the concepts event at a higher level, multiple processes make concurrent requests, resulting in Logical IO. Out of this requests/IO, some of it will be used from the Cache, and some of it will be retrieved from Disk. &nbsp;&nbsp;There are Performance Monitor Counters that can give us the current status of the system. The &ldquo;Process-&gt;Data Bytes/sec-&gt;Total&rdquo; will give you the Logical IO. The &ldquo;Physical Disk-&gt;_Total&rdquo; will give you the Physical IO. The &ldquo;Cache-&gt;Copy Reads/sec&rdquo; (i.e. copy cached bytes into the process address space) will give you the Cached IO.&nbsp; &nbsp;Of course, this is a simplified view of the actual flow but it makes concepts easier to digest. The Internet is full with in-depth analysis of the topics above so feel free to dig deeper. &nbsp;&ldquo;Windows Internals&rdquo; is an excellent book to read on the topic. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>There are also some common topics about configuration options.&nbsp; The &ldquo;3GB&rdquo; and &ldquo;AWE&rdquo; boot.ini option was a hot topic in the 32bit world. When a process is started the OS splits the virtual address into two and it gives 2GB to the user process and 2GB to the kernel.&nbsp; With some application, such as MS SQL server, there was&nbsp; a need to access as much memory as possible, so while 2GB are not enough for the process, the other 2 are sitting mostly unused.&nbsp; The &ldquo;3GB&rdquo; basically tells the OS to give an extra 1GB of addressable virtual memory to the process, and leave only 1GB to the kernel&hellip;but the &ldquo;SAN&rsquo;s&rdquo; came out with their memory hungry kernel drivers and at one point the 1GB of kernel memory was not enough, so there was a need to further tune the memory &ldquo;split&rdquo;&hellip;&nbsp; At the same systems usually has more than 4GB, given than 4GB is per-process, the SQL server need physical memory, which is available but cannot be addressed to the virtual address space limitation of the 32bit OS.&nbsp; Hence, the Addressable Windows Extensions (AWE) was introduced, which basically allowed windows to be created in a process and mapped to physical memory beyond the 4GB boundary using offsets&hellip; Not a new concept, it was heavily used with DOS (Disk Operating System) and the &ldquo;himem.sys&rdquo; file (if anyone remembers it).&nbsp; The topics keep going but alas, most of them are obsolete, the 64-bit OS took care of them.&nbsp; The extra memory also created other issues.&nbsp; I have done over 300 performance tuning labs. When I am asked what equipment I need, I go for the slowest machine with the least resources.&nbsp; This type of underpowered machines makes the performance and other issues appear immediately. So a table scan, a badly written TSQL or MDX, or a memory leak show up pretty early in the stress tests. &nbsp;&nbsp;An &ldquo;IIS&rdquo; worker process will be restarted at 1.3GB of memory usage&hellip;so it was easy to isolate problematic areas and fix them. The introduction of more memory and faster disk drive makes this task very difficult.&nbsp; The OS resource limits were forcing developers to pay more attention to how apps are written and create better apps&hellip;but those days are gone. &nbsp;&nbsp;&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>Now that we know everything about the OS Memory and how it works, let&lsquo;s look briefly at the Disk subsystem. &nbsp;There are a lot of advance topics (i.e. Scatter/Gather Win32 APIs) on how requests are made to the Disk, and more specifically, how to fill up the 64K buffer so it a single request we can get more work done. &nbsp;There are also the concepts of IO queuing and Queue depth. Multiple Performance Monitor Counters further complicate the discussion.&nbsp; Over the year, I found a simple approach to analyzing the Disk IO usage.&nbsp; First, if you have physical access to the server, look at its disk LEDs &ndash; if they blink like a Christmas tree, then there is a very good chance that there is an opportunity for tuning.&nbsp; Again with more memory, a lot of data is cached and the issues are not as easy to spot.&nbsp; Second, check the Disk sec/Read and Disk sec/Write Performance Monitor Counters.&nbsp; They are an excellent indication of how the Disks are performing and whether if they are overwhelmed.&nbsp; This really simplifies the analysis and is very consistent with its results no matter what technology is behind the disk subsystem.&nbsp; The counters represent how milliseconds are needed for single disk IO &ndash; this also matches the disk manufacture definition for disk performance.&nbsp; For disk with spindles: a) for transactional systems: 2-4msec are excellent; 4-10msec is Ok, and above 15-20msec is bad; b) for Decision Support Systems (DSS)/Reporting: 15-20msec is excellent; 25-30 is good; above 50-80msec is bad.&nbsp; These are rough guidelines, which worked for me over the years. </span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>In the spindle-disk world, there are also some other good ideas.&nbsp; The most common one is: &ldquo;How to keep the physical head from moving between tracks?&rdquo; Some of the common answers are: a) don&rsquo;t place files on the same drive that are used in random-access fashion; SQL transaction log placement discussion fits here; b) use only 50% of the disk and use defrag software which pushes the data to the outer rims of the disk (thus achieving maximum performance since the heads are least moved and the most data can physically fit on a track); c) make sure that the disk partitions are properly aligned (W2003 Server and before were creating default partitions with 512byte off the boundary causing misalignment; W2008+ fixed that); Note: our software checks and reports on partition alignments.</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>The Solid State Disks (SSD&rsquo;s) appears was a game changer.&nbsp; In a few months, all the heavy investments in SANs and spindle-based disks were quickly eroded.&nbsp; &nbsp;This technology is far superior and becomes the de-facto standard for the computer/data industry.&nbsp;&nbsp; And again, having faster hardware makes more difficult to optimize systems.&nbsp; &nbsp;</span></p>
<p style="margin: 0.15pt 0in 0pt;"><span>&nbsp;</span></p>]]></description><pubDate>Sat, 06 Dec 2014 15:51:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/memory-and-disk-io-in-windows</guid></item><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[Security in MS Analysis Server (SSAS)]]></title><link>http://www.entsoftsol.com/Home/Blog/security-in-ms-analysis-server-ssas</link><description><![CDATA[<p><span style="color: black;">Software security is one of my favorite topics. Over the years, I have done numerous security reviews with ISVs and Forture-500 companies.&nbsp; My observations are that: a) security is implemented towards the end of a software application/system development; b) there is a lack of security expertise &ndash; perhaps, dev is relying on IT and vice versa, that eventually the topic falls thru the cracks. &nbsp;Anyway, I am going to talk about SSAS security options.</span></p>
<p><strong><span style="color: black;">1) Windows Integrated Authentication:</span></strong></p>
<p><span style="color: black;">Out-of-the-box SSAS supports only &nbsp;Windows Integrated security.&nbsp; Features that are present in MS SQL eventually make their way into SSAS but not with custom security. &nbsp;&nbsp;Windows Authentication requires the presence of a Windows Domain; its Domain Controllers (DC) are the trusted authority (the assumption is that everyone trusts them) and are responsible for handling authentication requests (such as: can you prove to the accessed server that I am who I claim to be with my logon credentials).&nbsp; While this works pretty well in most cases, there are some challenges.&nbsp; The infamous &ldquo;multi-hop&rdquo; authentication is one common example. &nbsp;Before Kerberos, there was (and still is) the Windows NT LAN Manager (Local Area Network Manager, aka NTLM). It was using a challenge-response algorithm, in which the user provides a set of credentials and the server checks if they are correct with a table lookup.&nbsp; The disadvantage of this authentication type is that if the user cannot make more than one jump/hop.&nbsp; &nbsp;For example: a user accesses a web site on one server, the web server (IIS) needs to make a call to a SQL database on another server. In this case, we have two server hops (client-&gt;IIS-&gt;SQL. The NTML does not allow the originating caller identity to be forwarded on the second hop (IIS-&gt;SQL) since it does not know the original password (but rather a hash of it); one exception is the use of &ldquo;Basic Authentication&rdquo; where the credentials are transmitted as base64 encoded strings in the HTTP header; hence the web server knows them and can forward them to the next tier/server.&nbsp;&nbsp; NTML is still in use today; for example: if you have multiple domains that don&rsquo;t trust each other and you need to access servers/resources in them, you can create the same account in all of them and as long as the passwords are synchronized, you can access the resources without a problem. It&rsquo;s a common trick to bypass the non-trusting domain environment but it&rsquo;s also a security concern&hellip;&nbsp;</span></p>
<p><span style="color: black;">Back to SSAS, the engine uses &ldquo;UserName()&rdquo; function to retrieve the currently-connected Window user identity. The function returns a string with the logon and can be used in configuring the SSAS security (not covered in this article). For example: SSAS can be configured that user &ldquo;Ivan&rdquo; has access to &ldquo;East and Central US&rdquo;; the two geo members are assigned to &ldquo;Ivan&rdquo; so when he logs in, the data is automatically filtered for only these two regions.&nbsp; Another way of describing this is that the MDX is adjusted to filter out all but these two regions. &nbsp;Configuring access to individual user can quickly become a cumbersome, labor-intensive, and error-prone task.&nbsp; Hence SSAS supports the concept of &ldquo;Roles&rdquo;, which is basically a &ldquo;group&rdquo; with one or more users. Security is configured for the group, and all its members inherit the security rights and restrictions for the given group.&nbsp; Users can also belong to multiple groups and the security is additive &ndash; i.e. most rights (vs. Windows with least rights) &ndash; a union vs. an intersection of multiple group rights).&nbsp; Configuring the security inside SSAS is usually done thru an extra &ldquo;User&rdquo; dimension, which is related to different fact tables/measure groups/. These relationships are then used to filter the current user and the data that will be returned.&nbsp; For example: Dimension &ldquo;Users&rdquo; contain a member &ldquo;Ivan&rdquo;; &ldquo;Ivan&rdquo; has access &ldquo;East and Central&rdquo; Geo dimension members. When &ldquo;Ivan&rdquo; accesses the cube, the engine will resolve/get his identity thru the &ldquo;UserName()&rdquo; function call and then it will find the Dimension &ldquo;Users&rdquo; corresponding member (i.e. using &ldquo;StrToMeber&rdquo; function) and then it will filter the data for only the two Geo Dimension members.&nbsp;</span></p>
<p><span style="color: black;">SSAS also supports &ldquo;EffectiveUserName&rdquo; connection string option. This option allows for a multi-hop scenario where the service account has elevated privileges and can impersonate the user. &nbsp;SharePoint and PerformancePoint are good examples of using this approach; in my experience, it&rsquo;s very difficult to debug and support these types of installations! &nbsp;&nbsp;The &ldquo;Roles&rdquo; connection string option is another good trick to provide some flexibility in integrating applications; the SSAS client (i.e. usually the web/mid-tier server) can embed the roles that are needed for the current user, and if the connecting account has elevated rights, it can include this option in the connection string, so when the connection is opened, SSAS will ONLY apply the rights given the provided Roles! Both of these two options are commonly used to integrate custom security web apps with SSAS. &nbsp;</span></p>
<p><span style="color: black;">There is much more on the topic but it&rsquo;s well covered in the whitepapers published on the Web.</span></p>
<p><strong>2) Anonymous Authentication</strong></p>
<p>This is the simplest authentication method for SSAS. The engine is told that NO authentication and authorization (A&amp;A) should be performed so anyone is allowed to access any data.&nbsp; The SSAS properties has a configuration option &lsquo;Security\RequireClientAuthentication&rsquo; that can dis/enable the authentication service level.&nbsp; Alternatively, a role can be configured and everyone/guest is make a member of it; the role is then given full access to the cube (i.e. not administrator rights are implied).</p>
<p><strong>3) Custom/Internet Authentication</strong></p>
<p>This type is commonly requested since the industry trend is to push data to the Internet. &nbsp;The basic algorithm for authenticating a user, is to retrieve the credentials in clear text (note: commonly over Securied Socket Layer &ndash; aka SSL used in HTTPS comm channel security), and then for a custom algorithm to do a look-up against a relational database table or a flat file. Example: &ldquo;select * from tblUsers where UserName = &lsquo;Ivan&rsquo; and Password = &lsquo;my password&rsquo;&rdquo;. &nbsp;If a record is return then the user is authenticated/valid. It&rsquo;s a simple implementation and works very reliably.&nbsp; It&rsquo;s worth mentioning that I&rsquo;ve seen a lot of enterprise systems where user inputs are not checked and SQL-injections attacks are possible (for example: if the user name is &ldquo;&rsquo;Ivan&rsquo;--&ldquo; the extra dashes will comment out the password check in TSQL and the password check will be skipped!).&nbsp; This issue has been drastically eliminated over the years.&nbsp;&nbsp;&nbsp; The password should be also stored as &ldquo;salted hash&rdquo; instead clear-text; this will prevent internal employees to access the users passwords in clear text!&nbsp;</p>
<p>Back to SSAS, the engine does NOT support this form of authentication or provided an elegant way to implement it in SSAS.&nbsp; The most common workaround is the use of another connection string option: &ldquo;CustomData&rdquo;, which basically allows the client to pass some text data into the SSAS session it&rsquo;s about to open. An example: Connection.Open(&ldquo;Data Source=SsasServer; Initial Catalog=AW; CustomData=Ivan&rdquo;) &ndash; when the connection is established, the MDX &ldquo;with member [User] as CustomData() select [User] on 0 from [MyCube]&rdquo; will return &ldquo;Ivan&rdquo;.&nbsp; The &ldquo;CustomData()&rdquo; call returns the information that was passed from outside SSAS and can be used while configuring the SSAS security.</p>
<p>A step further is to use SSAS stored procedures (SP) to extend the functionality of SSAS.&nbsp; &nbsp;A popular common approach is to use such an SP, which in turns calles into a SQL database and passes either the UserName() or CustomData() outputs.&nbsp; The SQL calls retrieves a set of members from a table and returns it back to SSAS, which in turn uses the &ldquo;StrToSet()&rdquo; function to resolve the output set in Dimension Members and use them for filtering.&nbsp; This is a very effective way to provide DYNAMIC security &nbsp;in SSAS; a change in the SQL table records will immediately result in different security inside SSAS! &nbsp;There are a couple of caveats to watch out for with this approach.&nbsp; First, the security stops working one in a while; luckily the returned SSAS data is empty so there is no security breach. The setup needs to be reset to get it going.&nbsp;&nbsp; Second, if your are an SSAS administrator, the whole model is bypassed, which makes it difficult to test and troubleshoot. &nbsp;Also, watch out which stored procedure is being called: SSAS or SQL, use proper naming of the procs!</p>
<p><strong>4) External SSAS Authentication &nbsp;</strong></p>
<p>Enterprise Software Solution invented another way of doing SSAS security.&nbsp;&nbsp; I haven&rsquo;t seen anyone in the industry doing this approach.&nbsp; Basically, the incoming MDX requests are intercepted and modify to include an extra filter, which limits the sub-cube space for the current user and then performs the request.&nbsp; The SSAS server does not know anything about security.&nbsp; The advantages of this approach is that the security is dynamic, there are no disruptions of service mentioned in 3) above, and the solution is easy to support and debug (i.e. it&rsquo;s not a black box running MS compiled DLLs). &nbsp;&nbsp;Another major advantage is that Caching is OPTIMAL with the server since all the request are coming from the same user and there is no reason for creating multiple caches!</p>
<p>Our product, &ldquo;BI Portal&rdquo;, is a solution, which supports all of the above security authentication models. All the components, needed for the various models, are included.&nbsp;&nbsp; The &ldquo;BI Portal&rdquo; also takes it a step further with its Single-Sign-On feature for SSRS, SSAS and SQL. &nbsp;&nbsp;The user needs to login only once, and then his/her security identity flows thru SSRS, SSAS, and SQL. &nbsp;Please, see my &ldquo;SSAS Security&rdquo; blog under the &ldquo;BI Portal&rdquo; category.</p>]]></description><pubDate>Fri, 05 Dec 2014 13:04:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/security-in-ms-analysis-server-ssas</guid></item><item><dc:creator><![CDATA[Constantin Ivanov]]></dc:creator><title><![CDATA[What is MS Analysis Server (SSAS)?]]></title><link>http://www.entsoftsol.com/Home/Blog/what-is-ms-analysis-server-ssas</link><description><![CDATA[<p><span style="color: black;">Most people are familiar the relational database concepts so naturally, they try to leverage their existing knowledge while learning about another-type of database engines.</span><span style="color: black;">&nbsp;</span></p>
<p><span style="color: black;">In general, the enterprise-accumulated data (aka data warehouse) is&nbsp; mostly used for reporting.&nbsp; The business reporting needs are usually around some sort of aggregation of data. For example: &ldquo;how much were our sales yesterday?&rdquo;.&nbsp; To answer this inquiry, we filter the sales records for yesterday, and we ask that the engine adds up the resulting records individual values and give us a total.&nbsp; In T-SQL code: &ldquo;select sum(Sale) from tblSales where Time = &lt;yesterday&gt;&nbsp;<strong>group by</strong>&nbsp;Time&rdquo;.&nbsp; &nbsp;</span></p>
<p><span style="color: black;">&nbsp;</span><span style="color: black;">So if a relational engine can do it, why do I need SSAS?&nbsp;&nbsp; Here are a few reasons:</span></p>
<p><span style="color: black;">&nbsp;</span><span style="color: black;">1) TCO (Total Cost of Ownership) -&nbsp; The reporting requirements change frequently so the end user may ask that the yesterday totals are broken down by product category.&nbsp; The existing report either&nbsp; needs to be adjusted or a new one will be created. In either case, an expensive technical expertise is required.&nbsp;&nbsp; As soon as the new report is ready, a new requirement may come &ndash; perhaps, &ldquo;totals further needs to be broken down by Employee&rdquo;&hellip;which turns into a never-ending queue for change requests. On top of that, the number of reports explodes in time, which results in high support/ownership/ costs while their usefulness becomes doubtful.&nbsp; With SSAS, the end user can slice and dice the data with the PC mouse on their own, without the need for technical expertise.&nbsp; In other words, a static report becomes dynamic and the end user can control what it displays. Note: the SSAS contains metadata (data describing data) so all the relationships between the different tables/data are published and known; this allows for the end user interactively select objects and include them in the report. &nbsp;</span></p>
<p><span style="color: black;">&nbsp;</span><span style="color: black;">2) Single Version of the Truth &ndash; Creating a single database allows for centralized reporting. Eventually, everyone agrees with the numbers and there is a consistency in the reported data.&nbsp; Alternatively, different departments run their own reports and the numbers usually do not match. A good example is the sales department want to boost the numbers for higher commissions, while the accounting departments want to lower them to keep cost in check.&nbsp; A relational database can also provide this service, which leads us into the next reason.</span></p>
<p><span style="color: black;">&nbsp;</span><span style="color: black;">3) Data Volumes &ndash; with disk storage becoming ridiculously low, data collection and volumes have exploded in recent years. It&rsquo;s not uncommon these days do discuss Terabytes or Petabytes of data. Relational engines are very powerful but even with their pre-aggregation features, they cannot scale well beyond a certain point when it comes to ad-hoc querying and processing of large volumes of data. It doesn&rsquo;t take much for one user to mistakenly query a non-indexed columns on an extremely large table and bring even the most power servers down to their knees.&nbsp; SSAS solves the scalability challenge with features such as data partitioning, pre-aggregations, extremely power aggregation engines, and more.&nbsp; MS SQL engine also has some of those features but it doesn&rsquo;t scale as good plus it&rsquo;s not as easy to create ad-hoc reports (addressed in (1) above).</span></p>
<p><span style="color: black;">4) MDX (Multi-Dimensional Expressions) Language &ndash; T-SQL (Transactional Structured Query Language) is used for querying relational data. MDX is used for multi-dimensional data. MDX is much more powerful language for data analysis.&nbsp;&nbsp; For example: with MDX, it&rsquo;s easy to perform Year-Over-Year comparison, Year-To-Date aggregations, Last Period, hierarchy navigations, member references, and much more.&nbsp; The equivalent requests in TSQL have a tendency to be very challenging to implement and usually result in very slow execution times and expensive server resource usage.</span></p>
<p><span style="color: black;">&nbsp;</span><span style="color: black;">In summary, MS Analysis Server can give you scalable ad-hoc reporting for anyone who knows how to use the PC mouse (aka self-service BI).</span></p>
<p><span style="color: black;">Note: SSAS is a different engine from MS SQL.&nbsp; Since Microsoft packaged them together, it&rsquo;s a common misconception that they are the same engine( or very close).&nbsp; With the popularization of SSAS, I&rsquo;ve seen quite a few times for existing MS SQL DBAs/DEVs to inherit the responsibility of developing and supporting SSAS deployments.&nbsp; Due to the difference in the engines and the complexity of the SSAS, this decision should be carefully considered before it&rsquo;s made. &nbsp;</span></p>]]></description><pubDate>Fri, 05 Dec 2014 11:30:00 GMT</pubDate><guid>http://www.entsoftsol.com/Home/Blog/what-is-ms-analysis-server-ssas</guid></item></channel></rss>