Today we are announcing the general availability of Couchbase Mobile 2.5, our most advanced NoSQL data platform for mobile applications to date. This release builds on the strong architectural foundation that was laid out with the release of Couchbase Mobile 2.0 last year. With a plethora of new features and enhancements, this release makes it easier than ever to develop mobile applications with secure embedded local storage and advanced sync capabilities.

Couchbase Mobile extends the power of Couchbase Server, bringing distributed NoSQL database capabilities to the edge, while securely managing and syncing data from any cloud to edge devices, as well as directly between edge devices. In this post, I discuss the main features in Couchbase Lite and Sync Gateway. In addition to the features discussed here, there are a number of bug fixes and smaller enhancements which are discussed in the platform-specific release notes.

Bandwidth savings using delta sync

For mobile deployments where network bandwidth is constrained and data plans come at a premium, the delta sync feature enhances the replication protocol by syncing only parts of the document that have changed, resulting in significant savings in bandwidth consumption. This is true for data synchronization between Couchbase Lite-enabled mobile applications and Sync Gateway as well as for peer-to-peer sync between Couchbase Lite clients.

To understand the benefit of this feature, consider the case of a mobile event application where attendees can access details of the event schedule, speaker bios, venue details, maps, etc. Event details are synced and stored locally on the user’s mobile device so data is always available and applications are highly responsive. On the day of the event, a speaker misses her flight and a new speaker is scheduled to do the talk. This last-minute speaker change needs to be synced with applications over a notoriously congested conference Wi-Fi connection.

With delta sync, only the relevant changes to documents are updated, ensuring that all attendees receive the updates despite bandwidth constraints. The alternative to delta sync is to model the data in such a way that the highly mutable parts of your data are separated into their own documents. This may not be practical to do in all cases.

The impact of the savings grows significantly with larger document sizes. This gives you the flexibility to model your documents in a way that best meets the needs of your applications. There are storage and replication time costs to be considered while enabling delta sync.

For more details on delta sync and how you can enable it in your deployments, refer to our documentation pages.

Real-time predictions at the edge using Predictive Query 

Machine learning (ML) on the edge offers several benefits, including faster real-time predictions, increased security/privacy, and offline support. There is a growing ecosystem of mobile-optimized machine learning models that have a small memory footprint and are optimized for on-device performance. In addition, all the major mobile platforms include hardware and software support for machine learning on the edge, including CoreML on iOS, TensorFlow Lite on Android, and Windows ML on Windows. So it is logical for Couchbase Lite applications to leverage these platform and ecosystem advancements to run real-time predictions on the database directly.

Couchbase Lite’s new predictive Query API, available in Developer Preview, allows mobile applications to leverage mobile-optimized, pre-trained, machine learning models to run predictive queries against data in your database in a convenient, fast, and always available way. To do this, you simply register a machine learning model through the predictive Query API and Couchbase Lite uses the registered model for running the predictions. Couchbase Lite can also build a prediction index, which effectively functions as a cache of the prediction results. By building a prediction index during write time, users can expect to see several orders of magnitude in the performance improvement for their inductive queries.

An example application is a facial recognition application used to find the closest match between an image uploaded into the application for instance, via the device camera and the set of images stored in the Couchbase Lite database. The predictive Query API allows users to build a prediction index of the image “fingerprint”, a meaningful vector of the image, using the registered ML model. Each time a new image is uploaded into the app, it can quickly use Couchbase Lite’s new distance functions to perform similarity matches between the uploaded fingerprint and the fingerprints of images previously cached in the prediction index.

With the new predictive Query API, we continue to showcase our thought leadership and innovation in the area of mobile data storage and can’t wait to see the new features that you will enable in your mobile applications with this capability.

To learn more about the new predictive Query API, check out our documentation.

Couchbase Lite

Improved supportability using enhanced logging support

We have improved the ability to support and debug Couchbase Lite by providing an optional unified log interface that offers three modes of logging.

Continuous file-based logging

When enabled, Couchbase Lite continuously logs data to files corresponding to four log levels: error, warning, info, and verbose. The log files are auto-rotated and you can control the max number of log files at each level. By default, Couchbase Lite logs data in a highly efficient binary format but can be set to use a text-based format as well.

Custom logging

Applications can register a callback function that Couchbase Lite invokes with log data. Applications can process the log data as needed and/or feed it into any custom logging framework of choice. This provides applications with the flexibility they need, allowing them to use any custom logging framework.

Console logging

