Parse open source server with mLab slow - ios

I switched over to the open source parse with mLab on AWS and the project in objective c runs slow. When I try to update delete add or query it takes about five seconds to process it. I was not having this problem with the parse.com. If any one could help me that would be great!

You are likely on a trial version of the server, which means that after 30 minutes of inactivity, your server will go to "sleep". When it is called to by a request, it must "wake up" which usually takes about 5 seconds. However, only the first query or log in after sleeping should actually be slow. The ones following should be very responsive.

Related

Electron low-power mode/power-save off OR reload without losing data?

I am using:
ELECTRON 19.0.4
NODE 16.14.1
NPM 8.6.0
Vue Framework
We have an APP which is getting data from a server with API rest, every 10 seconds and sending that data to another server. This means, theoretically the app is working 24/7.
PROBLEM: The app (the renderer process) is entering (and i am just guessing) an IDLE mode, even tho the process have an interval of requesting data every 10 seconds, or just a low power mode after a while (3/4 hours aprox) which for us means that the API request is not getting any data..
WE HAVE also tried:
const preventDisplaySleep = powerSaveBlocker.start('prevent-display-sleep');
AND
const preventAppSuspension = powerSaveBlocker.start('prevent-app-suspension');
AND
let idleState = powerMonitor.getSystemIdleState(30);
but without any desirable effect on our app.
WHAT is now WORKING is that every 2/3 hours we make a reload for "mainWindow" every 2 hour(in miliseconds).
setInterval(function () { mainWindow.reload()}, 7200000)
BUT THE ISSUE with this alternative is that when reloading we are getting a part of last interval of time, twice because we are starting a new interval of search at every restart of the app and so last interval before restart is covered 2 times.
QUESTION: is there any HOT Reload for electron without losing any data?? , or even better a WAY to make our app to **stay active ** ALL the TIME??
Thank you so much in advance. Can't wait to see what i am missing here, and how i can solve it..

Is there a way to see what query speeds by parse open source server

I switched over to the parse open source server because parse.com is shutting down. My app all works except when I query objects it takes about three seconds to return a value. This is a issue because my app will have a lot of users and I can not have it go slowly every time some one uses it. I tried updating mLab but it did not make a difference. It is on AWS and I am using the IOS SDK. Is there a way to see what might be causing the issue?

Is MobileServiceSQLiteStore.DefineTable<T> necessary on every run and if so why?

I'm trying to improve app launch performance for subsequent logins (every login after the first) with my mobile app and after putting some stop watch diagnostics I can see that defining my 8 tables with MobileServiceSQLiteStore.DefineTable<T> takes on average 2.5 seconds. Every time.
On an iPhone 4 running iOS 7 the loading time would be less than a second if it weren't for having to define these tables every time. I would expect them to only need to be defined the first run of the app when the SQLite database is setup. I've tried removing the definitions on subsequent logins and try to just get the sync tables but it fails with "Table is not defined".
So, it seems this is the intended behavior. Can you explain why they need to be defined each time and/or if there is any workaround for this? It could be negligible considering my phone is pretty old now.. but it still is something I would like to remove if possible.
Yes, it is required to be called every time because SDK uses it to know how to deserialize data if you read it via untyped interface i.e. IMobileServiceSyncTable instead of IMobileServiceSyncTable<T>.
As of now there is no work around to avoid calling it each time. I'm surprised however that it is taking 2.5 seconds for you because DefineTable does not do any database operations. It merely inspects the members on your type/JObject and maintains an in memory dictionary for later re-use.
I would recommend you to download and compile the SDK and debug your way through to figure out where the time is actually spent.

Increase Parse Cloud Code Function timeout time

I have a Parse Cloud Code function that has to make a https request to another service, and that service may take too long to finish executing to have my function stay within the 15 second timeout. Is there anyway to increase the timeout limit above 15 seconds?
The only cloud code that can exceed 15 seconds is a Job.
One option is to have a Cloud Function that saves information on what you want done to a row, e.g. PendingRequest. You can then have a job that runs every 5 minutes, checking for any records in the PendingRequest class and running them, saving the results, e.g. in another class called CompletedRequest.
If your UI needs to show completion it'll need to poll the CompletedRequest class to see if its request has been complete.
The main issue is that it could be up to 5 minutes before you get any results.
I figured out a way to do that and would love to share. Grab the open source Parse Mobile SDK. Navigate to the ParsePlugins.java file, and search for socketOperationTimeout, change the two places of assignments to this variable to whatever value you like for timeout.
Compile the modified SDK and import to your mobile code.

Getting updated server time every second

I have a requirement where I need to know what is the server time at a given point of time in the app. As soon as the app connects to server, the server sends back the time and I am not sure how to update this time.
I thought of using the timers where the method is called every second and and a second is added to server time, so that whenever I ask for server time it is always updated one. But problem with this if we schedule this on main runloop, the run loop may or may not process the timer request if there it is busy.
So how to track the server time?
Thanks
Your server is in a specific time zone correct? Just get the time zone of the server using a request and show the time in that time zone in your app. You can then use a timer to continue updating the time every second.
I suggest getting just the time zone because if you get the server's time, there would be a lag between when the server sends back the response and when you get it - which defeats the whole purpose of getting the time as on the server.
You can't update the iOS system time from your app; there is no API
for that.
iPhone's time is usually very accurate. On iPads, it varies but has improved with iOS 5 to +/- 5 seconds if some form of internet connectivity is available.
If you want to manually connect to a server to synchronize time, you
should do it in a background task.
To compensate for latency, you should make multiple requests and add
the average half of the roundtrip time to the time sent by the server.
However, the question remains: Why do you want to do that anyway?

Resources