Time Asynchronous distributed systems consist of several processes without common memory. Each of them has its local clock. The only thing these processes have in common is the asynchronous network they use to communicate.
In-code documentation In-code documentation or comments are vital in helping engineers understand a system and work efficiently. However, many software engineers avoid writing comments with the following excuses: "Good code is self-documenting." "
System Design On Design by Contract Design by Contract (DBC) is a mindset to design software using Contract. It has several benefits: better maintainability: easier to read and understand code. easier to review code. easier to write unit tests.
[Reading distill] Practical Monitoring My note-taking while reading the book Practical Monitoring: Effective Strategies for the Real World. I only keep what I think is helpful, discard all unneccesary points. It is not a book summary. Monitoring
Algorithm Simple random sample Problem Choose a simple random sample, without replacement, of k items from a population of size n. Fisher-Yates shuffling for known n The basic idea is to shuffle the original array of n
Algorithm Quick note on Count-Min Sketch Problem Count the number of times elements appear in a stream of data. This can be solved easily by using a HashMap. However, data streaming is unbounded so we may end up out
Algorithm On All nearest smaller values problem 1. Background 1.1 All nearest smaller values problem Given an array A[0..n-1], for each element in A, search among the previous positions for the nearest position that contains a smaller
Algorithm On a side-effect of Merge Sort The problem Given an array A, we call (i, j) an important reverse pair if i < j and A[i] > 2*A[j]. Count the number of important reverse pairs. For
CS Deep dive into letter I in ACID Meaning of Isolation in ACID Most databases are accessed by multiple clients at the same time, which could lead to race condition issues when 1 transaction (txn) reads data that is concurrently modified
System Design Cache is evil !!! (Part 2) Cache invalidation problems Let's retake a look at the write path of the Look-Aside pattern: clear the cache for key k after updating the database. Easy as cake. Not really ... When your app
System Design Cache is evil !!! (Part 1) Cache is considered a great mechanism to increase performance in system design. However, it often comes with many critical problems such as inconsistency, the validity of data, cache delay... To make things worse,
Quick note on Go memory model Single goroutine excution order The compiler and processors may reorder the read and write exectuted within a single goroutine only when the reordering does not change the behaviour within that goroutine as defined
Algorithm A note on Stream Sync - The protocol behind Dropbox's sync performance Introduction File hosting services like Dropbox/ Google Drive require ability to sync files fast between clients. One of the simple techniques is to break the file into multiple fixed-size blocks so - we
System Design Point-region QuadTree and applications Point-region QuadTree (PR Quadtree) Introduction A rooted tree in which every node has 4 children: each node corresponds to a square in the plane each child of a node corresponds to a quadrant
CS A note on Java Garbage Collection (GC) 1. Basic What is GC: a process that looks at Heap memory and identifies which objects are in use and which are not, and deleting the unused objects. Eligibility to be GC: objects
CS Rate limiter algorithms's consideration High level design of Rate LimiterRequirement Limit the number of requests a user can send to an API within a time window: n requests/minute. Window size = 1 minute. The APIs are accessible
Security A note on CSRF attack and JWT authentication Questions What is CSRF? How to prevent CSRF? Is Same-Site Cookie the silver bullet? What is JWT authentication? Is using JWT enough to prevent CSRF? What are the considerations when implementing JWT authentication?
CS A note on Distributed Id Generator Problem Generate unique Id in distributed environment: each node can generate unique Ids. Ids need to be sortable. Snowflake a service developed by Twitter for generating Id fulfilling above requirements Snowflake structure: 64
CS Cookie security 101 What is it? a piece of data stored in browser. can be set by: client: via Javascript. server: via HTTP response header. cookie is automatically passed to server in header of request. cookies
CS A note on Consistent Hashing Rehashing problem Hash function a function that maps data of arbitrary size to fixed-size values h: U → {0, 1, . . . , m − 1}. example: h(x) = x % m collision: k1 != k2 and h(k1) == h(
CS From RSA, Diffie Hellman to TLS protocol Background The questions I want to answer: How RSA and Diffie Hellman work? Pros and cons? How TLS handshake works? Why do we need both RSA and DP in TLS, when seem like
CS A note on B-Trees and database indexes (part 2) BTree and database indexes 1. How data is stored in hard disk? Modern hard disk drives are addressed as large one-dimensional arrays of logical blocks, where the logical block is the smallest unit
CS A note on B-Trees and database indexes (part 1) Introduction Recently, I have several questions about BTree and its application - database indexes: What is BTree? Kind of a cool name, huh? What special properties make we use BTree for database indexes?
DevOps My experience with CKAD Background Certified Kubernetes Application Developer - CKAD is an exam developed by The Linux Foundation f.t Cloud Native Computing Foundation to certify your knowledge of Kubernetes (k8s) as a developer. What I
Algorithm A note on Detecting cycle - Floyd algorithm Problem Detect the cycle in a Linked list, return the starting Node of the cycle if any, otherwise return NULL. E.g: return Node 2 in following linked list: Algorithm Let fast and