PPF Deposit Timing: The April 1-5 Rule That Costs You Real Money

Two people open a PPF account on the same day, put in the same ₹1.5 lakh every year for 15 years, and earn the same 7.1% rate. One ends up with roughly ₹2.7 lakh more than the other. Neither picked a better fund, took more risk, or timed the market. One just deposited early in the financial year and the other deposited late. That is the entire difference, and it comes down to a rule most PPF holders have never actually read. ...

9 min

Claude Code in a Team Setting - The Conventions Nobody Writes Down

One engineer using Claude Code is a productivity story. Ten engineers using Claude Code on the same repo, with no shared conventions, is a coordination problem that looks a lot like the early days of untyped JavaScript on a big team. Everyone is fast individually. Collectively you get inconsistent code, a CLAUDE.md that three people edit in three directions, and a PR queue full of 800-line diffs that the author skimmed and nobody else wants to read. ...

11 min

Design Facebook Likes with Live Updates (Including Celebrities) - System Design

Tapping “Like” is the smallest interaction Facebook has. It is one bit: you either like a post or you do not. It looks like a toggle on a boolean. It is not. Behind that single tap sits a counter that must be accurate (a user liking twice counts once, an unlike must decrement, the number cannot drift over a billion taps), durable (unlike a live viewer count, a like is a real fact the user expects to persist forever), and live (the number should tick up on every viewer’s screen as others tap, without a refresh). And then there is the part that actually breaks systems: a celebrity or a viral post can take 100,000 likes per second, all landing on the count of a single post. One row. One key. A firehose. ...

29 min

Design Live Comments on Facebook - System Design

Live comments look like a solved problem until you put a number on it. A celebrity goes live, a million people are watching, and comments are pouring in at ten thousand a second. Every one of those million viewers is supposed to see new comments appear the instant they are posted. Do the multiplication and the system dies on the spot: 10,000 comments/sec times 1,000,000 viewers is 10 billion messages per second if you naively push every comment to every viewer. No fleet on earth moves 10 billion messages a second for a single post. ...

24 min

Design Live Page Viewer Count (Booking.com) - System Design

“23 people are looking at this hotel right now.” It is one line of text, a soft nudge that the room might not be here tomorrow. It looks trivial. It is not. To render that number you have to answer, for every one of a million product pages, a question that is genuinely hard at scale: how many distinct humans are looking at this page right now, updated live, refreshed as people arrive and leave, across a global fleet. ...

25 min

Sukanya Samriddhi Yojana vs Mutual Fund: The CAGR a Fund Needs to Win

The usual advice for a girl child’s corpus is a one-liner: “equity always beats a government scheme over 21 years, so run an SIP.” It sounds obviously true. Nifty has done roughly 11-12 percent over long stretches, and Sukanya Samriddhi Yojana pays 8.2 percent. Case closed. Except that 8.2 percent is tax-free and guaranteed, and your mutual fund is neither. Once you put both through the tax code and hold them for the same 21 years, the bar the fund actually has to clear is not “beat 8.2 percent.” It is higher than that, and where it lands depends on one thing most comparisons never mention: which tax regime you are in. Let me compute the exact break-even CAGR, to the rupee. ...

9 min

Design a Wire Transfer API - System Design

A wire transfer looks like the wallet transfer’s twin, and interviewers love it because it is not. In a wallet, “move 500 from Alice to Bob” is one UPDATE inside one ACID transaction because both accounts live in your database. A wire moves money between two different banks. The debit lives in your ledger; the credit lives in a bank you cannot see, reach transactionally, or roll back. There is no shared transaction. There is an external rail (Fedwire, RTGS, SWIFT, ACH) that is slow, at-least-once, and - once it settles - irreversible. You cannot ROLLBACK a wire. You can only send a second, compensating wire and hope. ...

30 min

Design Distributed Tracing (Jaeger / Dapper) - System Design

One request hits your API gateway, which calls auth, which calls the user service, which calls three downstream services, two of which hit a cache and a database, one of which enqueues a job that a worker picks up 40ms later. That single user-facing click fanned out into 30 service calls across 12 machines, and it was slow - 1.2 seconds when it should be 200ms. Which hop ate the second? Logs won’t tell you: they are 30 disconnected lines in 12 different files with no thread that ties them together. Metrics won’t tell you: they say “p99 latency is up” but not which call in which request. The thing that ties them together - the single most valuable artifact in a microservice debugging session - is the trace: the full call tree of one request, every span timed and parented, so you can see exactly where the 1.2 seconds went. ...

31 min

Design Price Alert System (Stock / Amazon) - System Design

“Notify me when AAPL hits $250” or “tell me when this Amazon item drops below Rs 1,999” sounds like a WHERE price >= target query. Then you look at the numbers. There are 100M active alerts. Stock prices update millions of times a second across tens of thousands of instruments. If you run that WHERE on every price tick you are doing millions of full scans per second over a hundred million rows, and you melt. The whole problem is the inversion: it is not “given a price, which alerts match” as a database scan, it is “given a firehose of price changes, fire exactly the alerts that just got crossed, once, within a second, without scanning anything you do not have to.” ...

27 min

ESOP Tax for Salaried Employees: Exercise Year vs Sale Year Changes Everything

Most people think ESOPs are taxed when they cash out. They are not. They are taxed twice, on two different dates, at two completely different rates, and the two are decided by two different rules you do not get to choose after the fact. The day you exercise, you owe income tax at your salary slab rate on a gain you have not seen in cash. The day you sell, you owe capital gains tax on whatever the stock did after that. Miss the connection between those two dates by one day, and on a stock that has run up you can hand the government an extra 10-15% of the whole vested value for nothing. ...

11 min

The Management Track Is Not a Promotion - Why Engineers Choose Wrong

The single most expensive career mistake I see senior engineers make is treating the management track as a promotion. It is not a promotion. It is a lateral move into a different job that happens to pay similarly at the same level. The confusion is structural. Most companies draw the ladder so that “senior engineer” branches into two lines that sit at the same level: engineering manager on one side, staff engineer on the other. Both get a title bump. Both get a comp bump. So it looks like a fork with two equally good roads. It is not two versions of your current job. It is two different jobs, and the skills that made you a great senior engineer transfer cleanly to only one of them. ...

10 min

Design A/B Testing System (Optimizely) - System Design

An A/B testing platform is deceptively easy to describe and brutal to get right. “Show half the users the blue button and half the green button, then see which converts better.” Every part of that sentence hides a landmine. Which half - and does a returning user stay in the same half tomorrow, or does the button flicker between visits? What happens when there are not two experiments but three thousand running at once, some of them overlapping on the same page? How do you count 500M users worth of impressions and conversions per experiment without a nightly batch job that reports yesterday’s winner today? And the one that sinks most naive designs: how do you decide the green button actually won, versus won by random noise, without a statistician manually eyeballing a spreadsheet? The real problem is this: assign 500M users to variants across thousands of concurrent experiments deterministically and with sub-millisecond latency on the request path, capture a firehose of exposure and conversion events without losing any, and compute per-experiment statistical significance in near-real-time - all while guaranteeing that a user never flips variants mid-experiment and that overlapping experiments do not silently poison each other’s results. ...

35 min

Design ETA Service & Live Location Sharing (Uber) - System Design

Once a rider is matched to a driver, the interesting problem is not “who is my driver” - it is the little car crawling across the map toward the pin, and the number under it that says “4 min” and keeps updating. Both look trivial. Both hide the hard part. The car moving smoothly is the output of a fan-out system that takes one driver’s GPS ping and delivers it to the exact rider watching that trip, in under a second, five million times over. The “4 min” is the output of a routing engine that has to answer “how long from here to there, given the traffic right now” continuously for the entire duration of every trip, without recomputing a shortest path over a road graph on every single ping. ...

26 min

Design Netflix Screen Limit - System Design

Everyone thinks the screen limit is a counter. “Each plan allows N streams, keep an integer per account, increment when a play starts, decrement when it stops, reject when it hits N. Done.” Then the interviewer asks the questions that decide whether it actually works: what happens when the player crashes and never sends the decrement, so the counter leaks upward until a paying family can never watch anything again; what happens when two devices in the same house both hit play in the same 50 milliseconds on the last free slot; how do you make that allow/deny decision fast enough that nobody notices it before their video starts; and how do you do all of it for 250 million subscribers with 100 million concurrent streams at peak. Now it is a real problem. ...

25 min

NSC vs Tax-Saver FD vs ELSS: The Real Post-Tax Winner Under 80C

Here is a fact that trips up almost everyone parking money in a tax-saver FD: your fixed deposit and an NSC certificate bought on the same day, in the same 30 percent bracket, are taxed exactly the same way. Every rupee of interest is added to your income and taxed at slab. So the “safe FD” argument is not about tax. It is purely about the headline rate. And on that single number, the NSC at 7.7 percent beats a 6.5 percent tax-saver FD every single time, before you even open a calculator. ...

8 min

The LTCG Exemption Most Indian Equity Investors Leave on the Table

Almost every article on this topic stops at the arithmetic: book Rs 1.25 lakh of gain a year, save 12.5% tax on it, do it fifteen times instead of once. That math is real and it is settled. What nobody writes about is the part where people actually lose money: the execution. I have watched people “harvest” and end up worse off than if they had done nothing. They redeemed on a day the NAV had already run up, they tripped the holding-period reset and paid short-term tax at 20%, they had already used the exemption on a stock sale they forgot about, or they harvested an ELSS unit that was still locked. The exemption is free. Getting the mechanics wrong is not. ...

12 min

Design Sort 1TB Dataset on Commodity Hardware - System Design

The whole problem is one sentence: the data does not fit in memory. You have 1TB to sort and 16GB of RAM per machine, so the data is roughly 64x larger than the memory you get to sort it in. Every classic in-memory sort - quicksort, the sort() in your standard library - assumes random access to the entire array. The moment the array is bigger than RAM, that assumption is gone, and the algorithm either crashes with an out-of-memory error or thrashes the page cache into oblivion. So the real question is not “which comparison sort,” it is “how do you order data you can only ever see a small window of at a time.” The answer, since the 1960s, is external merge sort: read data in chunks small enough to sort in memory, write each sorted chunk to disk, then merge the sorted chunks back together with a streaming k-way merge that only ever holds one small buffer per chunk in RAM. Scale that across a cluster and you get the distributed sort that wins the TeraSort benchmark. This post builds both, single machine first because the distributed version is just external sort with the partitioning done up front. ...

32 min

Design Surge Pricing System (Uber) - System Design

Surge pricing looks like a multiplication. Base fare times some number, show it to the rider, done. The interviewer lets that sit for about a minute, then asks the questions that break the toy: the number is different on this block than the next one over, it changes every 30 seconds, there are a million of these blocks worldwide all updating at once, a rider who sees 1.8x must be charged 1.8x even if the number moves while they are tapping “confirm,” a driver deciding whether to drive to the airport needs the surge there to still be real when they arrive 12 minutes later, and if you get the number wrong in either direction you either strand riders or enrage them. Surge is not a multiplication. It is a real-time distributed control loop over supply and demand, and the price is just its output. ...

29 min

Design Top K Elements at Scale (App Store Rankings) - System Design

Everyone thinks App Store rankings are a SELECT app_id, COUNT(*) FROM downloads GROUP BY app_id ORDER BY count DESC LIMIT 100. Count the downloads, sort, take the top 100, done. Then you look at a real store and the assumption falls apart in three separate ways at once. First, “trending” is not the same as “most downloaded” - a five-year-old app with a huge install base racks up more downloads per minute than a brand-new hit, yet the new hit is what is trending, so trending has to measure velocity, not volume. Second, there is not one chart, there is a chart per country times per category times per window (top free, top paid, top grossing), which is tens of thousands of distinct top-K lists that all have to stay fresh. Third, the windows are not all the same shape - “top 100 trending every minute” is a fast rolling score, “top 1000 daily” and “weekly” are rolling windows that must expire old events, and “top 1000 all-time” is a monotonic cumulative counter that must never forget anything. One naive GROUP BY cannot be all three. ...

30 min

LTCG Harvesting Every April: The Tax You Are Leaving on the Table

The most common piece of tax advice for equity investors in India is “just buy and hold, don’t churn, LTCG is only 12.5% anyway.” It is not wrong. But it quietly throws away a benefit the tax code hands you for free every single year: the Rs 1.25 lakh long-term capital gains exemption. If you never sell until the end, you claim that exemption exactly once. If you book gains deliberately every April and buy the units straight back, you claim it fifteen times over a fifteen-year holding. Nothing about your portfolio changes. You hold the same fund, the same NAV, the same units. You just reset your cost basis higher each year and walk away from a tax bill you would otherwise pay at the finish line. ...

8 min