Ashok Sahoo

3.5K posts

Ashok Sahoo banner
Ashok Sahoo

Ashok Sahoo

@ashoKumar89

Full-Stack Engineer | Building real-world systems across the stack | Sharing real-world lessons on performance, failures, and trade-offs

Katılım Ekim 2009
965 Takip Edilen11K Takipçiler
Sabitlenmiş Tweet
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
An API Gateway is not just a reverse proxy. It’s the control plane in front of your services. If you’re building microservices and don’t have one, your architecture will eventually get messy. Here’s what it actually does 👇 What is an API Gateway? It’s a single entry point that sits between clients and your backend services. Instead of: Client → Service A Client → Service B Client → Service C You have: Client → API Gateway → Internal Services The gateway handles cross-cutting concerns so your services don’t have to. What does it do? An API Gateway typically handles authentication, authorization, rate limiting, request routing, response aggregation, logging, monitoring, and sometimes caching. It can: - Validate JWT tokens - Enforce rate limits - Route /users to User Service - Route /payments to Payment Service - Combine multiple service responses into one Your microservices stay focused on business logic. When do you need it? You likely need an API Gateway when: - You have multiple microservices - You want centralized authentication - You need rate limiting at the edge - You want to hide internal service structure - You are exposing public APIs If you have a simple monolith, you probably don’t need one yet. Common real-world examples: Netflix, Amazon, and most SaaS platforms use API gateways to manage traffic at scale. Popular solutions include: - NGINX - Kong - AWS API Gateway - Envoy Without an API Gateway: Every service reimplements auth, logging, and rate limiting. With an API Gateway: Infrastructure concerns are centralized and standardized. It’s not just traffic routing. It’s architecture discipline. Building microservices? Repost. Follow. Bookmark this.
English
10
15
180
28.3K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
Most bugs come from assumptions. “We thought it would…” “It should work because…” “This case won’t happen…” Reality disagrees. Verify: • inputs • outputs • edge cases • real data Assumptions break systems.
English
2
0
2
166
Madhan Mohan T
Madhan Mohan T@IamMadhanMohan·
@ashoKumar89 Recovery: Stop the job, identify affected records, and restore them using transaction logs / point-in-time recovery instead of a full backup. Prevention: Take a snapshot before migration, run in batches, and add validation + rollback mechanisms.
English
1
0
7
812
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
A data migration runs for 8 hours. It corrupts 50K records. You need to roll back. But your latest backup is 12 hours old. You cannot lose that data. What’s your recovery strategy? And how do you prevent this in the future?
English
9
1
47
9.1K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@anirudhology Good approach. The real win is being able to identify exactly what the migration touched.
English
0
0
1
580
Anirudh Sharma
Anirudh Sharma@anirudhology·
Oh, that's a pickle, but we can take the following careful approach to get out of this jam. 1/ Restore the 12 hour backup to a separate recovery instance. 2/ Replay the WAL upto the exact timestamp just before the migration started. This recovers all valid data added after the backup. 3/ The corrupted 50K records are isolated by identifying all rows touched by the migration (using txn ID or explicit audit columns) and either deleting them or restoring their pre-migration values from a shadow table or logical decoding snapshot. To stop this happening in the future, we must run migrations inside a database transaction with a "rollback" plan: take a fresh snapshot immediately before the migration, use a temp staging table to validate changes before swapping them into place, and always have point-in-time-recovery (PITR) enabled.
English
1
0
3
833
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@krunalbuilds Good list. Once you isolate one bad node, the pattern usually reveals itself.
English
0
0
2
153
KrunalSinh Sisodia
KrunalSinh Sisodia@krunalbuilds·
First checks: • Which instances are failing? (compare good vs bad) • Recent deploy diff / config mismatch • Health checks + load balancer routing • Dependency issues (DB, cache, third-party) • Resource limits (CPU, memory, connections) • Timeouts/retries misconfigured Goal: find what’s different between healthy and failing nodes.
KrunalSinh Sisodia tweet media
English
1
1
3
262
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
You deploy a critical update. 30% of requests start timing out. Failures are inconsistent across instances. You cannot roll back immediately. What do you investigate first?
English
5
1
23
3.4K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@won__sikkk I would not call 10 minutes unrealistic here. It is achievable but only with the right architecture.
English
0
0
3
875
Wonsik Oh
Wonsik Oh@won__sikkk·
@ashoKumar89 How do you handle the PM conversation when they give you an unrealistic timeline like 10 minutes?
English
2
0
4
1K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
You need to process 10 million user notifications. Sending them synchronously would take 28 hours. Your product manager wants it done in 10 minutes. How do you architect this? Bonus: What happens if the notification service goes down mid-process?
English
12
0
81
18.1K
KrunalSinh Sisodia
KrunalSinh Sisodia@krunalbuilds·
Async + parallelism. • Push 10M notifications to a queue • Process with many workers in parallel • Batch + rate limit per provider • Use idempotency to avoid duplicates If service fails: • Queue holds messages • Retry with backoff • DLQ for failures • Resume safely without losing work
KrunalSinh Sisodia tweet media
English
2
0
25
1.9K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
Performance bottlenecks that are not in your code: - DNS resolution taking 200ms because of recursive lookups - Connection pool exhaustion from short-lived connections - Kernel TCP buffer sizes limiting throughput on fast networks - GC pauses from allocating objects in tight loops - Context switching from too many threads, not too few - Memory bandwidth saturation from poor cache locality - Disk I/O from logging, not from your database Profile the entire stack, not just your application layer. What would you add to this list?
English
2
0
33
1.9K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
API Version in headers or in URLs? URLs are explicit but pollute logs and caches. Headers are cleaner but less transparent. Which approach do you use in production?
English
6
2
25
5.3K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@jb_61820 How do you handle cross-service data consistency?
English
1
0
0
477
Jonathan Bartlett
Jonathan Bartlett@jb_61820·
I'm a big fan of "fat microservices". Essentially, have a collection of monoliths, but shared auth, all behind a gateway. This allows each team to work on their monolith independently - doesn't even have to be the same tech stack. If they wind up discovering a shared service they all use, they can break that out, too, but the focus is on everyone having ownership over their own project space.
English
1
0
5
568
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
Monoliths are simpler. Microservices add latency and complexity. Yet teams keep breaking systems into smaller services. What trade-off are they willing to accept?
English
14
4
65
9.3K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@IamMadhanMohan Agree on internal vs public split. Headers are fine… until scale + infra gets involved.
English
0
0
1
363
Madhan Mohan T
Madhan Mohan T@IamMadhanMohan·
@ashoKumar89 Use URL versioning in production. It’s more explicit, easier to debug, cache-friendly, and avoids hidden behavior. Headers are fine for internal or experimental APIs, but they reduce visibility and can cause subtle issues.
English
1
0
3
398
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@LacTranAn Splitting by flow creates chatty services and latency.
English
0
0
1
499
Lac Tran An
Lac Tran An@LacTranAn·
Imo, microservices should be broken down by two factors: - Logical responsibility: this creates a reasonable boundary for services - Scalability: consider for scaling. So in case one part of the system receives more traffic, we can scale it horizontally. For me, the nightmare is when the team breaks flow into services, communicating back and forth by events.
English
1
0
2
579
Aniket Magadum
Aniket Magadum@magadum_aniket·
@ashoKumar89 It’s important to understand the fundamental working of the ORM before using them.
English
1
0
4
381
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
ORMs make development faster. But can hide inefficient queries. Why do teams still rely on them heavily?
English
19
3
54
9.9K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@McClellandRuss This is one of the reason. But for complex queries raw SQL are way better than ORM
English
0
0
1
392
Madhan Mohan T
Madhan Mohan T@IamMadhanMohan·
@ashoKumar89 ORMs speed up development, reduce boilerplate, improve maintainability, and let teams work faster with fewer bugs. Most inefficiencies can be fixed when needed, so teams accept that risk to gain productivity upfront.
English
1
0
4
770
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@EvyTechno Exactly. Reviews are about shared understanding, not just correctness.
English
0
0
1
27
EVY TECHNO
EVY TECHNO@EvyTechno·
Mostly true — but incomplete. Code reviews do catch mistakes. That’s just the lowest level of value. The real purpose is: synchronize mental models across the team Sharing context → so knowledge isn’t siloed Improving design → so decisions are intentional, not accidental Aligning standards → so the codebase stays coherent Reducing future bugs → by fixing thinking, not just syntax But here’s the deeper layer people miss: A good review answers: “Will this still make sense 6 months from now under load, change, and failure?” Because bad code isn’t just buggy — it’s hard to reason about, hard to extend, and easy to misuse. Also: If your review is only happening at PR time, you’re already late. Strong teams push this earlier: - design discussions - clear interfaces - small, reviewable changes So yeah — reviews improve the system. But only if they move beyond “what’s wrong” to “is this the right way to think about the problem?”
English
1
0
1
54
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
Code reviews are not for finding mistakes. They are for: • sharing context • improving design • aligning on standards • reducing future bugs A good review improves the system. Not just the code.
English
4
2
39
1.3K