@legitalgorithmswithpeter: 🔥 How would you handle 500,000 likes in just one minute? This is where the Hot Row Problem comes in. Updating the same database row for every like creates contention, delays, and timeouts. 🚀 The solution? * Use Redis for lightning-fast counting. * Batch updates every few seconds. * Reduce thousands of database writes. But what happens if Redis crashes before those likes reach the database? 🤔 💬 How would you prevent losing those likes? #SystemDesign #Redis #Database #BackendEngineering #TechExplained

algorithmswithpeter
algorithmswithpeter
Open In TikTok:
Region: US
Saturday 14 November 2026 18:44:54 GMT
97531
4477
106
128

Music

Download

Comments

rm555566
. :
Use persistent cache
2026-11-14 19:35:21
38
ademic_tch
Legends :
Simply use a message broker like RabbitMq or Kafka
2026-11-14 22:36:02
75
peterdesmall
Peter de Small :
How do you then track who liked what?
2026-11-14 19:13:42
19
phonemonster313
user8121616439376 :
At that scale, the real time number is not that important. You derive a velocity and increment the counter at that speed (add some jitter +/- noise for fun). At a sustainable interval use a slower, more accurate source of truth to reset the baseline and recalculate the velocity.
2026-11-14 23:05:44
20
defwolfin
wolfin :
Redis cant crash because it’s an in memory cache
2026-11-15 09:25:09
6
mkvngl
angullllll__ :
What about dns
2026-11-14 23:47:23
4
iam_jorgeluis
Jorge Duran :
And an asynchronous queue like rabbitMQ or kafka?
2026-11-14 23:23:46
2
hitroylsc7b
musjg7632 :
redid can't crash
2026-11-15 07:27:36
0
doctor.oak12
Dan :
idk at all so my noob opinion is you tune your batch sizes to minimize the impact of your redis' down time during restart. Possibly use a duplicate redis to cache the cache as a failsafe if you can afford the ram. Then fetch likes from viewers again. If there's a way to cache what redis is storing without increasing server expense or reducing speed then that's the way to do it
2026-11-14 23:41:08
0
romhulio
罗曼 :
redis has sla for crushing
2026-11-15 05:06:26
0
dgilmour76
dgilmour76 :
Redis paired with Redis Sentinel (redundancy)
2026-11-14 20:39:15
13
afiqmeoww
afiq meow :
i dont finish the video yet but my proposed solution would be to accumulate the likes count and write into the db every set timeframe. it will reduce the db write count but each write size in increases significantly. idk the ideal data size but heh
2026-11-15 01:21:23
0
yannisragkavas
LiveTrips :
And if kafka dies? Same as redis
2026-11-15 10:11:37
0
bronderblazer
Bronderblazer :
Iso27001 policy prohibits redis db to crash.
2026-11-15 01:00:37
4
riskofrain
haha :
anything with eventually consistent and fast
2026-11-17 23:04:05
1
david.katz
David :
Eventual consistency. Good at scale.
2026-11-16 19:14:24
1
social2575
Social :
Rabitmq?
2026-11-14 19:34:18
4
mou3ezboul3ez
معز مكشخ 🇧🇪🇵🇸🇹🇳♒ :
This is came behind one of the reason why a book like design data intensive application was wrote
2026-11-15 15:48:53
3
elastnlakdr
anaab :
High availability cluster, never let a single node hold the transaction by itself.
2026-11-14 21:03:17
5
azura210_
Azura210 :
if the cache layer breaks down for one database server, as long as you have multiple read replicas running in different servers in different regions, you can just promote one of those to master server and continue on
2026-11-14 22:07:37
3
obadare001
Oba :
what will Nvidia CEO do?
2026-11-14 21:34:44
1
fatyak.84
Zach M :
One could use an append only (inserts) table in place of Redis. The rest stays the same. Now what you were putting in Redis is durable. Clean up on this table would have to be smart to avoid locking the table and blocking inserts.
2026-11-16 11:20:05
1
luke49722
Dollar Diary :
Fanout table
2026-11-15 00:50:24
1
westlovekingflows
Westlove | Software Engineer :
Kafka
2026-11-14 19:58:34
1
waheed_desire
Waheed Desire :
Redis AOF
2026-11-14 19:11:43
0
To see more videos from user @legitalgorithmswithpeter, please go to the Tikwm homepage.

Other Videos


About