MongoRocks is deprecated in Percona Server for MongoDB 3.6.

MongoRocks is deprecated in Percona Server for MongoDB 3.6 and it will be fully removed in the next major version of Percona Server for MongoDB. Feature compatibility version is set to 3.4 when using Percona Server for MongoDB 3.6 with MongoRocks, so 3.6 features, such as retryable writes and causal consistency, cannot be used. Additionally, read concern majority may produce unreliable results.

If you are using MongoRocks with Percona Server for MongoDB 3.4 or older, we strongly encourage you to migrate from MongoRocks to WiredTiger before upgrading to Percona Server for MongoDB 3.6. Instructions on how to change storage engines are located in this Percona blog post:

If you install Percona Server for MongoDB 3.6 with the RocksDB storage engine, you will receive the following error message when trying to start mongod:

[ERROR] There are known issues with MongoDB 3.6 and MongoRocks. To learn about these issues and how to enable MongoRocks with Percona Server for MongoDB 3.6, please read, terminating


changing feature compatibility version to 3.6 when using MongoRocks will produce the following error: storage engine does not support upgrading featureCompatibilityVersion to 3.6

To continue using Percona Server for MongoDB 3.6 with MongoRocks, use one of the following two methods:

Add --useDeprecatedMongoRocks to mongod startup options Update the config file with the following parameter:
engine: rocksdb
useDeprecatedMongoRocks: true

MongoRocks is a storage engine for MongoDB based on the RocksDB key-value store optimized for fast storage. It is developed by Facebook and designed to handle write-intensive workloads.

The MongoRocks storage engine is available in Percona Server for MongoDB along with the standard MongoDB engines (the original MMAPv1 and the default WiredTiger), as well as Percona Memory Engine.

Using MongoRocks

As of version 3.2, Percona Server for MongoDB runs with WiredTiger by default. If you still would like to use the deprecated MongoRocks storage engine, please use the --storageEngine rocksdb command-line option accompanied by --useDeprecatedMongoRocks when you start mongod. Alternatively, you can set the storage.engine and useDeprecatedMongoRocks variables in the configuration file (by default, /etc/mongod.conf) as shown below.

Data created by one storage engine is not compatible with other storage engines, because each one has its own data model. When changing the storage engine, you have to do one of the following:

  • If you simply want to temporarily test MongoRocks, change to a different data directory with the --dbpath command-line option:

    $ service mongod stop
    $ mongod --storageEngine rocksdb --useDeprecatedMongoRocks --dbpath <newDataDir>


    Make sure that the user running mongod has read and write permissions for the new data directory.

  • If you want to permanently switch to MongoRocks and do not have any valuable data in your database, clean out the default data directory and edit the configuration file:

    $ service mongod stop
    $ rm -rf /var/lib/mongodb/*
    $ sed -i '/engine: .*rocksdb/s/#//g' /etc/mongod.conf
    $ service mongod start
  • If there is data that you want to migrate and make compatible with MongoRocks, use the mongodump and mongorestore utilities:

    $ mongodump --out <dumpDir>
    $ service mongod stop
    $ rm -rf /var/lib/mongodb/*
    $ sed -i '/engine: .*rocksdb/s/#//g' /etc/mongod.conf
    $ service mongod start
    $ mongorestore <dumpDir>

Configuring MongoRocks

You can configure MongoRocks using either command-line options or corresponding parameters in the /etc/mongod.conf file. The configuration file is formatted in YAML. For example, the following sample configuration is suggested as the default for running Percona Server for MongoDB with MongoRocks:

  engine: rocksdb
  useDeprecatedMongoRocks: true
    cacheSizeGB: 1
    compression: snappy
    maxWriteMBPerSec: 1024
    crashSafeCounters: false
    counters: true
    singleDeleteIndex: false

Setting parameters in the previous example configuration file is the same as starting the mongod daemon with the following options:

mongod --storageEngine=rocksdb \
  --useDeprecatedMongoRocks \
  --rocksdbCacheSizeGB=1 \
  --rocksdbCompression=snappy \
  --rocksdbMaxWriteMBPerSec=1024 \
  --rocksdbCrashSafeCounters=false \
  --rocksdbCounters=true \

The following options are available (with corresponding YAML configuration file parameters):

option --rocksdbCacheSizeGB
Default:30% of physical memory

Specifies the amount of memory (in gigabytes) to allocate for block cache. Block cache is used to store uncompressed pages. Compressed pages are stored in kernel’s page cache.

To configure block cache size dynamically, set the rocksdbRuntimeConfigCacheSizeGB parameter at runtime:

db.adminCommand({setParameter:1, rocksdbRuntimeConfigCacheSizeGB: 10})
option --rocksdbCompression

Specifies the block compression algorithm for data collection. Possible values: none, snappy, zlib, lz4, lz4hc.

option --rocksdbMaxWriteMBPerSec
Default:1024 (1 GB/sec)

Specifies the maximum speed at which MongoRocks writes to storage (in megabytes per second). Decrease this value to reduce read latency spikes during compactions. However, reducing it too much might slow down writes.

To configure write speed dynamically, set the rocksdbRuntimeConfigMaxWriteMBPerSec parameter at runtime:

db.adminCommand({setParameter:1, rocksdbRuntimeConfigMaxWriteMBPerSec:30})
option --rocksdbCrashSafeCounters

Specifies whether to correct counters after a crash. Enabling this can affect write performance.

option --rocksdbCounters

Specifies whether to use advanced counters for MongoRocks. You can disable them to improve write performance.

option --rocksdbSingleDeleteIndex

This is an experimental feature. Enable it only if you know what you are doing.

Contact Us

For free technical help, visit the Percona Community Forum.
To report bugs or submit feature requests, open a JIRA ticket.
For paid support and managed or professional services, contact Percona Sales.