I just browsed the MongoDB database of my tiny test forum and it's quite apparent that dropping Redis support could mean a HUGE win for the cleanness and (I think) performance of MongoDB. There is a lot of redundancy at the moment, there are lots of strangely linked items. Small example:
{
"_id" : ObjectId("5989ba5986d1235ea0696381"),
"_key" : "event:15",
"type" : "plugin-activate",
"text" : "nodebb-plugin-calendar",
"timestamp" : 1502198361021.0,
"eid" : NumberInt(15)
}
is linked to:
{
"_id" : ObjectId("5989ba5986d1235ea0696380"),
"_key" : "events:time",
"value" : "15",
"score" : 1502198361021.0
}
That doesn't really make sense to me
I'm not exactly an expert on NoSQL databases, but it's hard for me to see how MongoDB can perform with a non-trivial amount of data. What would happen if I would dump 100MM posts in there?
The current use of the DB also looks a lot like a relational database:
A post:
{
"_id" : ObjectId("598999cf86d1235ea06962af"),
"_key" : "post:1",
"pid" : NumberInt(1),
"uid" : NumberInt(1),
"tid" : NumberInt(1),
"content" : "# Welcome to your brand new NodeBB forum!\n\n[blabla]",
"timestamp" : 1502190031774.0,
"deleted" : NumberInt(0)
}
A topic:
{
"_id" : ObjectId("598999cf86d1235ea06962a9"),
"_key" : "topic:1",
"tid" : NumberInt(1),
"uid" : NumberInt(1),
"cid" : NumberInt(2),
"mainPid" : NumberInt(1),
"title" : "Welcome to your NodeBB!",
"slug" : "1/welcome-to-your-nodebb",
"timestamp" : 1502190031763.0,
"lastposttime" : 1502199185012.0,
"postcount" : NumberInt(4),
"viewcount" : NumberInt(30),
"locked" : NumberInt(0),
"deleted" : NumberInt(0),
"pinned" : NumberInt(0),
"teaserPid" : "4"
}
These two are linked through 'tid' which makes a lot of sense in an RDBM context. In MongoDB I would have expected one document per topic or something like that?
In mongodb single collection? a 'delete' example is given as a reason for going with NoSQL. But you can't just do: db.delete('topic:1');
because that would miss all posts, read indicators, subscriptions, etc, etc. (If I'm not missing something)
All this:
https://github.com/NodeBB/NodeBB/blob/master/src/topics/delete.js
is needed to delete a topic.
But, as I said, my NoSQL experience is really very limited. Could be that my expectations of NoSQL are too high (or too low when it comes to performance).
I'm curious though what the plans are for the NodeBB datastore(s) for the future. Is Redis support going to be dropped? Have there been tests regarding the scalability of the current schema(lessness)? Are there plans to support RDBMSes?
Also curious why NoSQL was picked as the datastore. A forum doesn't seem like a very natural fit for NoSQL? The schema is fixed, there are lots and lots of relationships between tables/collections/objects.
In short:
- Is Redis going to be dropped?
- Is MongoDB able to handle more than a few posts (without a lot more hardware than an RDBMS)?
- Are there plans to support RDBMSes?