5 Replies Latest reply on Jan 8, 2018 8:33 PM by sraposo

    WEB API performance problems


      Hi all,


      i received a project to create a website that uses the PI WEB API to communicate with the PI System. I finished this project succesfully but now the customer complains about the bad performance. It needs sometimes up to 1 minute for one request to PI WEB API. PI Vision has also a bad performance sometimes depending on the time.

           - CPU load ist by default at 10 %.

           - Website runs on the same system as AF.

           - Website can read and create event frames.

           - At certain times it only takes a 3 - 4 secondes for a request.

           - Request without PI WEB API takes 1-2 secondes.


      Does anyone have any idea how i can solve this problem?


      Thanks for you help,



        • Re: WEB API performance problems

          Hi Andre,


          Thanks for reaching out to us on PI Square! Generally, I find performance issues tricky to track down so I would recommend contacting our Tech Support directly and opening up a case.


          That being said, a good first step to diagnosing performance issues with the PI Web API is to use Google Chrome's Developer Tools to analyze the requests. If you take a look at one of requests in the Network Tab and select Timing sub-tab you should be able to find a breakdown of the time usage for that given request, such as the below:



          If you see a high amount of time spent on "Waiting (TTFB)", then it means the browser is waiting on a response from the PI Web API. This could be due to network latency between machines and/or the PI Web API machine being highly taxed. So I would check your ping between the machines and see if this can be reduced and the network shored up as well as the CPU/RAM usage on the PI Web API node and see if this may need to be upgraded to handle the amount of requests no that your application is stood up.


          If you see a high amount of time in "Content Download", then you may be able to improve the performance here by using the selectedFields category to reduce the size of your requests and thus the encoding/decoding/download time of them (it will also ease up on the resource usage by the PI Web API service).


          One more thing I would recommend looking at is if you can use Batch requests to reduce the back and forth between the browser and the Web API node. You can find some resources on this topic here and here.


          Again, I would recommend opening up a tech support case, but hopefully the above can get you started on the process.




          2 of 2 people found this helpful
          • Re: WEB API performance problems

            Hi Andre,


            In addition to Robert Schmitz suggestions, can you provide the following information? As Rob said, going to Tech Support would speed up the resolution.


            Which version of the PI Web API are you running ?


            How much data is retrieved by a user using the website in 1 request? How many event frames, how many attributes, what's the time range?


            If a user creates event frames, how many event frames can they check in by request?


            Also, what's the total number of Event Frames in this customers AF Server? You can see this information in PI System Explorer > Server Properties > Count ?




            • Re: WEB API performance problems

              As long as your PI Web API server has more than 1 processing core, the following should improve PI Web API performance.


              From the PI Web API installation folder, open the PI Web API configuration file, OSIsoft.REST.Host.exe.config. Typically, the PI Web API installation folder is C:\Program Files\PIPC\WebAPI.


              Edit the runtime element to include the child element gcServer with the enabled attribute set to true, as shown in the following example.

              <?xml version="1.0" encoding="utf-8"?>
              <gcServer enabled="true"/>
              <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

              • Re: WEB API performance problems

                Robert Schmitz you where right "waiting ttfp" need most time, CPU/RAM usage has never more than 20 %, network usage is at 0,2% last 24 hours, ping is under 1 ms.

                It is possible to specify the problem in more detail.

                     IIS, AF and PI WEB API are on same server.

                Sebastien Raposo

                     - PI Web API is 2017 Version

                     - 1 Request returns ~20 event frames (filtered by Template at request) needs up to 15 sec

                          another request has 20 different requests to Web API and it needs nearly same time may one or two secondes longer.

                     - Default time range is about last 6 months. Same request time for shorter ranges

                     - Event frames count is now at 17.000