STEVE JOBS GOT FIRED FROM APPLE.
Then he walked straight into MIT and dropped the most raw, unfiltered 60-minute business masterclass ever recorded.
Zero PR bullshit. Zero image to protect.
Just pure, brutal honesty from the man who built Apple once and was about to rebuild it even bigger.
Stop scrolling.
Watch this tonight instead of Netflix.
Bookmark it. Come back to it.
Instead of watching an hour of Netflix, watch this 2 hour hour Stanford lecture will teach you more about how LLMs like ChatGPT and Claude are built than most people working at top AI companies learn in their entire careers.
@novasport_cz Nenažraná nova! Vraťte se zpět do školních lavic naučit se, jak nenasrat diváka.! Pokazili jste svou nevhodně načasovanou reklamou hlavní zápas UFC 303!
This brilliant technique for handling database queries literally saved Discord.
It helped them store trillions of messages and fetch them without bringing their DB cluster to its knees.
The technique is called Request Coalescing.
And it’s too good to ignore.
But what’s so special about it?
If multiple users are requesting the same row at the same time, why not query the database only once?
This is exactly what Request Coalescing helps us achieve.
Here’s what happens under the hood:
- The first user that makes a request causes a worker task to spin up in the data service
- Subsequent requests for the same data will check for the existence of that task and subscribe to it
- Once the initial worker task queries the database and gets the result, it will return the row to all subscribers at the same time.
There are several pros to using Request Coalescing:
- Efficient utilization of database resources
- Ability to handle more concurrent requests without creating hot partitions
- Reduce latency
But there are some cons as well:
- Implementation can be complex with regards to getting a fair distributed reader-write lock. Basically, multiple readers need to access the data simultaneously while preventing conflicting writes
- Overall latency may go down, but certain requests will take more time
Of course, this technique is NOT needed normally.
But at a certain scale, it can actually save your business.
===
That’s all for now!
If you enjoyed this post, don’t forget to:
- Destroy the LIKE button
- REPOST so that everyone can try Request Coalescing wherever applicable.
- BOOKMARK for future reference
- Follow me for more posts like this.
You always ask me, why I use #swift for backends. Answer: Because it’s soooo cheap to run, having low memory footprint.
Running under 30 MB of RAM it fits a lot of these in just a 1 AWS instance. I would have to pay 10x more for Java / Spring. And it’s type safe.
#vapor#swift