
Senior Software Engineer | System Design | DSA | Interview prep | AI. Collabs or DM : π© [email protected] for career guidance: https://xitter.cf/t.co/Mcz9YSf0Da
Joined July 2026
- Tweets4.1K
- Following1.9K
- Followers7.8K
- Likes9K
Pinned Tweet
Recently I interviewed a Senior Engineer.
Strong candidate.
Kafka? β
Redis? β
Microservices? β
Distributed systems? β
Then I asked:
"You're building the inventory service for a flash sale.
Only 1 item left in stock."
Two users hit βBuy Nowβ at the exact same millisecond.
Both requests pass the βis available?β check.
Both create an order.
Both deduct stock.
Now youβve sold 2 items when only 1 existed.
How do you guarantee you never oversell β even with concurrent requests, client retries, and partial failures?
"Just use a database transaction."
Doesnβt fully solve it if both requests read `stock = 1` before either writes, or if the response is lost and the client retries.
"Check stock before deducting."
What happens when both checks happen at the same time?
"Use Redis DECR and reject if it goes negative."
What happens if Redis is down, or the decrement succeeds but the order is never persisted?
Your turn:
How would you design this inventory reservation API so concurrent buyers and retries never oversell the last item?
Thereβs a specific distributed-systems concept behind this.
And youβll encounter it everywhere inventory, tickets, seats, coupons, and limited resources are involved.
Indian Software Engineer in 2014:
βIβll become a manager in 6β7 years.β
Indian Software Engineer in 2026:
What's harder to hire for: someone who can solve any LeetCode medium, or someone who can debug an unfamiliar production issue?
Database Interview:
Two transactions.
Transaction A:
UPDATE accounts SET balance = balance - 100
WHERE id = 1;
UPDATE accounts SET balance = balance + 100
WHERE id = 2;
Transaction B:
UPDATE accounts SET balance = balance - 200
WHERE id = 2;
UPDATE accounts SET balance = balance + 200
WHERE id = 1;
Both transactions work perfectly in isolation.
Under concurrent traffic, one suddenly fails with a deadlock error.
You add retries.
The errors decrease, but don't disappear.
Same database.
Same queries.
Same workload.
What's the actual fix?
And why can changing the order of two updates solve the problem? π€
Unpopular opinion:
Retries can make a failing distributed system fail even harder.
A service is already overloaded.
Every caller retries.
Traffic multiplies.
The service gets slower, triggering even more retries.
Sometimes the most resilient thing your service can do is fail fast.
When should a backend service retryβand when should it stop?
Backend hot take:
Caching is not automatically a performance optimization.
It can introduce:
Stale data
Cache stampedes
Invalidation bugs
Extra infrastructure
Another failure mode during an outage
Sometimes a well-indexed database query is simpler, cheaper, and more reliable.
Do engineers reach for Redis too quickly?
Unpopular opinion:
A senior backend engineer who can explain every detail of HashMap internals but can't debug a production incident isn't as strong as we think.
Knowing internals matters.
But diagnosing unfamiliar failures, understanding trade-offs, and making safe changes under pressure matter more.
What separates a genuinely senior engineer from someone who's just good at interviews?
Database Interview:
Your Spring Boot API works perfectly in testing.
Production traffic increases.
Suddenly:
API latency jumps to 10 seconds
Database CPU is only 35%
No slow query explains the delay
Requests start timing out
You increase the database connection pool size.
Things get worse.
You restart the application.
Everything works again β temporarily.
The database isn't overloaded.
So what exactly is running out?
And why can increasing the connection pool make a healthy database struggle? π€
Hot take:
A poorly designed monolith is often easier to fix than poorly designed microservices.
With microservices, one simple feature can involve:
4 network calls
3 retries
2 distributed tracing dashboards
1 incident nobody can explain
We traded deployment complexity for operational complexity.
When are microservices actually worth it?
Unpopular opinion:
Adding an index is one of the most overused solutions to database performance problems.
Sometimes the real problem is:
A bad data model
An inefficient query
Fetching columns nobody needs
An application making 100 unnecessary queries
Not every slow query needs another index.
Agree or disagree? π
Backend Interview:
Your API has 3 replicas.
Everything works perfectly.
Then traffic increases.
Suddenly, users receive this error:
401 Unauthorized
But here's the strange part:
Refresh the page β works.
Call the API again β works.
Same token. Same user. Same endpoint.
Logs show no authentication failures from the identity provider.
You restart one replica.
The errors disappear.
For a while.
No database issue.
No network outage.
No expired tokens.
What could cause this? π€
And why would restarting just one application instance temporarily fix the problem?
Bonus: How would you prove your hypothesis without restarting anything?
Mansi π©βπ» retweeted
My manager said βtake ownership.β
So I took ownership of the bug.
Now itβs in my performance review.
Mansi π©βπ» retweeted
AI: I have completed the implementation.
Me: Great. Did you run the tests?
AI: I have completed the implementation.
π
By 2028, the average junior engineerβs first year will look more like βreviewing and steering AI outputβ than writing code from scratch.
If youβre hiring or mentoring juniors right now, are you preparing them for that or for the old world?
Your AI agent retries a failed payment tool call.
The first call actually succeeded, but the response timed out.
The retry charges the customer again.
This isn't an LLM problem.
It's a distributed-systems problem.
AI agents still need idempotency, timeouts, permissions and audit logs.
Which safeguard would you implement first?
Unpopular opinion:
A developer who writes code for 8 hours isnβt necessarily more productive than one who writes code for 4.
The other 4 hours might be spent preventing bugs, clarifying requirements, reviewing designs, or unblocking the team.
Lines of code are a terrible productivity metric.
Mansi π©βπ» retweeted
Recently I interviewed a Senior Backend Engineer.
Strong candidate.
Load balancing? β
Caching? β
Database indexing? β
Horizontal scaling? β
Then I asked:
"You're building a product listing service.
A product becomes viral. Suddenly, 50,000 requests per second hit the same product ID."
Your database is struggling.
You add Redis.
Traffic drops at the database, and everything looks good.
Then the product price changes.
For the next 30 seconds, some users see the old price while others see the new one.
Worse, an old request finishes late and overwrites the updated cache entry.
How do you prevent stale data from coming back?"
"Just invalidate the cache."
What if an in-flight request repopulates it with stale data immediately after invalidation?
"Use a short TTL."
What if the business requires price changes to be reflected immediately?
"Use a distributed lock."
What happens when thousands of requests wait on that lock?
Now you've traded stale reads for a latency problem.
Your turn:
How would you design the cache update and invalidation flow to handle concurrent reads, writes, and delayed requests without serving stale prices?
There's a subtle distributed-systems problem hiding behind cache invalidation.
And it gets much harder when your cache is distributed across multiple application instances.