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 • 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 • 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👇
May 6, 2023 • 10 tweets • 5 min read
Don't be a code monkey.
A code monkey is an expendable programmer.
No fun in being that!
You must strive to increase your value as a developer.
One of the best ways is understanding the WHY of your code.
The next 8 tweets will convince you of this fact.🧵
#1 - Context
Building a software system = solving a puzzle.
Each functionality = a piece achieving a business goal.
Coding without knowing the goal = a translator job.
Stop being a translator! Even ChatGPT can do that.
Understand the business goal before writing code.
May 3, 2023 • 10 tweets • 4 min read
Scaling databases can be hard.
Sharding is one of the ways to do so. But it is also complex.
However, many big products like Discord, Notion & Quora use sharding to scale their databases.
But what exactly is Sharding and how is it so complex?
Find out in these 8 tweets:🧵
#1 - What is Sharding?
It's a DB architecture pattern that evolves from horizontal partitioning.
You separate the rows of one table into multiple tables called partitions.
The aim is to reduce the data that needs to be searched for a query.
But there are 2 types of sharding👇
May 2, 2023 • 7 tweets • 3 min read
You think monolithic applications are hard!
You are in for a bigger surprise with Microservices.
Much of the complexity in microservices is due to the data.
If you can manage the data, you can reap the benefits.
Here are 5 patterns for data management in microservices.🧵
#1 - Database Per Service
In this pattern, each microservice is like a self-sufficient island🏝
It has its own logic and manages its own data.
No direct access to this data without going through the API layer.