Consistent Hashing

Consistent Hashing is one of the most sought after techniques when it comes to designing highly scalable distributed systems. In this article, we dive deep into the need for Consistent Hashing, the internals of it, and more importantly along the way implement it using arrays and binary search.

24th May 2020

Python Caches Integers

To gain a performance boost and avoid reallocation of frequently used integers, Python creates singleton instances of small integer values and uses them by reference.

17th May 2020

Fractional Cascading - Speeding up Binary Searches

The performance of binary search when applied on k lists independently can be improved using bridges and the technique is called Fractional Cascading. Fractional Cascading also sees its application in Geometric Data Structures, Segment Trees, and Databases.

10th May 2020

Copy-on-Write Semantics

Copy-on-write is used to model Time Travel, build databases with no locks, and makes the fork system call super-efficient.

3rd May 2020

What makes MySQL LRU cache scan resistant

The MySQL InnoDB Storage engine uses LRU cache but it suffers from a notorious problem. In this article, we find how by using Midpoint Insertion Strategy and changing one aspect of LRU, MySQL becomes scan resistant and super performant.

26th Apr 2020

Building Finite State Machines with Python Coroutines

The most intuitive way of building and implementing Finite State Machines is by using Python Coroutines and in this article, we find how and why.

19th Apr 2020

Solving an age-old problem using Bayesian Average

Ranking a list of movies, products, books or even restaurants is tricky and in this article, we find what works for such a rating system and the math behind it.

12th Apr 2020

Designing a sliding window based rate limiter

A rate limiter is used to control the rate of traffic sent or received on the network and in this article we dive deep and design a sliding window based rate limiter.

5th Apr 2020

All you need to know about Inverse Document Frequency

TF-IDF is extensively used in search engines and in various document classification and clustering techniques. Instead of taking the formula by the word, we take a detour and dive deep into the better half of it and find its connection with Probability, the role it plays in document relevance and the intuition behind it.

6th Mar 2020

Eight rituals to be a better programmer

"How to get better at programming?" is the question I had been asked quite a few times, and today I lay down the 8 rituals I have been following, and action items for each, to be good and get better at programming.

28th Feb 2020

Personalize your python prompt

Personalization is what we all love. In this article we find how we could personalize the Python interpreter prompt >>>

21st Feb 2020

Pseudorandom numbers using Cellular Automata - Rule 30

Generating pseudorandom numbers is an interesting problem in Computer Science. In this article, we dive deep into an algorithm for generating pseudorandom numbers using Rule 30 of Cellular Automaton.

14th Feb 2020

Function overloading in Python

Python natively does not support function overloading - having multiple functions with the same name. Today we see how we can implement and add this functionality to Python by using common language constructs like decorators and dictionaries.

7th Feb 2020

Isolation Forest algorithm for anomaly detection

Anomaly detection is an age-old problem and in this article, we dive deep into an unsupervised algorithm, Isolation Forest, that beautifully exploits the characteristics of anomalies. Instead of profiling normal points and labeling others as anomalies, the algorithm is actually is tuned to detect anomalies.

28th Jan 2020

Everything that you need to know about Image Steganography

Steganography has been around since at least 440 BCE but with the rise of computers, the techniques have evolved to handle digital data. In this article, we see the science behind image steganography, how it exploits various properties of images to hide secrets and walkthrough a few techniques in detail.

17th Jan 2020

How python implements super long integers?

Python must be doing something beautiful internally to support super long integers and today we find out what's under the hood. The article goes in-depth to explain design, storage, and operations on super long integers as implemented by Python.

10th Jan 2020

I changed my Python and made it dubious | Python Internals

I changed the Python's source code and made addition incorrect and unpredictable. The addition operation will internally perform either Subtraction. Multiplication, Floor Division or Power at random.

3rd Jan 2020

An efficient way to stop an iterating loop

There are two ways through which we can stop an iterating loop, first by using break statement and second by making loop condition false. Let's see if one is better than the other.

6th Sep 2019

Fast and Efficient Pagination in MongoDB

MongoDB is a document based data store and hence pagination is one of the most common use case of it. Find out how you can paginate the results ...

6th Jun 2017

Benchmark and compare the two approaches to paginate in MongoDB

Benchmark results for two pagination approaches for MongoDB.

2nd Jun 2017

Why MongoDB's cursor.skip() is slow?

MongoDB's cursor.skip() is very inefficient, why is that? Even though it is slow and inefficient, team MongoDB wants to continue keeping it. Find out why ...

4th Jun 2017

How Sleepsort helped me understand concurrency in Golang

Understanding concurrency in any programming language is tricky let alone Golang; hence to get my hands dirty the first thing I usually implement is sleepsort.

16th Jul 2017

Make HTTP requests using netcat

All our lives we have been hitting REST APIs with libraries and utilities like curl and postman. Its time we do it the hard way with netcat, just for fun!

5th Jul 2017

Multiple MySQL server running on same Ubuntu server

Have multiple MySQL versions running on same server within 5 minutes.

13th May 2016

Setting up Graphite using Nginx on an Ubuntu server

Part 1: Monitor your production systems and application analytics using Graphite. This article will help you setup these tools on Ubuntu 14.04 on a Nginx webserver with PostgreSQL as backend.

14th Dec 2015

Setting up Graphite and Grafana on an Ubuntu server

Part 2: Monitor your production systems and application analytics using Graphite. This article will help you setup these tools on Ubuntu 14.04 on a Nginx webserver with PostgreSQL as backend.

14th Dec 2015

Publish python package on PyPI

If you have written something cool in Python and want to make it installable via pip and easy_install, this post will help you publish your python online.

10th Nov 2015