The design of a Search Engine

Introduction First let’s start with a similar problem akin to web search. Imagine you have 100 files in your current directory, and you do something like: 1 grep "Abdul" . The grep program will return you a list of files which contain the given string or pattern. But how do you think does that works under the hood. In a naive approach, the grep program would open each file in the directory, search for the given string/pattern and if any result is obtained, then add this file to the output list. ...

September 25, 2025 · 3 min · abdulrahim

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