We’ve made caching and offline support integral to our SDK
In our experience, apps built on Kinvey manage data in one of three broad patterns –
- Predominantly offline – these apps are often used in the field for long durations without a network connection. Periodically, the user connects to a network and synchronizes data between the device and the backend. Such usage is typical for field service apps.
- Offline-online – these apps are usually online and prefer getting data from the backend whenever possible. However, they need to be highly responsive in poor network conditions and support data access during short periods of offline use. A majority of popular apps fall in this category.
- Online only – occasionally an app requires that no data be stored on the device. This could be due to security or compliance restrictions, or during a testing and debugging phase.
With v3, we’ve designed our data stores in a way that makes it easy for developers to support each of these use cases. All you need to do is specify a “type” when a data store is created – that’s it! The library takes care of configuring read and write policies, creating and managing a cache, keeping track of offline write operations, and optimizing data transfers between the device and the backend. Basically, everything you need to write highly performant, responsive apps. We do most of the heavy lifting with data, so you can focus on building a slick user experience.
We’ve built it for high performance
We have learned a lot from Kinvey customers who have put our SDKs through various demanding performance problems. As an example, one of our customers recently built an app for field service professionals who often spend days, even weeks on the road with poor or no network connection. The amount of data generated on the device and synchronized with the backend in one go is in the order of tens of thousands of entities per user. This presented several challenges to our PhoneGap SDK.
Working with this customer, and with others who’ve had similar requirements, has led to many improvements in how our SDKs handle large volumes of data. We feel there’s a lot more we can do to improve the performance even further, but a few features in V3 are worth calling out:
Delta set caching
The library implements a mechanism to optimize the amount of data retrieved from the backend. When you use a Sync or Cache datastore, data requests to the backend only fetch data that changed since the previous update. We call this mechanism “Delta Set Caching.”
We’ve made it easier for apps to synchronize hundreds to thousands of offline write operations from the device to the backend. We’ve made our storage of offline data more efficient, added optimizations to local database operations, and implemented batching on network requests to send data faster to the backend. When you call “dataStore.push()” or “dataStore.sync()” from the app, all of these improvements are being used behind the scenes to improve the end-to-end response time. Learn more in our Dev Center.
Resumable File Uploads
We’ve focused on simplicity and consistency
When we built v3, we incorporated a lot of feedback from Kinvey developers and tried to make some of the complex things easier. Some of the key areas we focused on include:
- Simple APIs to solve common problems
- All caching and offline policies can be configured with a single setting; and data synchronization is supported with three basic APIs – “push()”, “pull()” and “sync()”.
- Initializing the library, registering for push notifications, and similar setup actions are supported with synchronous, single line of code APIs.
- APIs that follow platform best practices
- We use RxJS observables so apps can observe data retrievals from the cache and the backend.
- Apps can write queries in native JS syntax and have them executed offline as well as against backend data.
- Consistent APIs across platforms
Our JS SDKs are organized as a set of platform “shims” that all use a common core package. All of our shims have been under an open source license for a while now.
We encourage Kinvey developers to help us improve the SDK. Check out the JS core and let us know what you think!