In the memory storage engine, the files on disk never actually get smaller. That means if they grow large, they will continue to stay large forever. When you free up space in the database by clearing keys, it should be the case that you start using less of the file, and therefore the extra space allocated is available for future use by the database process.
If you need to reclaim the space for other purposes (e.g. other uses on the host besides the database) or you just want the files to be physically smaller, then there are some tricks you can use to cause this change to occur. One is to convert your storage engine to another (e.g.
ssd) and back, which will cause it to rewrite the files. If you do this, I think you’ll need to wait for the conversion to complete and the
memory storage engine files to be deleted before switching back. Note that if you do this, your storage requirements will temporarily go up as you’ll be storing data in both formats. Also, you’ll of course be changing to have the performance properties of the
ssd storage engine, and depending on what you’re doing this may not be acceptable.
Another option is to use exclude. The goal will be to exclude every process in the cluster so that it deletes its data files and you end up with a bunch of new smaller files at the end. There are a variety of ways you could accomplish this, such as:
- migrate to an entirely new set of hosts (add 3 new nodes, exclude the 3 old nodes, and let the data move)
- exclude processes one at a time until removed, then add it back (note that in this procedure, your files will get somewhat larger than the baseline requirements because of data movement to remove excluded processes)