MongoDB 10-shard cluster vs. standalone server on Raspberry Pi 3's

How much faster is a 10-shard cluster over a standalone MongoDB server? We have the data.

This test was designed to see how much of a performance boost a 10 sharded cluster can yield over a standalone server. All servers are running mongodb v2.4 on raspberry pi 3 hardware.

About The Data

Collection: 3M Users

dbhash: 5b3992a0f623db11aa9223fe7300a376
download

Benchmark Methodology

  1. import data (mongorestore)
  2. execute set of pre-defined queries sequentially
  3. obtain query execution times from MongoDB profiling (system.profile)
  4. repeat steps 2 and 3 for a total of 10 times

find where array field length $gt 1

The 10 shard cluster executed this query nearly 3 times faster than a standalone. Both are running mongodb v2.4.

{"$where":"this.pets.length > 1","$comment":"q1"}

rPi3

v2.4 32bit 0 shards EXT4 Raspbian Jesse
121,636 ms

rPi3 (c10)

v2.4 32bit 10 shards EXT4 Raspbian Jesse
44,114 ms

find 'starts with' $regex on string field

The 10 shard cluster executed this query nearly 3 times faster than a standalone. Both are running mongodb v2.4.

{"firstName":{"$regex":"^bill"},"$comment":"q2"}

rPi3

v2.4 32bit 0 shards EXT4 Raspbian Jesse
4,317 ms

rPi3 (c10)

v2.4 32bit 10 shards EXT4 Raspbian Jesse
1,534 ms

aggregate $sum

The aggregate sum query is the exception executing only 20% faster. MongoDB clusters require an extra step of aggregating the aggregates from each shard, hence why the limited performance gains.

[{"$match":{"$comment":"q3"}},{"$group":{"_id":"$firstName","incomeSum":{"$sum":"$income"}}}]

rPi3

v2.4 32bit 0 shards EXT4 Raspbian Jesse
8,585 ms

rPi3 (c10)

v2.4 32bit 10 shards EXT4 Raspbian Jesse
6,683 ms