I wrote a PyMongo Script to build up large MongoDB tables. When it was almost finished it now suddenly hangs. The guy who set it up says, it’s consuming 2GB memory being at the limit.
How I can probe what’s going on in general? Are there options the admin should adjust for smooth execution (memory limits, buffer, etc.)?
I looked up db.current_op() and I get:
{'inprog': [{'active': False,
'client': '0.0.0.0:0',
'desc': 'initandlisten',
'lockStats': {'timeAcquiringMicros': {'R': 0,
'W': 2,
'r': 6,
'w': 0},
'timeLockedMicros': {'R': 0, 'W': 100416}},
'ns': 'test',
'numYields': 0,
'op': 'query',
'opid': 1,
'query': {'options.temp': {'$in': [True, 1]}},
'threadId': '0x7fa7c7a71b40',
'waitingForLock': False},
{'active': False,
'desc': 'DataFileSync',
'lockStats': {'timeAcquiringMicros': {},
'timeLockedMicros': {}},
'ns': '',
'numYields': 0,
'op': 'none',
'opid': 0,
'query': {},
'threadId': '0x7fa7c4605700',
'waitingForLock': False},
{'active': False,
'desc': 'journal',
'lockStats': {'timeAcquiringMicros': {'R': 278218664,
'W': 20638320},
'timeLockedMicros': {'R': 34804203,
'W': 313165131}},
'ns': '',
'numYields': 0,
'op': 'none',
'opid': 0,
'query': {},
'threadId': '0x7fa7c3203700',
'waitingForLock': False},
{'active': False,
'client': '0.0.0.0:0',
'desc': 'TTLMonitor',
'lockStats': {'timeAcquiringMicros': {'r': 2, 'w': 0},
'timeLockedMicros': {'r': 32, 'w': 0}},
'ns': 'local.system.indexes',
'numYields': 0,
'op': 'query',
'opid': 22735364,
'query': {'expireAfterSeconds': {'$exists': True}},
'threadId': '0x7fa7c09ff700',
'waitingForLock': False},
{'active': False,
'desc': 'websvr',
'lockStats': {'timeAcquiringMicros': {},
'timeLockedMicros': {}},
'ns': '',
'numYields': 0,
'op': 'none',
'opid': 0,
'query': {},
'threadId': '0x7fa7bfffe700',
'waitingForLock': False},
{'active': False,
'desc': 'clientcursormon',
'lockStats': {'timeAcquiringMicros': {},
'timeLockedMicros': {}},
'ns': '',
'numYields': 0,
'op': 'none',
'opid': 0,
'query': {},
'threadId': '0x7fa7c1e01700',
'waitingForLock': False},
{'active': False,
'desc': 'snapshotthread',
'lockStats': {'timeAcquiringMicros': {},
'timeLockedMicros': {}},
'ns': '',
'numYields': 0,
'op': 'none',
'opid': 0,
'query': {},
'threadId': '0x7fa7c2802700',
'waitingForLock': False},
{'active': False,
'client': '192.168.101.43:52230',
'connectionId': 15,
'desc': 'conn15',
'lockStats': {'timeAcquiringMicros': {},
'timeLockedMicros': {}},
'ns': '',
'numYields': 0,
'op': 'killcursors',
'opid': 22735367,
'query': {},
'threadId': '0x7fa7834fb700',
'waitingForLock': False},
{'active': False,
'client': '192.168.101.43:51872',
'connectionId': 13,
'desc': 'conn13',
'lockStats': {'timeAcquiringMicros': {},
'timeLockedMicros': {'r': 0, 'w': 18}},
'ns': 'kolibri.nodes',
'numYields': 0,
'op': 'update',
'opid': 22735070,
'query': {'_id': 'kolibri-236-237-155368'},
'threadId': '0x7fa7833fa700',
'waitingForLock': False}]}
The operation that seems to be stuck should be an update $push.
Another thing I tried was db.last_status():
{'connectionId': 15, 'err': None, 'n': 0, 'ok': 1.0}
Can someone help me make sense of this and maybe give some advince (for beginners), how to check what’s going on and maybe some useful operations for common errors?
Mongodb has a number of tools that provide some transparency in whats going on within your system. You can try:
The first two should be included with your mongodb install. The third is available free from 10gen.