Couchbase vs Realm Ask Question


#1

I’m quite new to iOS development so let me know if Couchbase and Realm aren’t even comparable.

I’m working on a messaging app for iOS/Android/Web/Desktop, which requires offline sync, authentication, and object event handling. Previously, I was using Parse for it, but its future seems uncertain. Couchbase and Realm both seem to support all of the requirements so I’m having trouble figuring out which one to use.

What are the advantages and disadvantages of Couchbase and Realm?


#2

I can obviously only give the Realm perspective. Realm and CouchBase are fundamentally different types of databases, in that Realm is an Object Database (allowing you to work with complex graphs of interconnected objects) where CouchBase is a Document Database (working with objects that are hierarchically arranged). Realm is also a first-class native database, where most CouchBase clients seem to be wrappers on top of sqlite or key-value stores, with all the performance limitations that entails (most benchmarks have shown Realm to be several times faster than Couch, but since all benchmarks are biased, you should obviously do your own before making any decision).

Functionality wise, Realm is also very different, with support for multi-threading, data binding, advanced queries and much more. There are also fundamental differences in how synchronization is handled, with Realm focusing on realtime synchronization with deterministic conflict resolution.

But in any case I would recommend you to try to build a small example project with each product and see which one gives you the best experience.


#3

I can similarly only speak for Couchbase (I’m an employee). The Couchbase Mobile stack does fulfill all the requirements you’ve listed.

As @alexander says, Couchbase is a document database. We store JSON documents, and unstructured blobs as attachments. One slight error, in that there’s no hierarchical arrangement. (This is a bit different than, for example, Firebase, which essentially stores all your data as one large document.) Couchbase (like many NoSQL databases) is “schema-less”, which means you don’t have to follow any defined structure. You can have many documents with completely different forms. You can also make changes to the documents easily. For example, say you start with a user profile as a document, and it initially only includes the user’s name and user ID. Later, you can add an email address (or an array of addresses) without breaking anything, and without having to perform a database migration.

Regarding performance, there are several dimensions along which you can measure. I’d echo Alexander’s remark that you likely need to think through your use case, decide where you need performance/scale, and see what fits.

Couchbase similarly has a number of advanced features, too many to detail here, including querying, data routing, role-based access control, and more. Couchbase takes a different approach to conflict resolution, using something called multiversion concurrency control. In effect, this means you have sophisticated ability to understand the history of changes. Very roughly speaking, it works somewhat like Git.

Finally, I’ll mention that the Couchbase Mobile stack includes Couchbase Server. Couchbase Server is an enterprise-class highly-sophisticated operational database that has been on the market for many years.

Both products are moving targets, so realistically the only way to fully compare them will be to work through your use cases and how each platform supports your current and future needs.


#4

I only have passing knowledge of Couchbase, not having used it since back in the CouchDB days, and my only association with Realm is a (happy) user. But I must say that seeing you trolling another company’s forum to peddle your own (competing) products leaves a sour taste in my mouth. It honestly makes you look lame and desparate.


#5

@hod.greeley thanks a lot for your post. It is very factual and unbiased, and helps understand the difference between the two databases.
I am contemplating right now between the two choices and both @alexander 's and yours posts help find the right info.


#6

Unfortunately Couchbase have removed encryption from their free product. For anyone interested in choosing a database to develop with, this could be a deal breaker (it was for me). Realm looks amazing and am looking forward to making the switch.