Dire Warning # 1 for ALL REST API (non local data) users - read this

I read almost 100% of forum posts (which is a bear if you get a day or two behind!).
A credit and a curse to AG is the qty of non-programmers who want to use the tool… but this applies to both groups because until you are aware of this it can bite you in the behind.

Sorry for those of you who know this, but I feel its important enough for many users. (And may even apply to local storage/in memory DB users - don’t use AG that way so I have no idea.)

When you setup a Data Variable, by default, that thing builds a refresh loop to hit your endpoint EVERY 5 SECONDS. And thats for EVERY DV you create. If on Page 1 you show a list of Customers, then click on a Customer and go into Past Orders (Page 2), then even while you are on Page 2, it is refreshing your Customer list every 5 seconds. Now add a new order on Page 3 and the DVs on Page 1 -AND- Page 2 are still refreshing. And on and on.

The problem is you don’t see this - you don’t notice it - the only thing happening is wasted bandwidth in the background and potentially hitting Max Requests per minute on Xano, for example… or depending on your backend, wasted hits from your monthly allotment. Multiply this by all the users using your app and its a big waste and potentially an impact on your server.

I know that for non-programmers it seems like a design decision on AG’s part to do this refresh for you. That way you make a change and Voila, like Magic, your data is refreshed. But this comes at a cost.

I’m using my own built nodeJS backend against a production MSSQL database - thousands of erroneous hits can affect my production users. Now I know about this “gotcha”, but even this week I created a new screen with several DVs and forgot to clean up one. I only saw this as I watched my nodeJS console and when there was no activity in my app, I was getting a hit every 5 seconds. Most of you won’t see this which is why I say you’ll have no idea.

Hope this helps someone.
Jaymer…

2 Likes

Hello Jaymer,

interesting post, I wonder why nobody responded.

Anyway, I am running into massive performance problems with all local data sources and lots of Data Variables. Do you think this could be a source of the non-performance? Is there any way to break the refresh loop off? I would want to refresh only when the page is (re)displayed if that improves the speed.

I am gonna try to undo the loop in the DV setup, see if that improves the speed.

Greetings,
Christian

Take a screenshot so that the community can help you. Since there are different loops depending on how the app is designed.

Loops are no longer a default feature when implementing a dataVar.
There used to be a 5s delay flow function looping through data variables.
image

There is another loop when you load a Datavariable collection onto your page:

Deleting the orange link in the page will get rid of the loop that slows down your app as it keeps going all the time. Even in the background after you have moved onto another page I have found:

This is about REST API calls, but the same goes for Data collections from local storage which is what I am using mainly.

I added a link from Page Focused to reload the Data. This is to make sure when this page is looked at again after entering data elsewhere that all data is (re)loaded on the page.

The reason I was looking into this was that I found the app I am making became so slow, it was grinding to a halt. Anyone reading this, if you have more information on how to speed the app up or prevent from slowing down, please let us know.