This capability is available in earlier versions of Couchbase Lite as well and refers to data that is logged to the debug console window. This is typically only enabled in debug mode. By separating the log files intended for support from the console-based logging facility, users have the flexibility to tune what gets logged to console, potentially even disabling it, without impacting support.

To learn more about the enhanced logging capabilities, check out our documentation.

Fine-grained replication eventing

In Couchbase Mobile 2.1 applications had the ability to listen for events that notified applications of the overall status of replication such as busy, connecting, stopped, etc. While this was useful to inform application users of the overall status of the sync, it was not sufficient if application users were only interested in the sync status of a particular set of documents. With Couchbase Lite 2.5, applications can register for callbacks on the push or pull replication status of individual documents. This fine-grained eventing allows applications to be notified when a document has been pushed, pulled, or if there was an error in the replication.

This level of fine-grained notification has several compelling use cases. For instance, applications can now expire a document from the local store after a push. When the application is notified via replicated eventing that the document is pushed, it can set an expiration timer on the document or purge the document immediately. This helps manage the local database size by removing local documents after they are synced up, and also supports use cases where data privacy guidelines mandate that documents containing sensitive data not reside on the device after a push.

To learn more about how to register for replication events, check out our documentation.

Fine-grained filtered replication

In addition to channel-based filtering, which is available in Couchbase Mobile 2.x, applications can now register filters to perform fine-grained filtering on push and pull replications.

Push filters allow mobile devices to control the documents that are synced to the cloud and with other devices. For instance, consider a field data collection application wherein only documents with a collection status of “done” are expected to be synced to server. In other words, the document should not be pushed to the cloud while in the process of collecting data (i.e., every time the user taps “save”). Push filtering also preserves bandwidth.

Pull filters, on the other hand, are used to enforce that only documents that are pulled from the remote endpoint and meet the specific filter get stored in the local database. While pull filters do not control what actually gets pulled over the wire, it acts as a local validator. This is especially useful in peer-to-peer sync which does not support channel-based filtering.

To learn more about how to apply fine-grained filtering, check out our documentation.

Expiration date on local documents

We have reintroduced time to live (TTL) support on Couchbase Lite documents! With the new expiration date feature, applications can set a TTL value on documents in Couchbase Lite. Upon expiry, documents will be purged from the local database. The purge only affects the local client database and will not get replicated to other endpoints. This capability has many uses. For instance, if you have documents in Couchbase Lite with a known lifetime, you can set the expirationDate on the documents to ensure they are purged on expiry even when the application is offline.

To learn more about this feature, check out our documentation.

Automatic purge of removed documents

When a user loses access to a document because it has been removed from all of the user’s channels, a subsequent pull of the document from Sync Gateway produces a document removal notification. The new automatic purge capability in Couchbase Lite will purge documents that have been removed from all of the user’s channels. This is a convenience feature that ensures that documents that users no longer have access to are automatically removed from the local database.

To learn more about this capability, check out our documentation.

Date/time functions

With Couchbase Lite 2.5, we have extended the Query API with a set of date/time convenience functions. Date properties created from within Couchbase Lite are internally stored as ISO 8601 formatted strings, but documents created externally could have the date values specified in an epoch/Unix timestamp. The new date/time functions provide a convenient way to convert between the ISO 8601 and epoch date formats.

 

Sync Gateway

Sync Gateway monitoring

We have significantly expanded the monitoring capabilities of Sync Gateway to include a comprehensive set of statistics that provide important insights into the state of your deployment. The stats help identify the cause of common sync issues as well as ensure that Sync Gateway is operating normally. The JSON-formatted stats are available through the _expvar REST endpoint. In addition, stats are logged to enhance the supportability of the platform. You can also export the JSON output to any monitoring platform of your choice.

Refer to our documentation for a complete listing of the stats.

Next steps

In this post, we scratched the surface of what’s possible with some of the new features in Couchbase Mobile 2.5. Refer to our documentation for a complete listing of all the enhancements and bug fixes. You can download Couchbase Mobile 2.5 today from our downloads page. Couchbase Server Enterprise Edition is free to download and use for development purposes. You can learn more on our What’s New page.

Resources:

Couchbase Mobile

Couchbase Lite

Sync Gateway

Couchbase Forums are a good place to reach out with questions.

If you have questions or feedback, please leave a comment below or feel free to reach out to me by email or on Twitter.

Author

Posted by Priya Rajagopal, Senior Director, Product Management

Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.

Leave a reply