Netflix CDN

Introduction You are netflix. Now your main servers are hosted in the USA, however, you have users all over the world. Now suppose, a user from India request a video (movie/TV etc.) that is hosted in a USA data center. To serve the request, you need to transmit data all across the world, which increases the users latency and makes up for a bad user experience. And if there are millions of users in India, requesting data from USA, then the network will become like red hot steel. ...

September 24, 2025 · 3 min · abdulrahim

The design of twitter

Introduction Firstly I would like to talk about the scale of twitter, which will help us to understand the requirements of a system like twitter. Twitter handles about 600 tweets per second. Which means that approximately 600 tweets are made each second. On the contrary, approximately 60,000 tweets are read each second. This clearly shows that twitter is a read heavy system. There are approximately 300 million users of twitter. Some of them are active users (users who frequently visit twitter), while most of them are passive users (i.e. users who’d only visit once in a while, say 1 month). ...

September 24, 2025 · 9 min · abdulrahim

Leetcode 715: Range Module in 6 line python. The epitome of python sorcery demystified

Leetcode 715. Range Module is one of the most convoluted problems on leetcode. And your confidence is further shattered when you find out, that it can be solved in just 6 lines of code. Upon seeing these 6 lines, you realize that this is nothing less than a rosetta stone. In this blog post, I will run the code through all possible edge cases by hand. Range Module A Range Module is a data structure that tracks intervals of numbers using half-open ranges [left, right). It supports adding, querying, and removing ranges efficiently. ...

August 8, 2025 · 9 min · abdul

How to use psql

Launching psql session In my previous blog, I described how you can set up a postgresql server. In this post, we will learn, what are some of the basic commands in psql and how can we efficiently interact with it. To launch the psql terminal interface, you need to log into the postgres user or the username that created the postgresql server. This can be done using the su command. ...

August 5, 2025 · 4 min · abdul

How to deply a postgresql server

Database Cluster A database cluster is a collection of databases that is managed by a single instance of a running database server. In this post, we will talk about how to create a database cluster. Prerequisites The data created by postgresql is stored on the host file system in a directory called data directory. You can choose any directory to be data directory for example: /usr/local/pgsql/data or /var/lib/pgsql/data. The data directory is initialized using a program called initdb which comes with standard postgresql-server installation. ...

August 4, 2025 · 3 min · abdul