Sample Header Ad - 728x90

Mongo DB Tree Constant Balance Due High Delete/Chunk Migration/Shard Adding

0 votes
1 answer
27 views
We have huge collections that are having multiple indexes in mongodb with multiple shards. Since the deletion process is time consuming , and ttl mongo simply does not works, we have switched to semi automated process ( that is initialized from the code ). As part of development we have noticed that if we will remove the indexes before deletion started and rebuild them after delete completed , it works much faster then just deleting, even considering that indexes built takes close to 13 hours ( we rebuild indexes one after another ) Same problem happens on adding new shard to cluster, it is getting the data very slow, but if we delete all the indexes on all collections it works ultra fast. When we investigated problem further we have noticed that there is massive read/write on indexes, which is unproportional to data read/write ( we have separate disks for data , indexes and oplog ). The conclusion we have made is that indexes are getting rebuild ( even while set to be rebuild in background ) after every record deletion/migration. This is totally resource uneffective. Is there any way to suspend the indexes rebalance/rebuild after every operation for some time, or just manually? or at least decrease the number of such operation ( e.g not to do it after every op , but after every 1 million records, etc )? Best regards and glory to Ukraine Yulian Oifa
Asked by Yulian Oifa (1 rep)
Jun 17, 2025, 12:43 PM
Last activity: Jun 18, 2025, 06:10 AM