AnsweredAssumed Answered

PI API performance vs PI SDK

Question asked by BjørnOlav on Dec 20, 2017
Latest reply on Dec 22, 2017 by BjørnOlav

We're currently doing a pilot project to decide whether to base our data polling on using the API or the .NET SDK.

Our initial results indicate a huge performance gain using the SDK with a 1:10 gain.

 

When polling from the API we use

//url: https://pi_webapi/piwebapi/streams/P08H9Krknbh0ymdssBHK29FgUA0AAAUElfREFcS1ZJTC5BR0cxLkcxLk1WLk1fSQ/recorded?startTime=2… 
//reducing bandwidth by selectedFields=Items.Timestamp;Items.Value;Items.Good
//maxCount=1000, we concatenate results over 1000
//results are json deserialized
var response = await _client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
   var result = await response.Content.ReadAsAsync<T>();
   return result;
}

 

When polling from the SDK we use

PIPoint myPoint = PIPoint.FindPIPoint(staticPIServer, tag);
if (myPoint != null)
{
   var data = myPoint.RecordedValues(new AFTimeRange(start, end), AFBoundaryType.Inside, null, false);
}

 

Is our approach to using the API wrong?

 

Best Regards,

Bjørn Olav

Outcomes