I have a fully functional process for syncing PouchDB and Bluemix/Cloudant for a current side/hobby project. Its a project planning app so users can be constantly making changes to their travel plans.
I have continuous/live replication turned on. As you can imagine it hits Cloudant with a ton of API calls.
Any thoughts on how to reduce the API calls without taking functionality away from the app?
Thanks!
If your application's data is only being generated on the client side and then pushed to the server, then be sure to use PouchDB's db.replicate.to(remoteDB)
call to start replication. If you use sync
instead, then your client will monitor the server side's changes feed, eating up API calls as it does it.
Using continuous replication, each document change (add/update/delete) is written to the server side as it happens. If using fewer API calls is your priority, then you could opt for "one shot" replication (i.e. not continuous). This would bundle many changes into a single bulk write operation on the client side, using fewer API calls to transmit the information. The challenge would be when to trigger replication in your app: on pressing a 'sync' button, on application startup, on shutdown, every hour?