Despite its drawbacks, DNS is brilliantly designed for scale. We can learn few lessons from this protocol especially when designing our own apps. Heard of partitioning? DNS is one of the first protocols that implemented it successfully.
If you’ve been to a hotel often you would see a sign looking something like this on the way to your room. This helps finding rooms convenient and fast especially if the hotel has many rooms.
Take a hotel with 9 floors. Your room number is 917. The first step is to find which floor your room is at, usually the first digit represents the floor. This means your room is on the 9th floor
You just went immediately to your floor. without this knowledge you would have searched every single floor in the hotel to find your room.
When allocating items like arrays, strings or integers, they usually go to random places in the process memory. This leaves small gaps of unused memory scattered across the physical memory, a problem referred to as fragmentation.
Fragmentation occurs when gaps between allocated items continue to increase. This makes it difficult to find a contiguous block of memory large enough to hold new items. Technically there might be enough memory for the item but the memory is scattered all over the physical space
The brilliance of @ShopifyEng database engineering (a thread)
Shopify’s idempotency token is time based ULID, because these are unique which provide the idempotency) and also ordered by time requests can be quickly looked up in index and guess what! chances that you are querying requests that are next to each other temporally
which means the B+Tree leaf page is hot and cached in the buffer pool. The next request query will most probably hit the page cache in db because it is ordered by time. Most queries are for requests that are temporly next to each other.
I like debugging connection problems to backend applications and databases. I ran into an interesting one with SQL Server on aws and thought I’ll share it here (thread)
Had two security groups one has the database replicas (sgDB) and the other has the backend applications (sgBK) added a rule so Port 1433 is allowed from sgBK to sgDB.
But I still could not connect! From the same SS DB machine I could connect just fine using ipv4 loopback localhost and also I can connect using the hostname.
My approach for designing and architecting software. I thought might help some of you guys.
I block 2-3 hours of uninterrupted time slots. No meetings, emails or any notification. I use a note app that is clutter free (I use write-monkey for Windows & Focus for Mac) full screen dark mode. This way its only me and what I type.
I first start writing the workflow of how the software will be used in detailed length. I leave nothing out. There is a magical thing of stating the obvious that helps the ideas and creativity freely roam. This step produces many questions to the project's stakeholders