Today, we’re announcing the general availability of Couchbase Mobile 2.6. This release comes on the heels of Couchbase Mobile 2.5 which we released in April of this year.
This is the first in a series of focused, purpose-built Couchbase Mobile releases that will allow us to deliver high-priority features in a timely fashion, keeping pace with the agile development needs that mobile developers have come to expect
This release introduces two highly anticipated features – Custom Conflict Resolution with two-way merge on Couchbase Lite and advanced cache management on the Sync Gateway.
Couchbase Mobile extends the power of Couchbase Platform to the edge, securely managing and syncing data, from any cloud to edge devices or directly between edge devices. In this post I discuss the main features in Couchbase Lite and Sync Gateway platforms. In addition to the features discussed here, there are a number of bug fixes and minor enhancements which are discussed in the platform-specific release notes.
Custom Conflict Resolution
In Couchbase Mobile 2.0 we introduced Automatic Conflict Resolution or “Conflict-Free Mode,” wherein conflicts are automatically handled by Couchbase Lite at the time of write, so there are effectively no conflicting document revisions in the Couchbase database. Couchbase Lite applies a default conflict resolution policy to handle conflicts that are either the result of a local write or the result of writes coming in via a replication. With Automatic Conflict Resolution, app developers will never have to worry about unresolved conflicts bloating up their database.
In Couchbase Mobile 2.6, we have enhanced the Automatic Conflict Resolution support by allowing app developers to define their own custom conflict resolution policy that can override the default policy. While the default conflict resolution policies worked for the vast majority of use cases, we recognize that there are use cases where the winner of two conflicting revisions can be determined by business rules that only the app is privy to.
To support this feature, apps must register a conflict resolver/handler function with Couchbase Lite that must select the winner of two conflicting revisions. When the system encounters a conflict, the system calls into the registered conflict resolver/handler function with the conflicting revisions and saves the winning revision returned by the function into the database. As in the case of default conflict resolution policy, there are no conflicts saved to the database.
With this enhancement, Couchbase Mobile offers comprehensive conflict resolution support that is the cornerstone of distributed database systems with sync.
The figure below is a high-level overview of how conflicts are handled in 2.6.
Of course, there is a lot more to it in terms of how exceptions and errors are handled. To learn more about this feature, check out our documentation
Advanced Cache Management
In 2.6, we introduce some key cache management enhancements in Sync Gateway that will significantly improve the vertical scaling support, particularly as deployments scale to tens or hundreds of millions of channels.
Sync Gateway maintains a couple of caches in order to improve response times while processing incoming requests. The channel cache is a cache of channels and metadata of documents associated with the channels.
Up until 2.6, the channel cache grew unbounded with the number of channels. This wasn’t particularly an issue for typical deployments of hundreds of thousands of channels. However, as deployments scaled to tens or hundreds of millions of channels, the size of the channel cache grew unbounded requiring significant memory resources.
In 2.6, we have changed the channel cache management policy so old and unused channels are automatically evicted and only the active channels are maintained in the cache. In addition, we have made the channel cache size configurable and have exposed a number of advanced channel cache settings that will allow users to appropriately tune the cache for their deployments.
In addition to the channel cache, Sync Gateway maintains a revs cache, which is the cache of document bodies of most recently accessed revisions. In 2.6, users can completely disable this cache. This is particularly relevant in very large deployments with hundreds of millions of documents where available memory is limited and the cache hit ratio is anticipated to be low.
To learn more about the cache enhancements on Sync Gateway, check out our documentation
In this post, we covered two key features in Couchbase Mobile 2.6. Refer to our documentation for a complete listing of all the enhancements and bug fixes. You can download Couchbase Mobile 2.6 today from our downloads page. Our Enterprise Edition is also free to download and use for development purposes. You can learn more in our What’s New page.
Here are some direct links :
- Couchbase Lite
- Sync Gateway
- Couchbase Mobile blogs
- Couchbase Forums