Blogging is a conversation, not a code.

Redis vs. MongoDB Performance

November 18th 2013, 12:20 pmCategory: Web 4 comments
4 comments

Maciej January 2nd 2014, 2:27 am

What 'save' settings were used for redis?

Alex Schleber January 10th 2014, 4:09 pm

Hmmm... not sure about this, just going dirt simple off of the Mongo shell I get the following for 50k writes (~ 2,000 millis):
---

NOTE: not even sure what the Write Concern is coming from the shell, will test out in Node next with {w:1} or {w:0}...

> ts1=new Date(); for(var i=0; i<50000; ++i) { db.tss2.insert({a:99}); } ts2=new Date()
ISODate("2014-01-10T22:57:35.072Z")
> took = ts2 - ts1
1974

> ts1=new Date(); for(var i=0; i<50000; ++i) { db.tss2.insert({b:"abcdefgh"}); } ts2=new Date()
ISODate("2014-01-10T22:56:19.110Z")
> took = ts2 - ts1
2162

> db.tss2.stats()
{
"ns" : "test.tss2",
"count" : 100000,
"size" : 3800020,
"avgObjSize" : 38.0002,
"storageSize" : 5591040,
...
"indexSizes" : {
"_id_" : 3262224
...

Chrys August 1st 2014, 12:52 pm

In the latest releases of drivers, Mongo has tried to make all drivers uniform, I believe most of them use WriteConcern.ACKNOWLEDGED {w:1} by default now. You could use w:0, UNACKNOWLEDGED to see if you get similar results, however this would be un-reflective of most production cases where it is usually preferable to have w:1+ and/or JOURNALED entries as well. In that regards, I believe redis still beats Mongo.

Ganesh October 28th 2014, 3:19 am

For larger entries, Redis has remarkable superiority over mongo. What about in case of larger data to read and write??

Leave a Comment