sraposo

Asset Analytics Best Practices - Part 1: Use Variables

Blog Post created by sraposo on Mar 21, 2019

Asset Analytics Best Practices Blog Posts:

In the upcoming months I will be publishing several blog posts on different Asset Analytics best practices.

 

The goal of these blog posts is to help prevent customers from falling into common pitfalls that lead to poor performance of the PI Analysis Service. This will be done by:

 

  1. Increasing the visibility of the PI Analysis Service Best Practices knowledge base article.
  2. Providing concrete examples that show why it's important to follow our best practices.

 

To show the performance of various setups, I will be using the logs of the PI Analysis Processor (pianlysisprocessor.exe) with the Performance Evaluation logger set to Trace. If you are not familiar with the logs, loggers and logging levels, more information can be found in our documentation here. Alternatively, there is also a full troubleshooting walkthrough video on Youtube here. The video shows a troubleshooting approach using the PI Analysis Processor logs, it does not however go over best practices.

 

Asset Analytics Best Practices - Part 1: Use Variables

 

Consider the following Analysis:

 

Analysis Name: RepeatingFunction

 

This Analysis is poorly configured. If you notice, the function TagMax() with the same input attribute and same input time span is used 5 times! Consequently, this function will be evaluated 5 times in the analysis. It would be much more performant, to only evaluate this function once and refer to the result when needed. This can be done using Variables!

 

For example, same logic as above, but using a variable:

 

Analysis Name: Non_Repeating_Functions

 

Now you might be asking yourself "how important is the difference between the two examples"? We can answer that question by looking at the Performance Evaluation logs with Trace set.

 

Here is one instance of these analyses being evaluated:

 

2019-03-20 00:10:24.2305|TRACE|ANPerformanceTrace:PerformanceEvaluation|Type: AnalysisEvaluated, Data: {

"AnalysisName": "\\\\AFSERVER\\PISquare_Blog\\Element1\\Analyses[Non_Repeating_Functions]",

"AnalysisId": "ea361f82-4a84-11e9-9149-001ddab729f5",

"GroupId": "65bc6d2e-b817-4da1-ad3f-49d87363a78b",

"TimeclassId": "2bd79cda-02a9-4718-b403-5b6e90fb46c8",

"Status": "Success",

"ExeTime": "2019-03-20T04:09:49Z",

"Detail": "",

"ElapsedMilliSeconds": 5.0426,

"LagMilliSeconds": 5150.3599

}

 

2019-03-20 00:10:24.2594|TRACE|ANPerformanceTrace:PerformanceEvaluation|Type: AnalysisEvaluated, Data: {

"AnalysisName": "\\\\AFSERVER\\PISquare_Blog\\Element1\\Analyses[RepeatingFunction]",

"AnalysisId": "6ad221b9-4a84-11e9-9149-001ddab729f5",

"GroupId": "65bc6d2e-b817-4da1-ad3f-49d87363a78b",

"TimeclassId": "2bd79cda-02a9-4718-b403-5b6e90fb46c8",

"Status": "Success",

"ExeTime": "2019-03-20T04:09:49Z",

"Detail": "",

"ElapsedMilliSeconds": 33.8356,

"LagMilliSeconds": 5179.3228

}

 

ElapsedMilliSeconds: Approximate amount of time it took for the PI Analysis Service to evaluate (calculate) the analysis.

 

The analysis with the repeating function took ~6 times longer to evaluate in my system. You may be telling yourself, even though it's slower, it's still only takes about 34ms to complete which isn't much and this isn't a problem.

 

However, what's extremely important here is to think about scalability! If the RepeatingFunction analysis was based on an analysis template and there were hundreds or thousands of other analyses based on the same analysis template, the performance difference at the group level (all analyses based on the same template) would be on the order of seconds, perhaps even minutes.

 

We have seen numerous PI Analysis Service performance cases that could have been avoided if this best practice had been followed!

 

If you are reading this and you know some of your analysis configuration could be improved by using variables, don't wait to reconfigure!

Outcomes