MongoDB query performance comparison on Raspberry Pi 2 vs 3

Comparing MongoDB query performance on a 1M collection of user data.

We ran the same queries on a raspberry pi 2 and 3. We wanted to see how the speed of the hardware affected performance using the same version of mongo.

About The Data

Collection: 1M Users

dbhash: 0ee79bbb301d3759a6db2653c8138602
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 raspberry pi 3 executed this query in nearly half the time of the raspberry pi 2.

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

rPi2

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

rPi3

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

find 'starts with' $regex on string field

The raspberry pi 3 executed this query in nearly half the time of the raspberry pi 2.

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

rPi2

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

rPi3

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

aggregate $sum

The aggregate sum query completes the unanimous trio of queries executing almost twice as fast on the raspberry pi 3.

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

rPi2

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

rPi3

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