Global read write lock

176 views
Skip to first unread message

gopal

unread,
May 1, 2012, 1:07:15 PM5/1/12
to mongod...@googlegroups.com
I have just noticed that Mongodb has a database read write lock means whenever you try to do the write operations on a particluar collection  the database gets locked and same for read operations is it true?

Andreas Jung

unread,
May 1, 2012, 1:23:11 PM5/1/12
to mongod...@googlegroups.com
http://www.mongodb.org/display/DOCS/How+does+concurrency+work

-aj

--
ZOPYX Limited | zopyx group
Charlottenstr. 37/1 | The full-service network for Zope & Plone
D-72070 T�bingen | Produce & Publish
www.zopyx.com | www.produce-and-publish.com
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting


Sam Millman

unread,
May 1, 2012, 1:31:21 PM5/1/12
to mongod...@googlegroups.com
Rad operations can run concurrently but yes write takes lock.

On 1 May 2012 18:23, Andreas Jung <and...@andreas-jung.com> wrote:


gopal wrote:
> I have just noticed that Mongodb has a database read write lock means
> whenever you try to do the write operations on a particluar collection
>  the database gets locked and same for read operations is it true?

http://www.mongodb.org/display/DOCS/How+does+concurrency+work

-aj

--
ZOPYX Limited           | zopyx group
Charlottenstr. 37/1     | The full-service network for Zope & Plone
D-72070 Tübingen        | Produce & Publish

www.zopyx.com           | www.produce-and-publish.com
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting


--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Tad Marshall

unread,
May 2, 2012, 11:33:49 AM5/2/12
to mongod...@googlegroups.com
In versions up to 2.0.x, there is a global write lock for each mongod server, so activity in any collection on any database on that server will affect all other collections (in any database) on that server.  Starting with version 2.2, there is one lock per database, so multiple locks per server if there is more than one database being used, so concurrency can be greater if activity is spread across more more than one database.  We may move to collection-level concurrency in a future version, but we don't have a schedule for this yet.

The general pattern is that many readers can all read at the same time if no writes are taking place, but a mix of readers and writers will force queuing.
Reply all
Reply to author
Forward
0 new messages