Fetching contributors…
Cannot retrieve contributors at this time
160 lines (111 sloc) 5.51 KB

Quick Start

This section describes how to run YCSB on MongoDB.

1. Start MongoDB

First, download MongoDB and start mongod. For example, to start MongoDB on x86-64 Linux box:

tar xfvz mongodb-linux-x86_64-*.tgz
mkdir /tmp/mongodb
cd mongodb-linux-x86_64-*
./bin/mongod --dbpath /tmp/mongodb

Replace x.x.x above with the latest stable release version for MongoDB. See for installation steps for various operating systems.

2. Install Java and Maven

Go to

and get the url to download the rpm into your server. For example:

wget -o jdk-7u40-linux-x64.rpm
rpm -Uvh jdk-7u40-linux-x64.rpm

Or install via yum/apt-get

sudo yum install java-devel

Download MVN from

sudo tar xzf apache-maven-*-bin.tar.gz -C /usr/local
cd /usr/local
sudo ln -s apache-maven-* maven
sudo vi /etc/profile.d/

Add the following to

export M2_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}

Reload bash and test mvn

mvn -version

3. Set Up YCSB

Download the YCSB zip file and compile:

curl -O --location
tar xfvz ycsb-0.5.0.tar.gz
cd ycsb-0.5.0

4. Run YCSB

Now you are ready to run! First, use the asynchronous driver to load the data:

./bin/ycsb load mongodb-async -s -P workloads/workloada > outputLoad.txt

Then, run the workload:

./bin/ycsb run mongodb-async -s -P workloads/workloada > outputRun.txt

Similarly, to use the synchronous driver from MongoDB Inc. we load the data:

./bin/ycsb load mongodb -s -P workloads/workloada > outputLoad.txt

Then, run the workload:

./bin/ycsb run mongodb -s -P workloads/workloada > outputRun.txt

See the next section for the list of configuration parameters for MongoDB.

Log Level Control

Due to the mongodb driver defaulting to a log level of DEBUG, a logback.xml file is included with this module that restricts the org.mongodb logging to WARN. You can control this by overriding the logback.xml and defining it in your ycsb command by adding this flag:

bin/ycsb run mongodb -jvm-args="-Dlogback.configurationFile=/path/to/logback.xml"

MongoDB Configuration Parameters

  • mongodb.url

  • mongodb.batchsize

    • Useful for the insert workload as it will submit the inserts in batches inproving throughput.
    • Default value is 1.
  • mongodb.upsert

    • Determines if the insert operation performs an update with the upsert operation or a insert. Upserts have the advantage that they will continue to work for a partially loaded data set.
    • Setting to true uses updates, false uses insert operations.
    • Default value is false.
  • mongodb.writeConcern

    • Deprecated - Use the w and journal options on the MongoDB URI provided by the mongodb.url.
    • Allowed values are :
      • errors_ignored
      • unacknowledged
      • acknowledged
      • journaled
      • replica_acknowledged
      • majority
    • Default value is acknowledged.
  • mongodb.readPreference

    • Deprecated - Use the readPreference options on the MongoDB URI provided by the mongodb.url.
    • Allowed values are :
      • primary
      • primary_preferred
      • secondary
      • secondary_preferred
      • nearest
    • Default value is primary.
  • mongodb.maxconnections

    • Deprecated - Use the maxPoolSize options on the MongoDB URI provided by the mongodb.url.
    • Default value is 100.
  • mongodb.threadsAllowedToBlockForConnectionMultiplier

    • Deprecated - Use the waitQueueMultiple options on the MongoDB URI provided by the mongodb.url.
    • Default value is 5.

For example:

./bin/ycsb load mongodb-async -s -P workloads/workloada -p mongodb.url=mongodb://localhost:27017/ycsb?w=0

To run with the synchronous driver from MongoDB Inc.:

./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://localhost:27017/ycsb?w=0