Mongodb vs Redis in Meteor

Slava Kim recently implemented Redis in Meteor with the livedata and miniredis packages. I’ve been curious how much faster it is than Mongodb. I’m stuck on a plane so it’s either this or watch Dolphin Tale 2.

Write, read and delete 1,000 times.

On the client.

redis set: 228ms
redis get: 18
redis del: 189
redis total: 435
mongo insert: 365
mongo findOne: 3533
mongo remove: 131
mongo total: 4129

write: redis 1.62 x faster
read: redis 20.2 x faster
delete: mongo 1.4 x faster
total: redis 9.5 x faster

On the server.

redis set: 303
redis get: 128
redis del: 156
redis total: 587
mongo insert: 842
mongo findOne: 890
mongo remove: 615
mongo total: 2347

write: redis 2.8 x faster
read: redis 7 x faster
del: redis 1.05 x faster
total: redis 4 x faster

Write, read and delete 10,000 times.

On the client.

redis set: 2656
redis get: 169
redis del: 1197
redis total: 4022
mongo insert: 5512
mongo findOne: 1346615
mongo remove: 8227
mongo total: 1360354

write: redis 2 x faster
read: redis 7968 x faster
delete: redis 6.8 x faster
total: redis 338 x faster

On the server.

redis set: 1626
redis get: 1362
redis del: 1810
redis total: 4798
mongo insert: 6744
mongo findOne: 18407
mongo remove: 20832
mongo total: 45983

write: redis 4.1 x faster
read: redis 13.5 x faster
delete: redis 11.5 x faster
total redis 9.6 x faster

Conclusion

Redis is fast! Especially at reading. FindOne with Minimongo on the client is slow.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store