PI AF SDK vs. PI Web API for writing many values to PI Data Archive?

We're preparing for a custom development project to pull data from an external Web API and write it to PI. To write to PI, we can use the PI Web API or PI AF SDK.

 

I recall hearing that the PI AF SDK is generally better at writing large numbers of values to PI. I'd like to understand how much better the AF SDK is in this regard. In our case, this program might write 1,000 values at a maximum interval of 5m. It would be easier for us to use the PI Web API for this, so I'm trying to weigh whether using the AF SDK is worth the trouble.

 

  • How many tags are associated with the 1000 values? 1000?

    Are you using an AFDatabase? If so, how many AFElements are being used?

  • Yes, each value would be written to a different tag.

    Whether we write directly to PI Points or to AF Attributes is a pending design choice. I suspect we will have a preference for the latter.

  • Hello ​ ,

    PI Web API is an AF SDK application which means, when you use PI Web API, you use AF SDK plus the PI Web API layer on top of it. The performance, however should be at a similar level than with AF SDK or with other words, I do not expect you to run into any performance issues with 1k writes each 5 minutes. This is far below the performance that I have experienced.

    As long as AF Attributes are configured with the PI Point Data Reference you will be ok. There is certain limitations with other Attribute types like static Attributes, or Attributes using the Table Lookup Data Reference or a Custom Data Reference.

    We refer time series data calls as "bulk calls" if there is multiple data items involved. Bulk calls are known to offer better performance as they simply reduce the impact of network latency. With PI Web API the "normal" data operations are offered by the Stream Controller. The actions offered by the StreamSet Controller are considered bulk. StreamSet UpdateValuesAdHoc may be a good fit for your use case.

    To interact with Streams, you need to know their WebIDs. You can either obtain those through PI Web API or generate them client side. By generating WebIDs client side e.g. based on path information (as path-only WebIDs) you avoid additional requests through PI Web API. Because WebIDs are rather static and the WebIDs you obtain from PI Web API are usually of type Full (please refer WebID type), you should be ok when reading the required WebIDs at application start and cache them while you application is active.