简体   繁体   中英

MongoDB first query slow

I'm getting really weird behaviour from mongodb.

I have a sharded session tracking collection were i do findOne's only on the _id (=shard key).

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

显然,这是由于使用php中的Mongo类而不是MongoClient类进行连接。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM