Re: [mongodb-user] Parallel write/delete operations

217 views
Skip to first unread message

Octavian Covalschi

unread,
Oct 4, 2012, 2:20:26 PM10/4/12
to mongod...@googlegroups.com
Have you seen this page? http://www.mongodb.org/display/DOCS/How+does+concurrency+work



On Thu, Oct 4, 2012 at 1:11 PM, OZAYAMA <markus.sc...@googlemail.com> wrote:
Hi List,

I'm new to mongodb and I'm not sure if parallel write/delete operations on one
collection can be a problem.

Use-Case:
---
There's a collection of the name 'message' and my program has two threads.
Thread 'A' adds continuously new documents to the collection 'message' and
thread 'B' removes old documents from the collection 'message' at the same time.
Both threads access the same collection but they operate on different documents.
Does mongodb manage this for me?

Maybe there are other concepts to handle this.

Thanks in advance.

Best Regards

OZ


--
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
See also the IRC channel -- freenode.net#mongodb

मैं एक भारतीय बेवकूफ हूँ

unread,
Oct 4, 2012, 2:21:06 PM10/4/12
to mongod...@googlegroups.com

OZAYAMA

unread,
Oct 4, 2012, 4:08:13 PM10/4/12
to mongod...@googlegroups.com
Hi,

thanks for the fast response. I've seen that page a couple of days ago so it was a good reminder.
I'll take a look at the following presentation and try to understand what concurrency means in the mongodb world.
https://speakerdeck.com/u/mongodb/p/mongosf-mongodb-concurrency-internals-in-v22

Thanks again.

-OZ

Octavian Covalschi

unread,
Oct 4, 2012, 5:00:18 PM10/4/12
to mongod...@googlegroups.com
Are you trying to implement some kind of message queue?

OZAYAMA

unread,
Oct 5, 2012, 2:04:47 AM10/5/12
to mongod...@googlegroups.com

Yes, I'm using rabbitmq for that purpose - thanks for the hint.

-OZ

OZAYAMA

unread,
Oct 5, 2012, 8:56:48 AM10/5/12
to mongod...@googlegroups.com
FYI,

I've inserted 1.000.000. documents in my 'message' collection and
a concurrent task has deleted the older ones. I've counted all messages
that came in and the number was exactly 1.000.000. So it seems that's
no problem for mongodb to handle concurrent accesses on one collection -
before this test this wasn't clear to me - lack of understanding on my side ;-)

Test Scenario
===

| Client | ===> | MyWebApp | ===> | RabbitMQ | ===> | MyWebApp | ==> | MongoDB |

Prerequisites
===
MongoDB 2.0.4
Grails 2.0.4

-OZ
Reply all
Reply to author
Forward
0 new messages