Problems with mongodb
I am creating an application where I cache the tweets of the user开发者_StackOverflow中文版s of my application and display them to their timeline page. I am currently using mongodb to store the tweets. Initially mongodb worked just fine but as the number of tweets exceed 10,000 I have some MongoCursor error showing up like the following
Uncaught exception 'MongoCursorTimeoutException' with message 'cursor timed out (timeout: 30000, time left: 0:0, status: 0)
Uncaught exception 'MongoCursorException' with message 'couldn't send query: Broken pipe' Uncaught exception 'MongoCursorException' with message 'couldn't get response header'
I have used proper indexing. So what could be the problem?
The basic problem is this line
timeout: 30000
The query has been running too long and therefore has been terminated. I would check the following
1) your query is well indexed by using explain() 2) whether mongostat is reporting "idx miss %" which will indicate whether the indexes are in memory and whether you had to go to disk to traverse the index 3) whether mongostat is reporting a high "locked %" 4) whether you are disk bound, try running "iostat -x 2"
The connection is timming out. For MongoCursorTimeoutException refer to this link.
With couldn't get response header
try and check if the database is still up and the network is connected and try the query again.
精彩评论