File handling in Timers server side code ?

Hi - I intend to archive my table periodically to a CSV file. For the same, can I use normal Java file handling classes like ‘FileWriter’ in server side Timers code ? If yes, how the file path should be ?? If not, what is the best way to create, write a file ??

Direct access to the file system is not allowed from custom business logic. Instead you can use the file upload API:

https://backendless.com/documentation/files/android/files_file_upload.htm

Hi Mark -

We are required to archive one of our tables as a ‘single CSV file’ at periodic interval. So we intend to use server side timers - however the table can contain 10-20 K records (planning for first 6-8 months after launch).

So, we have few concerns with the load limitations. Request for your help/suggestions on below:

  1. We cannot get script/code execution time of > 20 secs - and ofcourse we cannot fetch and process all 10-20 K records (fetch, process and write in file) in these 20 secs - so what would be the best design/solution here ??

  2. Moreover, does the platform abruptly kills the timer after 20 secs ?? Its a concern, as it will leave the data in unreliable state.

  3. Also, how does the ‘find’ in data service works - does it fetch all records at once and returns record from memory when we call nextPage() ?? If yes, what if the search result have 10-20 K records - will it still fetch all records at once ?? If not, how does it decide how much records to fetch each time ??

  1. Create a script on your own server and call that script from the Backendless timer

  2. Yes, if your script does not finish in 20 seconds, it will be killed

  3. Find operation uses built-in paging - it fetches no more than 100 records in a single call (you need to use the pageSize argument in the QueryOptions object).

Mark

  1. Unfortunately, we don’t intend to keep any server for initial few months - until the concept shows some traction. Initially, we intend to go simply as ‘Android app + Backendless free version’ - we will evolve to standalone/managed backend, if things go in positive way.

  2. So, when we call nextPage() - it goes back to backend to fetch more records from DB - so each call to nextPage() will take almost same time due to network delay.

  3. Another question, do you provide any kind of backup/restore services for free version of backendless ??

No, we do not provide backup/restore for the free tier of service.

ok - then what are my options in this regard ? Do you provide this as charged service ? Even if we try to do it ourselves, how can we do the same - there are no APIs for the same ?

Your option is to either run your own server or arrange a special deployment with Backendless (contact sales@backendless.com to get a quote).

If you try to do it yourself, what API do you need?

ok, I will also write to sales team, to get an idea.

An API version of already available ‘export’ functionality from console should be fine - something which we can call from our server, say every hour and download exported zip file.

We are developing app for local merchants, so once a transaction is committed - we cant afford to loose the data (as it will contain financial payment info).

What do you suggest to achieve the same - do you have ‘data replication’ - to avoid loosing data in between the backups ?

An API version of already available 'export' functionality from console should be fine - something which we can call from our server, say every hour and download exported zip file.

This is available in the form of “Admin and Management APIs”. You can purchase it from Marketplace.

What do you suggest to achieve the same - do you have 'data replication' - to avoid loosing data in between the backups ?

I am sorry, but I cannot provide such suggestion. If you need backups, it is something we provide for a fee.

ok, last point - In the Standalone deployment, does the Backendless have the cluster capability ?? i.e. can it synchronize
(esp. DB data) between 2 or more VMs ? So, does the different app see and work on same DB ?? If VM1 goes down, does the VM2 have all the data to handle next requests from users of VM1 ??

You can configure replication between multiple database instances.

Hi Mark - Above in one of the comment you suggested to - “Create a script on your own server and call that script from the Backendless timer”.

What kind of script are you referring to here ?? Also, is the limit of 5-20 secs for server side timer, applies to standalone installment too ??

The limit does not apply to Standalone version.