Paste bin system design | Software architecture for paste bin

  Рет қаралды 65,298

Tech Dummies Narendra L

Tech Dummies Narendra L

Күн бұрын

Pastebin is a service that allows users to share text over the internet by generating a unique URL. In this video, lets learn how to design paste bin
Scale correction: its 13Million/24/3600 requests per second
System design: imgur.com/a/15E9eNa
#pastebinsystemdesign #pastebin #systemdesign

Пікірлер: 167
@mauvezebra
@mauvezebra 2 жыл бұрын
Hi Narendra. I listened to your system design videos and practised. Now I got the job I was trying to get. Thank you so much!
@pubamx
@pubamx 2 жыл бұрын
Hi Naren, this is one of the greatest system design overviews for this particular problem. A good approach in both LLD and HLG well justified and explained each trade-offs of the implementation. Thank youl
@carlosluque4753
@carlosluque4753 10 ай бұрын
I loved this design! thanks a lot! I'd like to add one point not covered in the capacity estimation. based on the input, users can add up to 10Mb per paste. 100k per day, deriving in 1000GB per day. I think it's good to mention that we can apply compression (manually or let the db do it) to the text that way we can save up to ~60% of the initial calculation for storage, reducing costs quite a lot
@rbragdish
@rbragdish 3 жыл бұрын
Hands down the best channel I've found for system design. Kudos bro!
@JuanHernandezV
@JuanHernandezV 3 жыл бұрын
Very good approach. Thank you. Wish me luck in my systems design interview today!
@ahmadasgharianrezaei6846
@ahmadasgharianrezaei6846 8 күн бұрын
Outstanding, clear and very deep solution for this problem. Really enjoyed it. Very well presented.
@brijchavda
@brijchavda 3 жыл бұрын
Couple of things. 1. Using serverless will not give you predictable SLA. 2) Cleanup service need to delete the entry from cache also. else, expired paste will still be accessible. 3.) rather than DKGS , you can use UUID (it takes double size 128bit) but u will not need redis and DKGS
@kartikvaidyanathan1237
@kartikvaidyanathan1237 2 жыл бұрын
If you use UUID inside the writepaste lambdas or containers then there is a chance of duplication as there are multiple instances. I don’t think that will work well.
@rabindrapatra7151
@rabindrapatra7151 Жыл бұрын
@@kartikvaidyanathan1237 A collision is when the same UUID is generated more than one time and is assigned to different objects. Even though it is possible, the 128-bit value is extremely unlikely to be repeated by any other UUID. The possibility is close enough to zero, for all practical purposes, that it is negligible.
@TheCosmique11
@TheCosmique11 Жыл бұрын
@@rabindrapatra7151 yes but what is stopping from multiple lambdas from generating the same UUID. I understand if the Id gen service is centralised and UUID comes from there. But my understanding is each lambda internally generates a UUID
@nishanth1828
@nishanth1828 8 ай бұрын
Cleanup service need to delete the entry from cache also. else, expired paste will still be accessible -> Can't we add into cache with TTL. That should automatically solve the issue
@taniksusu4034
@taniksusu4034 Ай бұрын
@@TheCosmique11 Acc to wikipedia - the number of random version-4 UUIDs which need to be generated in order to have a 50% probability of at least one collision is 2.71 quintillion. en.wikipedia.org/wiki/Universally_unique_identifier#Random_UUID_probability_of_duplicates:~:text=22%5D%5B23%5D-,Collisions,-%5Bedit%5D
@yodali7999
@yodali7999 3 жыл бұрын
very underrated design video that covers most use cases, thx a lot
@shubhamlodhi7641
@shubhamlodhi7641 4 жыл бұрын
This guy is truly a genius. Keep doing good work
@willinton06
@willinton06 4 жыл бұрын
Whenever I get a job I'm definetly joining your channel
@screen189
@screen189 3 жыл бұрын
Hi Narendra - Thanks for making these system design videos. Its useful for all engineers irrespective of whether they are interviewing or not. Please make a detailed video on following topics - a) System design for Heatmap. Let's say Heatmap of Uber drivers. b) Zookeeper functionality c) DevOps best practices or DevOps series.
@venkateswarank1145
@venkateswarank1145 4 жыл бұрын
Happy happieee birthday champ 😉 Your dedication of posting video even on your bday is just amazing. Looking forward to learn more from you 😊
@TechDummiesNarendraL
@TechDummiesNarendraL 4 жыл бұрын
Thanks :)
@lnit7411
@lnit7411 4 жыл бұрын
sir, you are doing a great job, please don't stop making such videos
@cornorange7622
@cornorange7622 4 жыл бұрын
just want you know your videos are great, appreciate your efforts!
@iancarbaugh4081
@iancarbaugh4081 3 жыл бұрын
Thank you, Narendra, for your exceptional content! I learned a lot from you.
@TheRealAndOnlyAsr
@TheRealAndOnlyAsr 3 жыл бұрын
Thanks! Your videos are always top quality
@MultiPriya28
@MultiPriya28 4 жыл бұрын
Please make a video on github design! :)
@rohangarg5473
@rohangarg5473 4 жыл бұрын
yes make a video on this.
@ankurkumarraj
@ankurkumarraj 4 жыл бұрын
yes Tech Dummies please make a video on this.
@designvoodoo
@designvoodoo 3 жыл бұрын
I would love to watch this!
@santoshreddy9628
@santoshreddy9628 4 жыл бұрын
Very nicely explained thank you.
@GauravJain108
@GauravJain108 3 жыл бұрын
Really cool idea to show the preview of 100KB while fetching data from S3.
@parthsharma8269
@parthsharma8269 3 жыл бұрын
If anyone is thinking how 64 comes up at 20:40, that is because [A-Z,a-z,0-9] sums up to [26+26+20]=62 and special characters like '+' and '/' adds up to 64, Base64 encoding
@jh0720
@jh0720 4 жыл бұрын
Your videos keeping getting better
@ghanshyam014
@ghanshyam014 4 жыл бұрын
Happy birthday 🎂 Dear bhaiya😘 Wishing you a very happy and prosperous birthday with full of love, joy and happiness...🌷🌺🏵️🌸💐 ..... ..... It's belated but yeah.....🥰 🌸🌿 Stay blessed , safe and protected always ❣️🌿🌸
@xxbighotshotxx
@xxbighotshotxx 2 жыл бұрын
Great work. I really appreciate the explanation. It was really well done.
@vijitail1979
@vijitail1979 4 жыл бұрын
Great explanation!!
@Akashkumar-md6rg
@Akashkumar-md6rg 4 жыл бұрын
Simply awesome!!😎😎
@kumarc4853
@kumarc4853 3 жыл бұрын
Thank you for great content :)
@user-oy4kf5wr8l
@user-oy4kf5wr8l 4 жыл бұрын
This is super good bro...Great Thx for ur great work! Could u do a video about calculating those normally seen volumnes, eg, 1 video takes how much bytes etc. Thx :D
@Tamer_Ali
@Tamer_Ali 4 жыл бұрын
I love your videos. you taught me a lot. I hope you make a video of e-learning system design.
@RajeshKumar-nd5ud
@RajeshKumar-nd5ud 2 жыл бұрын
Great Job👍 Waiting for Token based authentication system design.
@triv984
@triv984 3 жыл бұрын
Thanks Narian for great videos! I have a question regarding DKGS. Isn't it an overhead? I mean that key generation formula (timestamp+nodeid+counter) seems to be already enough to cover uniqueness requirement. And even if there will be collision -- is it still worse to call DKGS service instead of DB directly? Thanks!
@meghadave9363
@meghadave9363 3 ай бұрын
hi. some really important points for decision making. thanks
@vimalkumarsinghal
@vimalkumarsinghal 4 жыл бұрын
Hi Naren, your channel is full of resource ..thanks for sharing. Can you have one video on designing dashboard for efficient data centers monitoring using data model.
@piyusgupta9498
@piyusgupta9498 4 жыл бұрын
Excellent explanation Narendra, Wish you a very happy birthday dear !!!
@TechDummiesNarendraL
@TechDummiesNarendraL 4 жыл бұрын
Thank you so much 🙂
@JoshMadakor
@JoshMadakor 2 жыл бұрын
This is good. Thank you :)
@dheerendrakaibartta663
@dheerendrakaibartta663 10 ай бұрын
good video sir
@designvoodoo
@designvoodoo 3 жыл бұрын
Can you please make a video about Notion? I'm working on my final year project at university, measuring the impact of various software on the planet - your videos are so helpful! Thank you
@random66787
@random66787 4 жыл бұрын
Hi Narain. Great video. However, there seems to be a mistake at 3:26 in the estimation part. 100k/(24*3600) = ~1.5 not 1.5k writes/sec.
@TechDummiesNarendraL
@TechDummiesNarendraL 4 жыл бұрын
Feels stupid, why did I make that mistake😁
@UntamedRogueMavrick
@UntamedRogueMavrick 3 жыл бұрын
@@TechDummiesNarendraL You are doing thousands of smart things. No prob!!!
@IC-kf4mz
@IC-kf4mz 3 жыл бұрын
Your comment confused me further. You said "not 1.5k writes/sec" but in video he said "150 writes/sec". Did you mean it should be 1.5 writes/sec and not 150 writes/sec?
@IC-kf4mz
@IC-kf4mz 3 жыл бұрын
Also to note, here "per hour" and "per second" is not really used in the design later on.
@umangmalhotra1222
@umangmalhotra1222 2 жыл бұрын
@@IC-kf4mz Yes, it should be 1.5 writes every second.
@akashgupta13
@akashgupta13 4 жыл бұрын
Happy Birthday! 🎉🎂
@2devanshi
@2devanshi 4 жыл бұрын
Please try to include Food delivery system( real time tracking, multiple different apps for each types of user(buyer/delivery/hotel), synch between apps, sending device info when app is web based/sdk based etc) and ecommerce site( like best practices for big billion day with less latency(how we can optimize locking), Order management services - where millions of customers wants to view order in real time, order tracking, canceling order and similar kinds of design challenges in such systems)
@indiansoftwareengineer4899
@indiansoftwareengineer4899 4 жыл бұрын
Yeah, please make video on Swiggy or zomatos system design video.
@outofbody4788
@outofbody4788 2 жыл бұрын
lol - in other words "please design my business idea"
@anshulgolu123
@anshulgolu123 3 жыл бұрын
Your video is great !! Had one small doubt though below: How do you explain how can 10 character key be used to generate 100GB? Ideally total storage for 10 characters can be (62^10) * 10 bytes [assuming a character takes 1 byte] which is a lot more than 100GB If we assume we are using 5 character key we will get (62^5)*5 bytes which is approx 34GB
@rahulsharma5030
@rahulsharma5030 3 жыл бұрын
hey, thanks for tutorial.This channel is really awesome. I have a doubts:- 1.When you are mentioning data base comparision @13:00(approx). Why did you choose partitioning in RDMS.I think partitioning would be easy in NO SQL world as some db provide inbuild solution for this and RDMS is often easy to scale veritcally instead horizontally. Isnt it better to have NOSQL if we want to scale later? 2.And if we use partitioning .the way u mentioned that if one db is filled ,we will go other. Shouldnt we be using consistent hashing in this case instead of one range filled, go to other. Range based partitioning has multiple db nodes running parallel each handling different data. Please let me know you thoughts
@omprakashyadav-hf4pg
@omprakashyadav-hf4pg 4 жыл бұрын
Awesome video. Distributed key generation service can use bloom filter instead of Redis.
@kartikvaidyanathan1237
@kartikvaidyanathan1237 2 жыл бұрын
Why? Bloom filter is not deterministic , it is a probabilistic data structure, it only gives true negation but can give a false positive.
@ahmedkhaled4768
@ahmedkhaled4768 3 жыл бұрын
interesting thanks
@dpynsnyl
@dpynsnyl 11 ай бұрын
This is grade A stuff!
@totolipton
@totolipton 4 жыл бұрын
Hi I think the paste table needs a 'usr_id' field so you can find out who created the paste.
@unboxhdtech2185
@unboxhdtech2185 2 жыл бұрын
Let's see how many legends will watch this incredible video to the end🧡
@altugaecoffice
@altugaecoffice 2 жыл бұрын
Hi Naren, great content as always. I noticed u have not posted since last year. Are you going to put any more great videos as u used to or r u taking a break?
@jayeshsolanki1032
@jayeshsolanki1032 3 жыл бұрын
Hey Naren, where are you these days?? I really miss your videos on SAD. Please come back..
@ADG1025
@ADG1025 2 жыл бұрын
Thanks for the video. What about adding a CDN between the end user and read request? This would cache and offload all large portion of the read requests from ever hitting the API. Only a small percentage of pages would need to hit the origin. You could introduce a queue for expiring cached pages upon edit or deletion.
@Eremtek
@Eremtek 3 жыл бұрын
Thanks for the explanation! In the async clean-up step, should we also clear the value in the mem cache? For long texts, we'd end up with a preview (from the cache) but when it tries to fetch the full text from the DB it'll error out?
@rajeshrajendiran887
@rajeshrajendiran887 3 жыл бұрын
Mostly we will cache the data with some expiry dates time like 2 days or 7 days something like that, so it will automatically expiry automatically
@Rockersvirtue
@Rockersvirtue 4 жыл бұрын
Great video. Thanks for your effort. One doubt though, How to allow custom string provided by user? I understand that we can store mapping between key and custom string for each user. However, how to do for anonymous user? Wouldn't we be overwriting the paste or exposing name of paste in such case?
@Ramchandra-fp2ty
@Ramchandra-fp2ty 3 жыл бұрын
Hi Narendra, can you please discuss the feature of sharing the paste with other users and discuss it at scale and how to handle it
@shreyas23100252
@shreyas23100252 3 жыл бұрын
Hey narendra, what shouldbe the initial approach on any system design. Ex: I can we have split the requirement into functional requirement and non functional. Also what are videos which we need to go thru first to get the fundamentals and to full scale design. Any recommendation on materials to understand the basic module of SD.
@PRADIP2010PATEL
@PRADIP2010PATEL Жыл бұрын
Thanks! I think cleanup service has to delete record from MemCache if record present in cache.
@mohammadkaif8143
@mohammadkaif8143 2 жыл бұрын
One small correction, there would be userId field in the paste table.(13:48)
@nayannandi3596
@nayannandi3596 2 жыл бұрын
Make a video on tradingview system design....
@pandalove5374
@pandalove5374 2 жыл бұрын
Thank you so much for uploading great content. Can you please explain what happen to local counter when it recover from a failure? will be it reset to initial value?
@kumark7505
@kumark7505 2 жыл бұрын
Hi Narain, good video and explanation. Question on S3 Blob retrieval! Do you share the blob link to client and client downloads content? In this case, how authentication to S3 happens? Or Webserver behind the gateway retrieves the content from s3 by authentication and then send the downloaded data to client?.
@Emmanuel-px9lk
@Emmanuel-px9lk 4 жыл бұрын
Put a queue/message broker between the DKGS and consumers
@permshivsingh5215
@permshivsingh5215 3 жыл бұрын
Hi Narain if we are using twiiter snowflake to generate unique IDs and generate hashvalue from IDs using base 62 conversation then there is no chance of collisions. So I think we don't need KGS service . Write service can handle the key generation part and no need to check db if key exist or not as keys are always unique. What do you think ?
@abhishek08aug
@abhishek08aug 4 жыл бұрын
Hi Naren, Thank you so much for the amazing work of teaching system design that you are doing. Over the last few minutes I just kept wondering should we also not flush out the paste from the cache as well? As in what happens if my highly popular JSON’s soul just doesn’t become too out of talks to leave the cache even though its long dead in the DB?
@sreevishal2223
@sreevishal2223 4 жыл бұрын
Yup your right!. Also most caching services have in-build expiry feature so those services can work independently.
@zhqzhao
@zhqzhao 4 жыл бұрын
I think the redis and memcached are both performant enough.
@rahulsharma5030
@rahulsharma5030 3 жыл бұрын
@29, if we know algo to generate keys, like time stamp+node_id+counter. Then why cant write service generate on its own?It will take almost ineligible time
@mykytapiskarov7291
@mykytapiskarov7291 5 ай бұрын
Thanks Narendra! I learned lots of great ideas from you! One question, there's can be race condition when two write APIs will get same key from DKGS. How can we prevent such race condition?
@YashJain94
@YashJain94 2 жыл бұрын
Paste schema needs to also have user_id and user schema needs to have a list of all pastes created to fulfill the functional requirements
@hs2075
@hs2075 3 жыл бұрын
Can't we use Range based approach with Zookeeper as u explained in urlShortner design video to generate the keys?
@nayannandi3596
@nayannandi3596 2 жыл бұрын
Sir make a video on charting website like tradingview system design.....
@syjaf6615
@syjaf6615 4 жыл бұрын
first one!
@flavius29663
@flavius29663 3 жыл бұрын
Hi, very nice video. Why are you saying that memcached is faster than redis for this usage pattern? Are there some benchmarks or white papers? Or what are you basing this assumption on?
@arunavamukherjee2087
@arunavamukherjee2087 2 жыл бұрын
Hi Narendra, May be I missed something, but why we cant store everything in S3 and use a Geo specific CDN around that to get the data very fast? in that case we dont need the actual data in DB.
@munnykumar6248
@munnykumar6248 3 жыл бұрын
Please, describe socket connection in a distributed system/multi-server system
@bhavyabansal1143
@bhavyabansal1143 Жыл бұрын
for unique keys, can't we use same zookeeper process as we used in the url shortening design?
@Lima3578user
@Lima3578user Жыл бұрын
Can you please upload the basics of systems design
@aipaperreader
@aipaperreader 3 жыл бұрын
Please make a video on Skip list
@SakshiJain-bq6gc
@SakshiJain-bq6gc 2 ай бұрын
Thanks Narendra for great videos. I see you corrected the Traffic estimation. Shouldn't it also change the storage estimation?
@akashdarji7131
@akashdarji7131 2 жыл бұрын
hey bro if you have time can you make video on Brave Browser Blockchain based - System design, architecture. thanks
@tradestar9266
@tradestar9266 Жыл бұрын
Bro Can you make video of ZERODHA KITE system design
@manojgowdak6735
@manojgowdak6735 2 жыл бұрын
Hi bro I am manoj
@shashankmishra484
@shashankmishra484 Жыл бұрын
How is "User can decide on the pastebin link" solved? Here it seems that the user can keep on trying for a unique ID, of length 10 as constrained, and keep on hitting on the already used ones, leading to going to and fro until he finds a unique key? Does the snowflake generator or just a normal key generator help with this?
@irvinge4641
@irvinge4641 3 жыл бұрын
shouldnt the cleanup service also cleanup the used keys in Redis?
@prernachauhan6262
@prernachauhan6262 3 жыл бұрын
I did not understand the 64^10 part? I understand that we have 64 bit(8 character) unique Id, that can be used in our URL right? How are we generating 10 character url with 64 possibilities at each character?
@jesuskeyz
@jesuskeyz 3 жыл бұрын
could you do a video on WAZE system design? Or is that similar to UBER.
@umangmalhotra1222
@umangmalhotra1222 2 жыл бұрын
12:30 , isn't 65 KB Max row size in DBs like MYSQL? How are we going to store 100 KB data then in content field ?
@abcd12272
@abcd12272 3 жыл бұрын
Do we really need to keep track of used token ranges? Threads in the key generation service will always increment and return anyways, question of providing used keys will never arise
@jh0720
@jh0720 4 жыл бұрын
(64^10)*10 ≈ 1e+19, so shouldn't this be more like 10000000 TB and not 100 GB?
@sreemanth
@sreemanth 4 жыл бұрын
Key generation service , can we use bloomfilter to reduces size of redis memory size?
@TechDummiesNarendraL
@TechDummiesNarendraL 4 жыл бұрын
Yes
@eeyore345
@eeyore345 4 жыл бұрын
@@TechDummiesNarendraL Hmm .. bloom filter may return true when it's not, wouldn't it? I suppose since we have quite a few IDs to spare in this case, that could do. :)
@anusree114
@anusree114 3 жыл бұрын
Naren , you stopped making videos ?? Ohh ohh you might be busy on new job, but.......... we want you back.
@IC-kf4mz
@IC-kf4mz 3 жыл бұрын
1. Is schema important to discuss in System Design in detail? 2. If serverless, in URL Shortner also can we use serverless? 3. Why do we use memcached and not redis, just cost? High performance and cost? 4. Is Zookeeper a DKGS?
@manojgowda3621
@manojgowda3621 3 жыл бұрын
Hi I am Manoj
@jp-uo7bz
@jp-uo7bz 3 жыл бұрын
Why were both redis and memcached used? Wouldn't either solve the job?
@elfchosen1477
@elfchosen1477 3 жыл бұрын
I am wondering why blob storage read does not have cached?
@AModernCTO
@AModernCTO 4 жыл бұрын
How much cost you to add English subtitles in your videos or even Portuguese? It an awesome subject that should be available for more people to enjoy it.
@elproferiveraoficial
@elproferiveraoficial 3 жыл бұрын
his english is very understable and if you are in a real interview they won't show you subtitles.
@AModernCTO
@AModernCTO 3 жыл бұрын
It's not about real interview. It's about making his content available to everybody.
@elproferiveraoficial
@elproferiveraoficial 3 жыл бұрын
@@AModernCTO the video already has CC.
@iball5879
@iball5879 4 жыл бұрын
Can you please make a video on "system design for a online donation system" like gofundme ?
@abcd12272
@abcd12272 3 жыл бұрын
Redis vs Memcache, when to use what?
@NikashKumar
@NikashKumar 4 жыл бұрын
HI Naren, I need a small help with the system design question i'm trying to solve. It would be helpful if we can have a char or if you share your email. Looking forward. Thank you
@shahanakhan8299
@shahanakhan8299 3 жыл бұрын
The traffic estimates for writes is incorrect. 100K/(24*3600) = 1.1 pastes/sec . Am I missing something here?
@jrwang537
@jrwang537 3 жыл бұрын
Do you still make videos in this channel?
@CODFactory
@CODFactory 4 жыл бұрын
Why can't we use Zookeeper for key generation just like we used for url shortener?
@TechDummiesNarendraL
@TechDummiesNarendraL 4 жыл бұрын
You can, the reason why I didn't use is to show different ways of doing same thing
@AkshayTaletiya
@AkshayTaletiya 3 жыл бұрын
I have a suggestion/question - could we not create GUID instead of using DKGS
@devarpi911
@devarpi911 Жыл бұрын
For keys can't we use UUID V4?
Twitter system design | twitter Software architecture | twitter interview questions
36:56
Design Twitter - System Design Interview
26:16
NeetCode
Рет қаралды 469 М.
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 57 МЛН
Scary Teacher 3D Nick Troll Squid Game in Brush Teeth White or Black Challenge #shorts
00:47
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
Интервью по System Design. Александр Поломодов (Тинькофф)
1:26:41
NETFLIX System design | software architecture for netflix
51:26
Tech Dummies Narendra L
Рет қаралды 424 М.
Google system design interview: Design Spotify (with ex-Google EM)
42:13
IGotAnOffer: Engineering
Рет қаралды 1 МЛН
URL shortener system design | tinyurl system design | bitly system design
34:39
Tech Dummies Narendra L
Рет қаралды 455 М.
System Design: Design a URL Shortener like TinyURL
16:00
Code Tour
Рет қаралды 80 М.
Web Crawler System Design Concepts Nobody Talks About
21:42
Pratiksha Bakrola
Рет қаралды 5 М.
Intro to Software Architecture | Overview, Examples, and Diagrams
1:05:24
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 57 МЛН