0

We are planning to build a social media application, lets say similar to Instagram but at much smaller scale, of course.
The users could be from many geographies like US, Europe, Asia who could interact on same post.
We are evaluating a NoSQL database choice for our use-case where we want:

  • optimal reads at the same time making writes(lets say comments/likes) not noticeably slow.
  • flexible schema, preferably json documents
  • okayish transaction support as it is needed only in few operations and hence we can take a latency hit

We evaluated MongoDB, and with replica set support we can serve reads from local geography(say NA replica for NA users etc) but since there is single master/primary, writes could be slow for some geography(e.g master is in Europe and write came from Australia).
Any help on this would be great.

Note: If you feel this question is broad/needs more info, please comment first before downvoting! I will make sure to add all details that is needed.

  • While I can't specifically offer advice on optimizing MongoDB, I highly recommend you read this DBA.StackExchange answer I coincendentally wrote for another question asking about the purpose of a NoSQL database and doing a little more research before choosing MongoDB for the sole reason of trying to make querying performant. Also, as a point of reference of my experience, I've worked with traditional RDBMS in the financial tech. industry that were heavily transactional with larger tables (10+ billion rows) on modest hardware. – J.D. Feb 27 '21 at 05:15
  • 1
    @J.D. I went through the answer and post that updated my question to reflect the need for NoSQL. We want to benefit from NoSQL's schemaless OR rather no schema-on-write support. Also I am aware that RDBMS like Postgres supports Json fields but we would want native json document support as in Mongo. Plus the benefits of sharding. – Saurav Prakash Feb 27 '21 at 05:21
  • Cool sounds good, just wanted to make sure you were aware there's no inherent performance difference between the two types of database systems. Btw unless your queries need to run in the realm of microseconds, globalization of your database nodes shouldn't noticeably affect your performance in either type of system as well. It is standard for data to live in multiple parts of the world (database system independent), e.g. if you were using AWS as your server host and had multiple Regions and Availability Zones setup. More so, what you might see with a NoSQL database system is... – J.D. Feb 27 '21 at 13:24
  • ...the eventual consistency aspect, where a change on one node doesn't immediately replicate to the other nodes. I suppose sharding in such a way that you don't need to replicate changes outside of the current node might be a way to architect it though too. In any case, good luck! If I knew more than just the theory side, I'd offer an up an answer, but I've only done a little bit of NoSQL in actual practice. – J.D. Feb 27 '21 at 13:26

0 Answers0