Dev Enock retweeted
Designed a Distributed Rate Limiter as part of my System Design practice. 🚀
Here is how I would design one for a distributed API system.
1. API Gateway
Apply rate limiting at the API Gateway. This allows us to reject requests before they reach backend services.
2. Token Bucket Algorithm
Use the Token Bucket algorithm.
It allows clients to send short bursts of requests while keeping their average request rate within the configured limit.
3. Redis Cluster
Store token bucket state in Redis.
All API Gateway instances use the same Redis state. This prevents each instance from maintaining a separate request count.
4. Redis Lua Scripts
Use Lua scripts to make token refill and request validation atomic.
This prevents two requests from consuming the same available token at the same time.
5. PostgreSQL
Store rate limit rules in PostgreSQL.
For example:
100 requests per minute.
5,000 requests per hour.
Different limits for different API keys or endpoints.
6. Kafka + Transactional Outbox
When an admin changes a rate limit, save the change and an event in the same database transaction.
A background worker reads the event and publishes it to Kafka.
All API Gateway instances receive the update and refresh their local configuration.
7. Local Configuration Cache
Each API Gateway keeps a local copy of the rate limit rules.
This avoids a database query for every API request.
Important design trade-offs:
1. Shared Redis State vs Local State
With Redis, all API Gateway instances use the same token bucket for a customer.
This helps enforce one common rate limit across all gateways.
However, every request needs to contact Redis. This adds network latency and increases Redis traffic.
With local state, each gateway maintains its own token bucket.
This removes the Redis call, but each gateway has an independent limit. A customer can exceed the intended global limit by sending requests through different gateways.
2. Centralised Token Buckets vs Local Token Leases
With centralised token buckets, every request checks Redis before it can proceed.
This provides more accurate rate limiting, but increases the number of Redis calls.
With local token leases, a gateway reserves a batch of tokens from Redis and uses them locally.
This reduces Redis calls, but some reserved tokens may remain unused on one gateway while another gateway needs them.
We gain lower latency, but give up some flexibility in how tokens are shared.
3. Fail Open vs Fail Closed
What happens if Redis becomes unavailable?
Fail open: Allow requests without checking the rate limit. The API remains available, but customers may exceed their limits.
Fail closed: Reject requests because the rate limit cannot be checked. This protects our infrastructure, but valid customers may lose access.
The choice depends on the cost and risk of allowing unchecked requests.
4. Global vs Regional Token Buckets
With a centralised Redis cluster, all regions share the same token bucket for a customer.
This provides a common view of token usage, but requests from distant regions may have higher network latency.
With regional token buckets, each region maintains its own bucket and quota.
This reduces network latency, but unused tokens in one region cannot automatically be used by another region.
A shared global limit requires coordination between regions, which adds latency and complexity.
Key takeaway:
System design is not only about choosing the right components.
It is about understanding what we gain, what we give up, and why a particular design makes sense for our requirements.
Dev Enock retweeted
Container running deployment done!
Silent payload bugs had my FastAPI returning 200s for bad data—DictVectorizer was just silently dropping unknown categories while Pydantic checked types.
Validate your inputs, people!github.com/devotuoma/machine…
Dev Enock retweeted
Thank you @engineersincode for joining @event_parlour , join their community on event parlour and follow up on their events and updates !
engineersincode.eventparlour…
Dev Enock retweeted
Heads up @event_parlour been approved for neon DB for startups, thank you so much for the support @neondatabase 🩷🫶
Dev Enock retweeted
Module 3 of #mlzoomcamp ✅
Logistic regression for lead conversion → 0.645 val accuracy.
TIL: dropping annual_income gave 0.724. Unscaled income (~54k) swamps L2-regularized LR, and StandardScaler gets 0.728.
Thanks @Al_Grigor @DataTalksClub 🙏 github.com/devotuoma/machine…
Dev Enock retweeted
Heads up @event_parlour just got accepted on Claude for Startup 🎉🥁
Thanks @claudeai time to ship 🚀🚀
Dev Enock retweeted
Dear Interns,
Its time to learn. Get your brown bags out, its luncheon and learn.
ThePrimeagen,
Your CEO
Dev Enock retweeted
I talked to a founder who was demoralized because all the ideas he could think of could be easily duplicated. I told him to ignore that worry; nearly all startup ideas are like that at first. Their value is the other ideas they lead to.
Dev Enock retweeted
Find the intersection of:
1. What you’re good at
2. What you like to do
3. What people will pay you for
Dev Enock retweeted
Sometimes I have (minor) thoughts of existential dread for software engineering, especially seeing AI doomerism takes (how it will be able to do everything we do)
Then I am pulled back to reality when I do something mundane in 2026 like buy a new mobile subscription with Apple Watch support and spend 2x3 minutes on the phone with human support because their backend is absolutely garbage and doesn't work for common use cases (and probably has never)
AI won't fix any of that by itself, esp as humans never bothered to do so, so far
Dev Enock retweeted
The hardest working person I know in the #golang community is @deadprogram.
I don't think people realize that he is maintaining 2 major projects (@TinyGolang and #Yzma). Both alone are a full time job.
All of this is done for free.
Please when you see Ron say Thank You!
Dev Enock retweeted
🤖 Built a Django app with AI in @Al_Grigor's AI Dev Tools Zoomcamp!
📝 Spec first, code second
🗂️ Backlog-driven implementation
✨ Household chores app from scratch
✅ Tests
My repo: github.com/devotuoma/Househo…
Zero Django knowledge → working app in one session!
Congratulations to Go co-creator Rob Pike on receiving the 2026 @USENIX Lifetime Achievement Award (The Flame)! 🔥
Rob’s lasting impact spans Go, UTF-8, Plan 9, the Blit windowing system, and classic books like The Unix Programming Environment. 🧵👇
Dev Enock retweeted
The software engineering profession has changed entirely the past 6 months
The previous mark of a good software engineer was writing high quality code at a high velocity.
These days our internal AI agents can turn around a PR with test cases, QA'd with evidence in under an hour. Our software engineers primary job really, is to prevent and catch mistakes our AI may make
Dev Enock retweeted
Software engineering hasn't changed at its core. It's still hard to learn and it still takes years. What changed is that you can now produce software without understanding how it works.
If you're early in your journey, don't outsource everything. Learn the underlying technology, what good code looks like, and the why behind the decisions. Stay curious. I know that's hard when AI finishes the task in five minutes and doing it by hand costs you a day. Treat that day as an investment. It's what lets you move faster later.
If you're an experienced engineer who's been hesitant to try AI, start with the boring stuff: tests, code reviews, small CLI tools, slides. Things you already know how to do and don't enjoy doing.
Dev Enock retweeted
📖 System Design Case Study
How Netflix's 2008 outage changed modern backend engineering forever?
In 2008, Netflix experienced a major database corruption issue
A single Oracle database became the critical point of failure...
The service suffered significant downtime.
The team realized:
Scaling a monolith wasn't enough.
Before the outage:
• Large monolithic application
• Centralized Oracle database
• Vertical scaling
• Tight coupling
• Single deployment pipeline
It worked...
Until one component failed.
Netflix asked a different question:
"What if every server, service, and database could fail at any moment?"
Instead of preventing failures...
They started designing for them.
The biggest architectural shift:
Monolith ➜ Microservices
Each capability became an independent service.
Examples:
• User Service
• Recommendation Service
• Playback Service
• Billing Service
• Search Service
Each could scale independently.
The database strategy changed too.
Instead of one giant database:
• Cassandra
• DynamoDB
• Elasticsearch
• EVCache
• S3
Each service owned its own data.
No more shared database bottleneck.
Communication changed.
Instead of direct database calls:
• REST APIs
• Event-driven architecture
• Asynchronous messaging
• Retry mechanisms
• Circuit Breakers
Failures became isolated instead of cascading.
Caching became a first-class citizen.
Popular content wasn't fetched repeatedly.
It lived in:
• CDN
• Edge Cache
• EVCache
• Client Cache
Millions of users could watch the same show without overwhelming backend services.
Deployment also evolved.
Instead of deploying everything:
• Independent deployments
• Canary releases
• Blue-Green deployments
• Automated rollbacks
One bad release no longer brought down the platform.
Then came one of the most famous ideas in software engineering...
Chaos Monkey.
Netflix intentionally terminated production instances.
If the system couldn't survive random failures...
It wasn't production-ready.
Today's Netflix platform handles:
• Thousands of microservices
• Global traffic
• Multi-region deployments
• Massive CDN distribution
• Fault-tolerant streaming
• Continuous deployment
Failures still happen.
Users rarely notice.
The biggest lesson wasn't microservices.
It was this mindset:
Don't build systems that never fail.
Build systems that continue working when failures are inevitable.
Modern backend engineering owes a lot to this shift.
Circuit breakers.
Chaos engineering.
Canary deployments.
Resilience testing.
Cloud-native architecture.
Many of today's best practices were popularized because one outage forced engineers to rethink everything.




























