AnsweredAssumed Answered

Performance RecordedValue unsatisfying

Question asked by Dries.Verhees on Dec 8, 2016
Latest reply on Dec 13, 2016 by Dries.Verhees

Dear all,


I am optimizing the performance of my application and I noticed that almost all the time is spent in an AF SDK call.

In order to investigate it further, I have implemented a console application.


The console application first selects the AF attributes:


AFSearchToken elnToken = new AFSearchToken(AFSearchFilter.Name, AFSearchOperator.Equal, "RT_Data");

AFElementSearch search = new AFElementSearch(afDatabase, "", new List<AFSearchToken> { elnToken });

var elements = search.FindElements();

var attributeList = new AFAttributeList();

foreach (var element in elements)


      var attribute = element.Attributes["Oil Rate"];



Console.WriteLine($"{attributeList.Count} attributes selected");


This is working fine and fast. There are 18 attributes selected. All these attributes are configured as PI Point on the same PI server. For some of the attributes, the tag does not exist on the PI server.


Once I have the list available, I request one raw value per attribute.


AFTime afTime = new AFTime(DateTime.Now.Date.ToUniversalTime());

Console.WriteLine($"Time: {afTime.LocalTime}");

Stopwatch stopWatch = Stopwatch.StartNew();

var data = attributeList.Data.RecordedValue(afTime, AFRetrievalMode.AtOrBefore);


Console.WriteLine($"Elapsed time: {stopWatch.Elapsed.TotalMilliseconds} ms ({data.Count} values)");



The first data call takes about 10 seconds. The next calls are taken about 1 - 5 seconds. (only attributeList.Data.RecordedValue is measured)


I am using the following versions:

  • AF SDK:
  • AF server:
  • PI server: 3.4.405.1198


I have the feeling that 10 seconds (and even 4 seconds) is unacceptable for only 18 recent data points, but I am trying to find the cause.

Can anyone point me in the right direction?