Mongodb slow first query

84 views
Skip to first unread message

Vincent

unread,
Oct 8, 2013, 1:03:54 PM10/8/13
to mongod...@googlegroups.com

I'm getting weird behaviour from mongodb.

I have a sharded session collection called tracking were i do findOne's only on the _id (=shard key) and at the end of the script do an update.

Before getting the session data I get the site data (non sharded collection) also with findOne (also on the _id), I cache the site data in memcached, this way the tracking findOne takes about 0.04 seconds to fetch.

However when I disable memcached on the site data and force it to get the data from mongodb the tracking findOne takes 0.001 seconds and the site findOne now is slow.

Explain situation 2 with findOne site first: http://pastebin.com/qTX0az7H

Explain situation 1 with findOne tracking first: http://pastebin.com/bBSXUEKh

I'm using the PHP driver 1.4.4 and mongodb version v2.4.6

Hannes Magnusson

unread,
Oct 21, 2013, 7:13:07 PM10/21/13
to mongod...@googlegroups.com
Could you include the actual queries? 
I'm also slightly confused about your exact question... Are you complaining that your site is running faster when you don't have caching enabled? :)

Also, how are you measuring? (before/after the PHP driver calls using microtime()?)

-Hannes

Reply all
Reply to author
Forward
0 new messages