1

Can some one explain Single Server Durability in detail? I came across it while I was going through MongoDB concepts.

Community
  • 1
  • 1
Srik
  • 155
  • 1
  • 1
  • 6

2 Answers2

6

Full single server durability is part of the ACID paradigm, more specifically; durability ( http://en.wikipedia.org/wiki/ACID#Durability ).

It requires that if a server goes down, in a single server environment, that it will not lose its data or become corrupt.

MongoDB only partly abides by the ACID rule of durability due to the nature of delayed writes to both the journal and disk. Even though this window is small (like 60 ms) there is still a small possibility of losing a couple of operations in a single server environment unless you were to use journal acknowledged writes in your application.

In the event of a failure with journal acknowledged writes on you would be able to replay the journal to ensure that the only operations to lose would be the ones that were incapable of reaching the server before it failed.

In the event of a failure without journal acknowledged writes there would be the possibility of losing all operations within a 60 ms window, you mjust decide if that means anything to you; on a single server environment your site is probably too small to care tbh.

Sammaye
  • 43,242
  • 7
  • 104
  • 146
  • I didn’t know about existence of journal acknowledgement options. Good to know. Thanks :) – Srik Mar 12 '13 at 09:43
  • So with this SSD feature, is it like replication of data happens automatically to maintain durability? – Srik Mar 12 '13 at 09:52
  • @SrikarA The journal is more like a log. It contains a set of operations put against the database and will understand when certain ops have not completed etc and will be able to reset the database to a consistent state ( http://en.wikipedia.org/wiki/Journaling_file_system ). It isn't as fine grained as a transaction but it is still good. Replication of data will only occur if you add a replica set. – Sammaye Mar 12 '13 at 09:55
  • @SrikarA Which SSD feature? Journal will exist across both HDD and SSD – Sammaye Mar 12 '13 at 09:56
  • Oops! I meant single server durability(SSD), not related to storage. I understood about journalling. My only doubt left is: Not having single server durability meant not having journalling & replication features? Is it like we had to do manual back ups before? – Srik Mar 12 '13 at 10:07
  • @SrikarA Indeed, without replication you will not have backups of your data incase of some really unforeseen problems, same with SQL really, even though it has this ability quite well implemented you wouldn't trust it on a single server, you would still do backups. But you could automate binary backups to some cloud storage like S3 or you could just get a very small and not very powerful server and use it as a hidden member to do backups on, then if your single server has some terrible failure you can just copy the hidden to a primary and carry on – Sammaye Mar 12 '13 at 10:12
  • @SrikarA Basically so long as your using only one server you should always take the chance of corruption seriously in any database. Even though there are measures to lower the chance of corruption to near on nothing it only takes shutting down the computer at the right time for corruption to occur. – Sammaye Mar 12 '13 at 10:15
  • Cool. I came to know about new things from your discussion. Thanks for your help & patience :) This article helped me further. (http://blog.mongodb.org/post/381927266/what-about-durability) – Srik Mar 12 '13 at 10:51
1

It means that a solo server (not a part of replica set) offers at least some guarantees to persist your data in a durable fashion. Before this feature was introduced, you had to use replica sets to make sure that if a server goes down, it doesn't lose your data.

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367