3 Replies Latest reply on Sep 13, 2017 2:32 PM by Jagan

    PI Analysis service performance


      Hello everyone,


      I would like to ask about PI Analysis service performance.

      We have quite big AF structure (overall ca. 120k elements). We have 2 same analyses in 16k elements, first is a simple event frame with trigger based on boolean value, second is a expression analysis, checking data quality (EventCount function).

      PIAnalysisProcessor uses around 3 gb RAM doing this. Is it normal performance. Is it possible to dicrease memory usage? Could someone describe how it works.



        • Re: PI Analysis service performance

          Hello Dawid,


          Quick answer

          You should give analysis service as much memory it needs.  This is normal and it will make it run smoothly over time.


          Long answer

          It is to be expected that PI analysis Service will use a lot of RAM for several reasons.  The main goal being to optimise performances of calculations.

          • When the analysis service is starting, the AF Elements are loaded in memory and will stay loaded until service is started.  That should be the first memory peek you see.
          • When it runs, as new data comes in the system or gets loaded by the calculations, the data is kept an instance if the AF SDK cache.


          For the first point, there is nothing you can do about it - (Except perhaps loading less elements=less calculations)

          For the second, the cache settings may affect the memory usage, however I would like to warn you about side effects if you change the cache settings:

          • If you reduce the cache time span or the number of events it contains, this may affect the calculation performances of the PI analysis service ( you may start having calculations queuing in the system, waiting to receive data from the analysis service. )
          • This could also make the PI Data Archive work harder because your calculations wont hit the cache anymore and will ask for more data to the PI Data Archive.


          You should also be careful with functions such as EventCount function over a long time range.  This can be expensive if the data is not in the cache.


          Settings, including cache settings, for the PI analysis Service are explained here:

          Analysis Service Configuration


          How to configure the cache ?

          • You should make sure that your cache has a CacheTimeSpanInMinutes with a duration that covers your calculations time range. e.g. when you calculation triggers, it it go look for the past day of data you should make sure the duration of the CacheTimeSpanInMinutes is one day at least.  
          • Make sure that the MaxCacheEventsPerAttribute value is sufficient to contain all events for the CacheTimeSpanInMinutes period.  e.g. if you receive CacheTimeSpanInMinutes  and your are making CacheTimeSpanInMinutes calculations, if you want the cache to be leveraged properly you should set CacheTimeSpanInMinutes  to 1440 (1day) and MaxCacheEventsPerAttribute to 8640.


          Of course depending on your system performances and load, you may not see a big difference when changing this.  But  I would highly recommend that you monitor the PI Data Archive and your PI Analysis Service performances if you are doing changes on these settings, to ensure you are not making things worse:


          For PI Data Archive, you should keep an eye on the following performance counters:

          • \PI Archive Subsystem\Events Read/sec
          • \PI Snapshot Subsystem\Snapshots/sec


          For the Machine where the PI Analysis Service is running:

          • \PI Analysis Service\Cache Hit Count
          • \PI Analysis Service\Cache Miss Count
          • \PI Analysis Service\Events Cached
          • \PI Analysis Service\Evaluation Count --> you can create a formula to divide per interval in seconds that the formula is calculated.  This will give you the number of evaluations per second.


          Let us know if you have questions,

          4 of 4 people found this helpful
          • Re: PI Analysis service performance
            Roger Palmen

            To ask a simple question, is 3Gb a problem? Sounds ok given the size of the AF structure.

            • Re: PI Analysis service performance

              I just overcame high memory consumption problem with  “PIAnalysisProcessor” after few weeks of working so here is my thoughts.

              See if your analysis have Periodic or Event triggered settings. If they have event triggered option, then check how often the input parameters are changing. For example if the input parameters are getting new values for every second then that means, 32K Analyses are trying to execute for every second. If this is the case then try changing them to periodic and for example you may start with 30 minutes interval and see the memory usage. If everything is ok then you may decrease that interval further and watch the memory usage. Also from the Management tab, look for analysis which are in Error state and try to fix the errors and reduce the number of Analysis in Error state if any. And then also looking at C:\ProgramData\OSIsoft\PIAnalysisNotifications\Logs\pianalysisprocessor-log.txt log file might provide some useful information.