AnsweredAssumed Answered

PIWEBAPI - Batch Call - Python - Parallel Queries

Question asked by catronro on Mar 31, 2020
Latest reply on Apr 30, 2020 by gregor

I am trying to achieve some level of parallelism in my piwebapi queries

 

After reading this paper: https://pisquare.osisoft.com/docs/DOC-4101-best-practices-and-performance-improvement-for-pi-web-api-requests 

 

It mentions: “Additionally, with Batch requests, the PI Web API is capable of optimizing non-dependent sub-requests in the body of a batch controller call to run in parallel, so it can process multiple sub-requests simultaneously if they don’t depend on one another.”

 

Based on the above i implemented the batch request as follows:

 

{0: {

'Method': 'GET',

'Resource': 'https://piweb.fmi.com/piwebapi/streamsets/interpolated?webid=F1DP7echJM4IN0KyMxoc1jKFhwPBQAAATU9SUElcSUlDMzExNV9QVg&starttime=3/6/2020 00:00:00&endtime=3/7/2020 16:00:00&interval=1s'},

1: {

'Method': 'GET',

'Resource': 'https://piweb.fmi.com/piwebapi/streamsets/interpolated?webid=F1DP7echJM4IN0KyMxoc1jKFhwPxQAAATU9SUElcSUlDMzExNl9QVg&starttime=3/6/2020 00:00:00&endtime=3/7/2020 16:00:00&interval=1s'},

2: {

'Method': 'GET',

'Resource': 'https://piweb.fmi.com/piwebapi/streamsets/interpolated?webid=F1DP7echJM4IN0KyMxoc1jKFhwB7IAAATU9SUElcQ1IwM19JSTAwMzEwX1BW&starttime=3/6/2020 00:00:00&endtime=3/7/2020 16:00:00&interval=1s'},

3: {'Method': 'GET',

'Resource': 'https://piweb.fmi.com/piwebapi/streamsets/interpolated?webid=F1DP7echJM4IN0KyMxoc1jKFhwQbIAAATU9SUElcQ1IwM19USTAwMzEwR19QVg&starttime=3/6/2020 00:00:00&endtime=3/7/2020 16:00:00&interval=1s'}

}

 

When I test this call performance compared to just looping through 4 independent streamset calls i get performance within 2 seconds of each other. Which is unexpected if the batch call is truly parallelizing the calls.

 

Is there some parameter i need to set in the call to get batch to parallelize the calls? Perhaps there is a main setting in the API itself i need to check?

 

Thanks!

 

Outcomes