DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Consistent: To Be, or Not To Be

Consistent: To Be, or Not To Be

Shane Johnson user avatar by
Shane Johnson
·
May. 19, 14 · Java Zone · Interview
Like (0)
Save
Tweet
3.02K Views

Join the DZone community and get the full member experience.

Join For Free

That's the question.

This is from a client's point of view absent a partition and / or failover.

MongoDB

Is data in MongoDB consistent?

MongoDB executes read and write operations on the primary node, and data is consistent. However, performance is limited because clients do not leverage secondary nodes. The first alternative is to execute read operations on all nodes, primary and secondary. Read performance is better, but data is no longer consistent because replication is asynchronous by default. The second alternative is synchronous replication. The data is consistent, but write performance is worse.

  • Primary
    • Medium Read Performance, Medium Write Performance
    • Consistent Data
  • Primary + Secondary (Asynchronous)
    • High Read Performance, Medium Write Performance
    • Eventually Consistent Data
  • Primary + Secondary (Synchronous)
    • High Read Performance, Low Write Performance
    • Consistent Data

Data may or may not be consistent.

Couchbase Server

Is data in Couchbase Server consistent?

Couchbase Server executes all read and write operations on the primary node, and data is consistent. Performance is high because clients leverage all of the nodes. That's because every node is a primary node.

  • Default
    • High Read Performance, High Write Performance
    • Consistent Data

Data is consistent.

Partitioned versus Replicated

Couchbase Server and MongoDB both implement partitioning and replication. However, the implementations are different.

In MongoDB, a partition is stored within a replica set. A replica set consists of a primary node and multiple secondary nodes. If there were nine nodes, there would be three replica sets with write operations distributed to the three primary nodes. In Couchbase Server, every node is both an active primary node and a passive secondary node. If there were nine nodes, there would be nine primary nodes with write operations distributed to all them (9). This is a high level description of how data is partitioned and replicated within Couchbase Server. A low level description is available in the documentation on vBuckets (link).

If data is replicated, MongoDB would require twenty-seven nodes to distribute write operations to nine nodes.

Discuss

Reddit

Data (computing) Couchbase Server

Published at DZone with permission of , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Debugging Java Collections Framework Issues in Production
  • Create a Self-Service Customer Support Chatbot Without Code
  • Fintech and AI: Ways Artificial Intelligence Is Used in Finance
  • ETL, ELT, and Reverse ETL

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo