SOHIL LADHANI
  • Menu ▾
    • About
  • About

Quadtrees: When Fixed Grids Aren’t Enough

2026-03-12sohilladhani
#distributed-systems  #system-design  #architecture  #data-structures  #indexing 

Manhattan has 50,000 restaurants. Rural Wyoming has 3 per county. A fixed-size grid wastes cells on empty space and overloads dense areas. Quadtrees adapt.

[Read more]

Geohashing: Turning Coordinates into Searchable Strings

2026-03-11sohilladhani
#distributed-systems  #system-design  #architecture  #mysql  #indexing 

Your user is at latitude 37.7749, longitude -122.4194. Your database has 10 million locations. A full table scan comparing every coordinate pair isn’t going to work.

[Read more]

Work Stealing: Dynamic Load Balancing Without a Coordinator

2026-03-10sohilladhani
#distributed-systems  #system-design  #java  #performance  #architecture 

You split work evenly across 4 threads. Two finish in 10ms, two take 10 seconds. Half your CPU sits idle while the other half grinds. Work stealing fixes this.

[Read more]

Delayed Message Delivery: Execute This in 30 Minutes

2026-03-09sohilladhani
#distributed-systems  #system-design  #architecture  #java  #redis 

Send a reminder in 24 hours. Retry this job in 5 minutes. Expire this hold at midnight. Delayed execution is everywhere, and Thread.sleep isn’t the answer.

[Read more]

Leader Election: Picking One Node to Rule

2026-03-08sohilladhani
#distributed-systems  #system-design  #architecture  #java  #redis 

Three nodes, one job. Without leader election, all three run it simultaneously. With leader election, exactly one does the work while the others stand by.

[Read more]

MapReduce: Processing Data That Won’t Fit on One Machine

2026-03-07sohilladhani
#distributed-systems  #system-design  #architecture  #java  #performance 

Your dataset is 10TB. One machine can’t hold it, let alone process it. MapReduce splits the work across hundreds of machines with a deceptively simple API.

[Read more]

Trie Data Structures: Prefix Search in Milliseconds

2026-03-06sohilladhani
#data-structures  #system-design  #java  #algorithms  #performance 

User types three characters and expects instant suggestions. A hash map can’t do prefix lookups. A trie can, in O(k) time where k is the query length.

[Read more]

Inverted Indexes: How Search Actually Works

2026-03-05sohilladhani
#data-structures  #system-design  #java  #database  #distributed-systems 

A normal index maps documents to words. An inverted index maps words to documents. That reversal is why search is fast.

[Read more]

Checkpointing: Resuming Long-Running Jobs Without Starting Over

2026-03-04sohilladhani
#distributed-systems  #system-design  #architecture  #java  #patterns 

A batch job runs for three hours and crashes at hour two. Without checkpointing, you restart from zero. With it, you lose ten minutes of work.

[Read more]

Content Fingerprinting: Detecting Near-Duplicates at Scale

2026-03-03sohilladhani
#distributed-systems  #data-structures  #algorithms  #java  #system-design 

Exact duplicates are easy. Near-duplicates are hard. SimHash turns documents into compact fingerprints where similar content produces similar hashes.

[Read more]

Priority Queues in Distributed Systems

2026-03-02sohilladhani
#distributed-systems  #system-design  #architecture  #java  #redis 

FIFO queues treat every message equally. But urgent config updates shouldn’t wait behind a thousand bulk sync jobs. Priority queues fix this, if you handle starvation.

[Read more]

Reconciliation: When Your Systems Disagree

2026-03-01sohilladhani
#distributed-systems  #system-design  #architecture  #java  #observability 

Your database says one thing. The external system says another. Reconciliation is how you find the drift before your users do.

[Read more]

State Machines: Making Distributed Workflows Predictable

2026-02-28sohilladhani
#distributed-systems  #system-design  #architecture  #java  #patterns 

Boolean flags and status strings create impossible states. An explicit state machine tells you exactly where a workflow is, what transitions are valid, and how to recover.

[Read more]

Optimistic vs Pessimistic Concurrency: Locks vs Versions

2026-02-27sohilladhani
#distributed-systems  #database  #system-design  #java  #mysql 

Two users update the same row. Pessimistic locking blocks one until the other finishes. Optimistic locking lets both try and fails the loser. Choosing wrong kills either throughput or correctness.

[Read more]

Two-Phase Commit: The Original Distributed Transaction

2026-02-26sohilladhani
#distributed-systems  #system-design  #architecture  #java  #database 

Two-phase commit guarantees atomicity across multiple databases. It also blocks everything if the coordinator dies. Here’s why microservices moved on.

[Read more]

Input Validation and Abuse Prevention in Distributed Systems

2026-02-25sohilladhani
#security  #system-design  #architecture  #distributed-systems  #patterns 

Every public write endpoint is an abuse vector. Layered defense with validation, rate limiting, and async scanning keeps your system safe without killing performance.

[Read more]

Approximate Counting: HyperLogLog and Count-Min Sketch

2026-02-24sohilladhani
#distributed-systems  #data-structures  #system-design  #performance  #redis 

Counting unique items across billions of events. A HashSet needs gigabytes. HyperLogLog does it in 12KB. The trick is accepting a little error.

[Read more]

SLOs and Error Budgets: When Good Enough is a Number

2026-02-23sohilladhani
#observability  #system-design  #architecture  #distributed-systems  #performance 

100% availability is impossible and pursuing it wastes engineering time. SLOs turn reliability into a number you can reason about.

[Read more]

Base62 Encoding: Turning Numbers into Short Strings

2026-02-22sohilladhani
#system-design  #algorithms  #java  #architecture 

A 64-bit integer is 19 digits. Encode it in base62 and it’s 7 characters. The math behind compact, URL-safe identifiers.

[Read more]

Distributed ID Generation: Snowflake and Friends

2026-02-21sohilladhani
#distributed-systems  #system-design  #architecture  #java  #database 

Auto-increment IDs break the moment you have more than one database. Snowflake IDs, UUIDs, and database sequences each solve this differently.

[Read more]

Event Aggregation: When 47 Notifications Become One

2026-02-20sohilladhani
#distributed-systems  #system-design  #architecture  #patterns  #java 

Showing every individual event overwhelms users. Grouping related events into summaries is a distributed systems problem hiding as a UX problem.

[Read more]

Social Graphs at Scale: Storing Relationships in MySQL

2026-02-19sohilladhani
#mysql  #database  #system-design  #architecture  #performance 

A follows table with two columns seems trivial. Until you need to query it from both directions, across shards, for millions of users.

[Read more]

Relevance Scoring: Why Chronological Order Breaks Down

2026-02-18sohilladhani
#system-design  #architecture  #performance  #patterns  #algorithms 

Showing content in time order is simple until your users follow thousands of sources. Scoring and ranking turns a firehose into a useful stream.

[Read more]

Pre-Signed URLs: Uploading Files Without Touching Your Servers

2026-02-17sohilladhani
#system-design  #architecture  #performance  #java  #patterns 

Routing file uploads through your API server is a scaling bottleneck. Pre-signed URLs let clients upload directly to object storage.

[Read more]

Presence Systems: Who’s Online and How You Know

2026-02-16sohilladhani
#distributed-systems  #redis  #system-design  #architecture  #patterns 

Green dot means online. Simple, right? Behind that dot is a distributed system making heartbeat-based guesses about user liveness.

[Read more]

Cursor-Based Pagination: Why Offset Breaks at Scale

2026-02-15sohilladhani
#mysql  #database  #performance  #system-design  #java 

OFFSET 50000 makes MySQL scan 50,000 rows just to skip them. Cursor pagination stays fast no matter how deep you go.

[Read more]

Fan-Out Strategies: Write-Time vs Read-Time

2026-02-14sohilladhani
#distributed-systems  #system-design  #architecture  #performance  #patterns 

User posts an update. Do you push it to all followers immediately, or let them pull it when they check? The trade-off shapes your entire architecture.

[Read more]

WebSockets vs Long Polling: Choosing a Real-Time Transport

2026-02-13sohilladhani
#distributed-systems  #architecture  #java  #performance  #system-design 

Your client needs real-time updates from the server. HTTP wasn’t built for this. Here’s how long polling, SSE, and WebSockets solve it differently.

[Read more]

Read Replicas: Hidden Consistency Traps

2026-02-12sohilladhani
#mysql  #database  #replication  #consistency  #system-design 

You added read replicas to scale reads. Now users update their profile and see the old version. Welcome to replica lag.

[Read more]

Thundering Herd

2026-02-11sohilladhani
#distributed-systems  #caching  #performance  #system-design  #redis 

Cache expires. 10,000 requests hit the database simultaneously. Your DB collapses. How request coalescing and probabilistic expiration prevent the stampede.

[Read more]
< [Newer posts] :: [Older posts] >
© 2026 by SOHIL LADHANI