Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MongoDB High Availability

You're reading from   MongoDB High Availability Design and implement a highly available server using the latest features of MongoDB.

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781783986729
Length 164 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Afshin Mehrabani Afshin Mehrabani
Author Profile Icon Afshin Mehrabani
Afshin Mehrabani
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Understanding the MongoDB Architecture and Processes FREE CHAPTER 2. Understanding MongoDB's Failures and Limitations 3. Clustering in MongoDB 4. Utilizing a Replica Set 5. Replica Set in Action 6. Understanding the Concept of Sharding 7. Sharding in Action 8. Analyzing and Improving Database Performance 9. Migrating Instances and Reducing Downtime 10. Monitoring and Troubleshooting the Database Index

Understanding database locks

MongoDB uses read/write locks to prevent conflicts between write/read operations and also makes sure that all clients receive the same dataset with the same query.

MongoDB uses the readers-writer lock to prevent conflicts and control the read/write operations.

Note

A readers-writer lock is like a mutex, in that, it controls access to a shared resource, allowing concurrent access to multiple threads for reading, but restricting access to a single thread for writes (or other changes) to the resource. For more information, please visit http://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock.

MongoDB uses the shared read-lock, which means that many operations can use the existing read-lock. On the other hand, a write-lock is limited to a single operation, which means that no more write operations can use and share the existing lock.

The MongoDB lock mechanism gets better with each version. Before v2.2, MongoDB had a global lock per mongod instance for most read/write...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime