Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Impact of eventually consistent on app dev
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Geoffrey Hoffman  
View profile  
 More options Oct 11 2012, 1:24 pm
From: Geoffrey Hoffman <geoffrey.hoff...@gmail.com>
Date: Thu, 11 Oct 2012 10:24:48 -0700 (PDT)
Local: Thurs, Oct 11 2012 1:24 pm
Subject: Impact of eventually consistent on app dev

I'm much more familiar with MySQL and Redis. This is my first post here. I
did a search first; surprisingly, there's only two topics on this forum
relating to MongoDB eventual consistency.

I read this post<https://groups.google.com/d/topic/mongodb-user/2m-1cwSSLP0/discussion>and found the linked reference deprecated, so I want to resurrect this
topic, and make it more relevant.

I understand that MongoDB *eventually writes my data*, and that is
primarily what makes it fast. Okay, fine. Everything in life is a
trade-off. My questions are related to the impact of the choice to use
MongoDB on the application architecture. For example...

Do you always have to check to see if your data actually got written,
before moving on in your write code? That seems wasteful and avoids the
speed gains you would get from using it.

Or instead, do I use MongoDB like a cache layer, and always check if data
is not there, and if not, re-fetch it from my persistent store (mysql, API
or other...) That is to imply, use another store as the main one, and
MongoDB as secondary?

Or do I run N MongoDB servers and deal with replication at the MongoDB
server level?

How does MongoDB deal with larger data size than I have available RAM? Are
swap-to-disks fast? Evictions? Or is it not accurate to think of it as a
cache like Redis?

In short, how do application architects and developers deal with MongoDB
eventual persistence, if it is going to be the app's primary data store?

Thanks for insights.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Helman  
View profile  
 More options Oct 11 2012, 5:49 pm
From: Sam Helman <sam.hel...@10gen.com>
Date: Thu, 11 Oct 2012 14:49:03 -0700 (PDT)
Local: Thurs, Oct 11 2012 5:49 pm
Subject: Re: Impact of eventually consistent on app dev

Hello,

I think there is some confusion about what is meant by eventual
consistency.  In a single-server environment, for each client MongoDB will
reliably write data in the order that the client writes it, and data will
be available to everyone as soon as MongoDB (the server) has written it.
 This data will not be written to disk immediately, but instead is written
to memory-mapped files that the OS flushes to disk (additionally, every 60
seconds MongoDB forces a flush to disk).

However, MongoDB drivers do not, by default, check the server's return code
when they write to the database.  That means that if a write fails because
it is illegal (for instance, if it violates a unique index), the
application will not find out.  Setting "safe mode = true", which is
slightly different syntactically for each driver, will ensure that the
application gets the return code for each operation it sends to the server.
 See this stack overflow
question: http://stackoverflow.com/questions/11563627/what-is-exactly-meant-by-....

In a replication scenario (more than one server), writes are made to a
single primary server, which is polled by secondaries that replicate its
data.  In a case such as this, if you allow your application to read from
secondaries (by default, this is not allowed, but it can be good for
scaling reads), then the application could miss data that has been written
to the primary but not yet replicated to the secondary.

MongoDB is not an in-memory database, and it is not intended to be used as
a cache layer; it is a persistent database that writes to disk, and is
meant to be used as a primary data store.  Its speed is due to good
implementation rather than poor write persistence.  In the normal course of
using MongoDB, consistency does not show up as a problem.

If you would like to become more familiar with how different scenarios are
handled, the official docs at http://docs.mongodb.org/manual/ are a good
place to start.

Does this help with your concerns?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Millman  
View profile  
 More options Oct 12 2012, 2:28 pm
From: Sam Millman <sam.mill...@gmail.com>
Date: Fri, 12 Oct 2012 19:28:14 +0100
Local: Fri, Oct 12 2012 2:28 pm
Subject: Re: [mongodb-user] Re: Impact of eventually consistent on app dev

"Would, therefore, a wise MongoDBA suggest to never use fewer than 2 or 3
servers (if I care about my data)?"

It can also be solved by a solid backup and recovery strategy, so packing
more servers is not the answer sometimes.

"When can I read the data I just wrote? Immediately (while it's still in
RAM and not yet on Disk?) or only once it's on disk?"

Immediately.

On 12 October 2012 18:28, Geoffrey Hoffman <geoffrey.hoff...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Helman  
View profile  
 More options Oct 12 2012, 3:26 pm
From: Sam Helman <sam.hel...@10gen.com>
Date: Fri, 12 Oct 2012 12:26:14 -0700 (PDT)
Local: Fri, Oct 12 2012 3:26 pm
Subject: Re: [mongodb-user] Re: Impact of eventually consistent on app dev

It is also worth noting that all of the drivers are configuable to NOT use
fire-and-forget, even though it is the default.  Take a look at safe mode
if you begin to develop with MongoDB.

Regarding recovery / backup, MongoDB handles this out of the box, if you
deploy your system as a replica set:
http://www.mongodb.org/display/DOCS/Replica+Sets.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »