6 Replies Latest reply on Jan 3, 2019 8:25 PM by sraposo

    Finding How Many Times an Analysis Has Run Over the Past Day


      Hi All!


      I have a group of PI AF Servers that have a large number of analyses running on them. As we've been creating more and more analyses, we've begun running into performance issues from time to time. What I've noticed is that it's not just the number of analyses that seem to be giving us problems - an even bigger problem seems to be computationally expensive analyses that are being executed way too often. In many cases, these are analyses that are event-triggered based on inputs that are populated by other analyses. So we sometimes end up with a "domino effect" of inputs that cause analyses to be executed far too often.


      So I'm trying to track down which analyses may getting hit the hardest by this. I've written a PowerShell script that uses AFSDK to inspect every analysis in on an AF Server that and tell me two things about each:

      1. How long an analysis takes to run. For this, I've been measuring how long Analysis.AnalysisRule.Run() takes to execute.
      2. How often an analysis has executed over the past day. I have not found a good way to do this so far. Essentially, I look for the trigger inputs and I estimate how many times the analysis should have executed based on the timestamps of each of their recorded values. I'm especially having a hard time doing this for Rollups, for which the AnalysisRule and the TimeRule property don't seem to provide much information about when these analyses are executed.


      Based on how System Explorer operates, I feel like there's a clean way of getting both of these pieces of information for each analysis with AFSDK, but it has been eluding me so far. Does anyone have any ideas how I could go about programmatically finding this information?

        • Re: Finding How Many Times an Analysis Has Run Over the Past Day
          Dan Fishman

          I want suggest an alternative.

          It is hard to emulate the behavior of analysis service since there is quite a lot of logic under the hood governing when analysis trigger based on evaluation delays, dependencies on other analysis and timing of the data.  With that said, you probably will be relatively close to the actual behavior.  Also, the data cache can play a very significant role in performance.  An alternative to trying to estimate the statistics is to use the actual analysis services statistics that can be obtained from right clicking on the right side when in the PI System Explorer management tab.  You can save the analysis statistics to an XML file and extract the data and use the GUIDS to lookup analysis and make it more human readable.  I'm not if an AF SDK method exists to obtain the service statistics and even with them they are hard to understand. 

          3 of 3 people found this helpful
          • Re: Finding How Many Times an Analysis Has Run Over the Past Day

            Hi Zachary


            In PI system explorer --> Management--> Right Click and select view Analysis Service Statistics (Operation pane)  which gives an overview of all Statistics related to AF analysis. EvaluationStatistics in Service details provides the timelag between current and pending analysis. EvalutionStatisticsforCalculationGroups for pending analysis.


            To Monitor you can create performance counters for Analysis





            1 of 1 people found this helpful
            • Re: Finding How Many Times an Analysis Has Run Over the Past Day

              Hi Zachary,


              We have an internal tool we can share with customers to visualize the service statistics. This tool is NOT an official OSIsoft product, but we can give it to you via a Tech Support case. With the tool you can easily see the trigger ratio of analyses (Elapsed Evaluation time / Triggering Frequency) which is the most informative statistic to determine how well an analysis is performing. You can also see the Elapsed Evaluation time and triggering frequency in milliseconds to determine if an analysis is taking exceedingly long to evaluate or triggered too frequently. The tool is an interactive tool with a UI. I understand you were looking for a programmatic perhaps automated solution, but in most cases this tool is sufficient to resolve performance issues.


              We don't expose these statistics in the AF SDK, Our development team is aware customers are interested in doing this.


              Please message me if you are interested in the tool and I will create a support case and provide you with the tool.




              1 of 1 people found this helpful