The problem is your use of j=True. The first thing to understand if
that find_and_modify() is a command that does not support the j
option, so passing that parameter has no effect.
Passing j=True on every update() is causing *at least* a 33
millisecond pause (to wait for the next group commit) for each
operation before the server acknowledges the write. That is why you
are seeing this slowdown in your update operations in a single thread.
More information on j is available here:
http://www.mongodb.org/display/DOCS/getLastError+Command#getLastErrorCommand-%7B%7Bj%7D%7D
On Tue, Sep 11, 2012 at 5:40 AM, arjun kumar <
narju...@gmail.com> wrote:
> We are trying to measure the speed of reads/writes/updates etc. with pymongo
> as the client driver, and we found that the Collection.update() function
> is incredibly slow compared to Collection.find_and_modify() function.
>
>
http://api.mongodb.org/python/current/api/pymongo/collection.html
>
> The speed in terms of reads/writes per sec are
> Read - 2800 records per sec
> Update using update function - 30 records per sec
> Update using find_and_modify function - 1500 records per sec
>
> We can update only 1 document at a time - so we used the update function
> with multi=False. We also had journaling enabled so we were passing j=true
> as an argument. To summarise we were using both the functions in this
> manner :
>
> collection.update(query_criteria,{"$set" : {"data":
> my-data}},multi=False,j=True)
> collection.find_and_modify(query=query_criteria,update={"$set" :
> {"data":my-data}},j=True)
>
> We don't understand why is update almost 40 times as slow as
> find_and_modify.
>
> Any help or any sort of documentation on this would be much appreciated.
>
> Thanks,
> Arjun
>
>
> --
> 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