4 Replies Latest reply on May 3, 2018 9:12 PM by arosenthal

    PI Web API accessing data from table with manual refresh cache

    arosenthal

      I am trying to use the PI Web API to access data from a table, where the table is configured with a manual refresh cache interval and is linked to a query in an external database. I have found that sometimes that data will not get refreshed for a very long time when requesting via the PI Web API, even though I can see the updated data in PI System Explorer.

       

      Has anyone else experienced this issue? So far the only solution has been to set the cache interval to something small like 1 second.

        • Re: PI Web API accessing data from table with manual refresh cache
          vkaufmann

          Hi Aaron,

           

          Can you let us know what you mean by a very long time? What does the behavior look like if you send no-cache control headers in your request?

           

          --Vince

            • Re: PI Web API accessing data from table with manual refresh cache
              arosenthal

              Hi Vincent,

               

              By a very long time, I mean the data in our web application that uses the PI Web API was not updating for more than 24 hours (and counting), but PSE was showing updated data.

               

              We are not using no-cache because we are using the batch controller for bulk requests. My understanding is that by default cache control headers are disabled for the PI Web API, and enabling them is not advised because of performance issues.

                • Re: PI Web API accessing data from table with manual refresh cache
                  vkaufmann

                  Hi Aaron,

                   

                  You are correct about the implications of enabling the use of no-cache but I would want to at least know the behavior. Is all the data you are retrieving coming from AF tables? Is any other data in your query stale?

                   

                  --Vince

                    • Re: PI Web API accessing data from table with manual refresh cache
                      arosenthal

                      I will switch back to manual cache to try to reproduce it and see if no-cache fixes it.

                       

                      The setup we had was:

                       

                      • Linked external table with manual refresh cache interval
                      • Multiple attribute Table Lookup Data References into this table
                      • New results were being populated in the source database, which should have resulted in the attribute values being changed

                       

                      Also, we have two PI Web APIs running, one with Kerberos enabled (primary) and the other with Anonymous authentication (secondary). The problem we had only occurred on the secondary, so I think the problem maybe has to do with the cache not being released on the Windows service account that the secondary API is using.

                       

                      I was able to confirm the following:

                       

                      • Accessing the table data in PSE showed updated results
                      • Accessing the attribute data in PSE showed updated results
                      • Accessing the raw table data with the PI Web API table endpoint
                        • did not show updated results on the secondary API
                        • showed updated results on the primary API
                      • Accessing the attribute data with the PI Web API stream endpoint
                        • did not show updated results on the secondary API
                        • showed updated results on the primary API