MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Compaction requirements

Hi team,

First post here, so be kind :slight_smile:

I have two queries.

  1. I have a set of collections in a DB which haven’t been compacted in a while. I wanted to understand the memory and disk requirements of the compact command.

To clarify, I want to understand how much memory(and disk, if any is consumed) by the mongod process when I launch the compact command. This is to plan in advance if I need to stop other applications and ensure there’s enough disk space available.

  1. I know that compact is a blocking operation so if I start a compact command on a secondary node, when client(s) were connected to it, will the compact command wait for those reads to complete and then block all subsequent operations? Or will all client connections be terminated and those requests will be abruptly dropped?

Thanks for your inputs,
Murali