Databases | System Design Part - 2

This is part 2 in the SYSTEM DESIGN SERIES, where we are going to discuss each and every topic which helps the system to withhold zero to million users at any point in time without breaking down

In the previous part, we have discussed the Single Server Setup where web and data tiers lie in the same server. However with the increase in the demand for our website, it would be tough to scale by keeping both on the same server, Hence we need multiple servers where we store the web/mobile traffic [web tier] in one server and other for database [data tier]. One of the major advantages in separating them is, we can scale the web and data tiers independently





From the above figure, we can clearly depict that there are few requests between server and database for data that will be further moved to the user for rendering purpose


I personally know a lot of people who are confused in choosing the right database for their project, Mostly it is because of lack of understanding of the basic idealogy behind the databases which make them scratch their heads

Let's discuss different kinds of databases and which one is used when

There are two types of databases, one is a traditional relational database and the other one is a non-relational database

Traditional Relation Databases : 

  • These are also called relational database management systems or SQL databases, the most popular ones are MySQL, Oracle database, PostgreSQL, etc.
  • These store data in tables and rows format
  • We can perform join operations on these relational databases using SQL across different tables

Non-Relational Database :

  • Non-Relational databases are also called NoSQL databases. Popular ones are MongoDB, Cassandra, HBase, Amazon DynamoDB, etc
  • These databases are grouped into four categories: key-value stores, graph stores, column stores, and document stores
  • Non-relational databases does not support Join operations


Relational databases are there around the corner for over 40 years, Lot of people built many successful products using these databases and they are working perfectly.

However, with the increase in the user base and the amount of data that is being circulated around the world is humongous. on top of it, the data that is being collected now a days is not having any relation between them like data from website clicks, sensor movements, popularity of a product in specific region, etc. which make the system architects and developers think of using non-relational databases 

Non-relational databases might be the right choice if: 

  • Your application requires low latency. 
  • Your data are unstructured, or you do not have any relational data.
  • You only need to serialize and deserialize data (JSON, XML, YAML, etc.).
  • You need to store a massive amount of data


Now we are good with understanding web / database tier, In the next article we will focus on how we can scale our web servers using load balancer and cater thousands of requests without impacting the server crash.

Comments

Popular posts from this blog

A complete guide to K-means clustering algorithm

What is Exploratory Data Analysis? | Part 1

COMPARABLE VS COMPARATOR