We've built a basic web application that uses JavaScript to render the page, with all relevant data stored in Quickbase, leveraging the Quickbase RESTful API. We're using XMLHttpRequests to make the AJAX calls. At times, the pages load very quickly. In the past several weeks, there have been many times, often on weekday afternoons, when it takes more than 5 seconds to receive a response from Quickbase, making the app largely unusable. There have been a few times when Quickbase has posted performance issues on their Status Page, but I'm seeing the performance degradation many times when there is NO posting on the Status Page. I'm wondering if other app developers are seeing the same issue, and if there's anything I can do differently to mitigate.
We are making multiple AJAX calls, and waiting to render the page until Promise.all() returns.
Sample AJAX call:
var cmData = new Promise(
function queryQB(resolve,reject){
let body = {
"from": CMTable,
"select": [ 6, 23, 24, 25 ],
"where": "{'6'.EX."+myCM+"} AND {'26'.EX."+true+"}"
};
const xhr = new XMLHttpRequest();
xhr.open('POST', QBRecordsAPIQueryUrl, true);
if(loading == false){
showLoading(); //hide all page content and display a loading gif
loading = true;
}
xhr.timeout = 5000;
for (const key in QBApiHeaders) {
xhr.setRequestHeader(key, QBApiHeaders[key]);
}
xhr.send(JSON.stringify(body));
xhr.onload = function() {
var cmData;
if (xhr.status == 200) {
cmData = xhr.responseText;
let parsedResponse = jQuery.parseJSON(cmData);
cmData = parsedResponse.data;
}
resolve(cmData);
}
else{
reject(new Error("There was an error retrieving data from Quickbase. "+ xhr.status+", "+xhr.statusText));
}
}
xhr.ontimeout = function (error) {
hideLoading(); //display page content, hide the loading gif
reject(new Error(“Quickbase is taking a long time to respond. “));
};
xhr.onerror = function(error){
reject(new Error(" An error occurred connecting to Quickbase. "));
}
});
Promise.all([cmData,otherData,moreData]).then((values) => {
hideLoading(); //display page content. Hide the loading gif.