Dive into extra topics to take your system design skills further. We'll explore:
There is no such thing as the cloud. Servers are always kept in a data center.
If you try to host your website, you will need servers for that. Instead of buying and maintaining physical servers yourself for your website, why don’t you rent them?
This is where Cloud Computing comes in. With cloud computing, you can rent computing resources from providers like:
- AWS (Amazon Web Services)
- Google Cloud
- Microsoft Azure
This allows you to focus on your website while they handle the infrastructure.
Logging is like a computer writing in a diary.
- It records everything important like errors and key activities.
- These records are called logs.
- These logs can be used to fix problems (troubleshooting) and also for data analysis.
Monitoring is like keeping a close watch on a computer.
- When we monitor, we constantly check that everything is working properly.
- If there are any issues, we catch them and fix them.
- It's like having a security camera on a computer.
Think of a library where each new book gets a numeric code. The librarian uses this code to quickly put the book on the right shelf.
To find a book, the system uses this code, which is much faster than searching by title.
Hashing is very similar. It converts data into a short, random, unique code. This code helps efficiently place and locate data in a system.
Let’s say we need to reorganize our bookshelves. However, if we do so, we would need to change the codes of a lot of books.
-
If we remove shelf number 2, then:
- Shelf 3 becomes the new shelf 2.
- Shelf 4 becomes the new shelf 3.
-
Suppose we had a book called "The Alchemist" on shelf 3, coded as 3B.
-
Now, since our old shelf 3 is the new shelf 2, "The Alchemist" should have a new code 2B.
This means we would need to update our system with the new codes for all books.
Imagine someone wants to borrow "The Alchemist". If our system isn't updated, it will still show the book at code 3B.
- The librarian goes to shelf 3B but cannot find "The Alchemist" there.
- Instead, she finds a different book.
- The system is now inaccurate, causing confusion.
Therefore, updating all book codes whenever we reorganize shelves is a big hassle.
Consistent Hashing, a special type of hashing, is a smart algorithm that minimizes these reorganizations.
- Even if shelves change, most books will still keep their original codes.
- Only a few books need to be changed, making it much easier to manage.
We won’t go deep into how it works, as that would be out of the scope of this course. Just imagine it as a magic algorithm that helps minimize all these reorganization hassles.
Ideally, you would want your system to be both consistent and available.
Let's say an accident happens that creates a partition in our system.
How will you tolerate the partition?
The CAP theorem states that you can either make your system available or consistent, but you cannot have both at the same time.
Consider there is a social media company called SweetBook. They have servers all around the world.
- At 3:00 PM, an accident happens, and the connection between their New York and San Francisco servers is lost.
They have a partition now. - At 3:30 PM, your friend in New York posts something on social media.
-
If SweetBook prioritizes availability
- The site remains accessible.
- However, you won't see the new post from your friend in New York—only posts from local San Francisco users.
-
If SweetBook prioritizes consistency
- You might see a message like "Website not available" when trying to access it from San Francisco.
- This ensures that all users see the same, up-to-date data.
You cannot have both availability and consistency at the same time in the presence of a partition.







