Writing the System Design Codex Newsletter • I simplify software design with concepts and case studies
2 subscribers
Oct 27, 2024 • 5 tweets • 3 min read
4 must-know service-to-service communication patterns.
🧵
✅ Request Response with HTTP
This is a synchronous pattern. One service sends a request to another and remains blocked until it gets a response or an error.
REST is the most popular architectural style for this pattern.
However, the pattern has one pitfall.
If you have a chain of service calls (A to B to C to D), one weak link in the chain can fail the entire operation.
Not a great experience for the user as well as the developer.
Oct 1, 2024 • 10 tweets • 3 min read
Websites with high latency are more frustrating than unavailable websites.
At least, the unavailable ones don't waste a user's time directly.
Here are 8 must-know strategies that can help reduce latency
🧵
[1] Caching
The goal of caching is to minimize costly database lookups and perform high-latency computations.
Store frequently accessed data in a cache
Aug 6, 2024 • 8 tweets • 2 min read
7 techniques for database performance and scaling
🧵
[1] Create the right indexes.
Indexes allow the database to locate and retrieve specific information quickly.
Jul 8, 2024 • 5 tweets • 3 min read
What's the secret ingredient to service integration in a distributed system?
It's choosing the right communication pattern for the requirement.
Here are 4 must-know service communication patterns:
🧵
[1] Request Response with HTTP
This is a synchronous pattern. One service sends a request to another and remains blocked until it gets a response or an error.
REST is the most popular architectural style for this pattern.
However, the pattern has one pitfall.
If you have a chain of service calls (A to B to C to D), one weak link in the chain can fail the entire operation.
Not a great experience for the user as well as the developer.
Jul 6, 2024 • 10 tweets • 3 min read
Open it for a quick crash course on Kafka.
🧵
✅What is Kafka?
It's a distributed event store and a streaming platform.
Began as an internal project at LinkedIn.
Today, some of the largest data pipelines in the world across organizations like Netflix and Uber rely on Kafka.
Jul 1, 2024 • 5 tweets • 2 min read
If you are dealing with event-driven architecture, you've three main ways of dealing with events.
Here's a brief intro about them:
🧵
[1] Event Notifications
The event just notifies that something has occurred and the payload carries the absolute minimum state.
For example, just the ID of the entity (order ID, customer ID, and so on).
The receiving component may call the source component to fetch additional information.
Such events are general-purpose and great for broadcasting requirements.
Jun 28, 2024 • 25 tweets • 7 min read
I've been writing the System Design Codex newsletter for 47 weeks now.
Here are 23 articles from the newsletter that can help you understand a System Design concept:
🧵
[1] 3 Types of Event Patterns in EDA
Why read it: Learn the different types of event patterns and when to use them
Latency is the new downtime in distributed systems.
But these 8 must-know strategies can help reduce latency.
🧵
[1] Caching
The goal of caching is to minimize costly database lookups and perform high-latency computations.
Store frequently accessed data in a cache
Jun 8, 2024 • 11 tweets • 2 min read
If you want to get better at System Design interviews, remember these 24 principles
🧵
[1] If you need to scale an individual component, stick with Vertical Scaling first. Then, look at Horizontal Scaling when needed
[2] To deal with traffic spikes, evaluate the use of Autoscaling for Dynamic Resource Allocation
[3] If the system requires High Availability with Performance, consider using a Load Balancer
Mar 24, 2024 • 10 tweets • 1 min read
10 points I wish I knew when starting as a software developer
[🧵]
[1] Don't reinvent the wheel. Leverage existing solutions when you can.
[2] Working code is 25% of the game. Maintaining and evolving that code base for years is the real deal.
Jul 26, 2023 • 12 tweets • 3 min read
You can't avoid Data Structures while going for an interview.
But don't worry!
You don't need to know all of them to succeed.
These 5 data structures can help you solve 90% problems.
[🧵]
#1 - Array
The most basic data structure out there.
Elements are stored in contiguous memory locations.
We can access elements in an array using the index value.
The index is the position of each element in an array.
It starts with 0 & incremented by 1 for every new element.
Jul 24, 2023 • 8 tweets • 3 min read
HTTP is a stateless protocol.
This means every request is independent...
...and doesn't relate to the previous request.
But users aren't stateless.
They don't want to log in to your application every time they make a request.
So, how can you help them?
Find out👇
[🧵]
The solution is to use cookies.
A cookie, really?
Yes...but not the one you eat when you're hungry.
A cookie is basically a key-value pair that's stored on the browser.
Here's how it works...
Jul 20, 2023 • 8 tweets • 3 min read
NoSQL databases have skyrocketed in popularity.
But we use NoSQL as a common term for anything that's not SQL.
In reality, NoSQL databases come in 4 different flavors.
And each flavor has a particular use case.
Know everything about it in the next 5 tweets.🧵
#1 - Document Databases
This is probably the most popular category of NoSQL databases.
Data is stored in JSON, BSON, or XML format.
Tables = Collections
Records = Documents
Documents can closely mimic the application domain object.
Examples - MongoDB, Couchbase, etc.
Jul 8, 2023 • 13 tweets • 4 min read
The interview question with no fixed answer but endless possibilities.
What are the core concepts you consider before designing a system?
[🧵]
#1 - Scalability
Let's say you run a restaurant.
And are committed to keeping the same level of service no matter how many customers turn up.
How to scale your service when the number of customers increases from 10 to 50?
Or from 50 to 100? Or from 100 to 500?
Jun 30, 2023 • 12 tweets • 3 min read
To design a system, the CAP Theorem is super-important.
But it can also be confusing.
Here's CAP Theorem explained in a way you'll NEVER forget (with Tom the Prankster)
[🧵]
A system has 3 guarantees:
- Consistency
- Availability
- Partition Tolerance
Now, Partition Tolerance is a must.
From pigeons to fiber-optic cables, networks are still unreliable.
That leaves you with Consistency or Availability.
Why?
Let's find out with Tom the Prankster.
May 24, 2023 • 12 tweets • 4 min read
In mid-2020, Notion came under an existential threat.
Why?
Their Monolithic PostgreSQL DB faced a catastrophic situation.
The same DB had served them 5 years & 4 orders of magnitude growth.
But it was NO longer sufficient.
Here's the story of how Notion was saved🧵
#1 - The First Signs of Trouble
- Frequent CPU spikes in the DB nodes
- Migrations became unsafe & uncertain
- Too many on-call requests for engineers
The monolithic database was struggling to cope with Notion's tremendous growth.
Happy problems!
But things turned ugly👇
May 22, 2023 • 9 tweets • 4 min read
Uber Eats handles millions of product images every hour.
At this scale, duplicate images are a big problem.
Storing the same image multiple times = huge drag on processing & CDN costs.
So, how does Uber deal with duplicate images?
Find out in the next 6 tweets 🧵
#1 - Initial Implementation
The first solution was quite basic.
There were 3 steps - download, process & store the image URLs.
No de-duplication is involved.
Disadvantages:
✅ No reuse of images.
✅ No re-processing of updated images.
What changed?👇
May 11, 2023 • 8 tweets • 3 min read
How to send messages using Kafka?
The Kafka Producer provides 3 different strategies to send messages from your application to the broker.
Learn about them in just 5 Tweets 🧵
#1 - Fire and Forget
Send a message to the Broker & forget about it.
No acknowledgment. Nothing.
Kafka is Highly-Available. So big chance that the messages will be delivered.
But you can't rule out lost messages.
May 10, 2023 • 6 tweets • 3 min read
Software release days are tense nail-biting affairs.
Every team member is on the edge of their seat.
A failed release impacts all roles whether manager or developer.
But why are releases so tough?
Because of 3 Anti-Patterns of Deploying Software
Find out more & solutions 🧵
#1 - Manual Deployment.
One of the biggest sins in 2023.
But everyone has done it at least once!
Tell-tale signs:
- Extensive document with steps
- Relying on experts
- Unpredictable outcomes post-release
- Rollbacks
- 3 AM support calls
Solution - Automatic Deployments
May 9, 2023 • 22 tweets • 6 min read
How to make consistent $$ as a Tech Blogger?
This thread 🧵 describes the complete process that worked for me.
- Content
- Platforms
- Revenue
No spending on Ads.
No algorithm hacking.
Just plain organic reach over time.
Only 20 tweets to help you Diversify Your Income👇
#1 - Choose a Tech Discipline
Introspect which tech area sparks the greatest curiosity within you.
Curiosity alone will make you continue in tough times.
Examples:
- Web Dev
- Front-End
- Backend
- DevOps
- IaC
- Cloud
Don't choose something because everyone else is.
May 8, 2023 • 11 tweets • 4 min read
Kafka is super popular among developers & large orgs.
Began as an internal project at LinkedIn.
Grew rapidly.
Today, the largest data pipelines in the world use Kafka.
Orgs like Netflix & Uber rely on it for their workflows.
Get a helicopter view of Kafka (Just 9 Tweets)🧵
#1 - Kafka Messages & Batches
Basic Unit of data in Kafka = Message
A Message is like a record in a DB table. Sent as an array of bytes.
Messages are grouped into batches.
The batch approach = increased throughput.
Once a batch is ready, it's sent to a Topic & Partition👇