शैडोइंग अभ्यास: Design a File Upload Service Like a Senior Engineer - वीडियो के साथ अंग्रेजी बोलना सीखें

लोड हो रहा है...
1
How can you design a scalable file upload service?
2
In this video, I'm going to walk you through a system design discussion where
3
we are going to build a file upload service step by step, starting from a very simple scenario and then expanding it into a more reliable and scalable solution.
4
So let's start by listing out some requirements for our file upload service.
5
These are going to be our functional requirements
6
and we need to be able to upload
7
and download files, obviously we need to be able to work with large files we need to make our system secure
8
and we also have to allow for async processing of the files
9
so that our users don't have to wait too long
10
or any background work that we have to perform behind the scenes
11
so you may start simple where you have your clients
12
and they have some files that they want to upload to our API
13
so let's add a component here this is going to be our file upload API
14
and this is going to be their entry point for their initial request.
15
So they're going to send the request to our API
16
and we could have an endpoint like files and then slash upload for example.
17
We're also going to need some database and this is going to hold our files and metadata for our initial implementation.
18
It doesn't really matter which specific database we're using but let's say it's some sort of relational database.
19
So our API needs to be able to store the data inside of our database
20
and this could be our initial primitive implementation.
21
Now let's look at our functional requirements.
22
So we'll be able to upload and download files, store our metadata.
23
Now the ability to work with large files is somewhat questionable as all of the requests are flowing through our API.
24
So it's going to quickly become a bottleneck
25
if many users are attempting to upload a file at the
26
same time as we have to buffer the file in memory before we can store it in our database.
27
So I'm going to leave a question mark there even though we should probably fail this requirement.
28
When it comes to security we can still secure this just fine
29
and then async processing is somewhat possible with background services but if it's all still running on our single API instance, then we're going to quickly run into the same bottlenecks.
30
Another problem that we're going to run into is with the fact
31
that we are initially storing the files and the metadata in our database.
32
So most databases can store binary data just fine, but this is going to cause problems with page size explosion, as we can assume these files can be large,
33
and most databases have an upper limit on how large a single page can be.
34
So you can imagine a single file spanning multiple database pages, and this incurs more costs when writing to the database and also querying from the database.
35
So it's something to keep in mind.
36
And this is where we could reach out to a more specialized solution for working with files.
37
So we can introduce another component into our system, and we're going to call this the object store.
38
So these are specialized services.
39
So I'm going to give you a couple examples.
40
So let's say something like SV or Azure Blob Storage, and they are designed to work with files efficiently.
41
So with the object store now part of our system, we're going to slightly alter how clients are interacting with the file upload API.
42
So what's going to happen is instead of having an endpoint to directly upload the file to our API, we're going to introduce a different API endpoint.
43
So let's add it here and let's call it something like files pre-signed upload.
44
So the idea here is we get what's called a pre-signed URL
45
and it's supported by most of these object stores
46
and this gives you a secure URL that allows you to send a request directly to the object store.
47
So after getting the pre-signed URL, our client is then going to send another request
48
which is going to upload the file directly to the object store
49
and this fixes a couple of big bottlenecks inside of our system.
50
So first of all the file upload API is no longer
51
a single point of failure as we can now upload
52
and download files from the object store using pre-signed URLs
53
which means we still have security as our users have to send the initial request to the upload API
54
which means they have to be authenticated in order to even get a pre-signed URL
55
and then we can get the benefits of object stores where they can work with large files.
56
They also have support for multi-part upload
57
which means we can break up a large file into multiple chunks and then stream those to the object store.
58
This also gives us the ability to pause and resume uploads.
59
We also get support for deduplication and we also get support for controlling file retention.
60
So instead of redesigning something like S3 from scratch, we can simply leverage it as another component inside of our file upload API.
61
Another component we need to support is the ability to have async processing.
62
So let's say we need to do a couple of operations behind the scenes after a file is uploaded.
63
So I'm going to add a couple of components here.
64
So let's say we need to perform virus scanning.
65
Then we could have things like thumbnail generation or more general preview generation.
66
We could perform things like optical character recognition or something more general like validation.
67
So all of these can be fairly long-running operations, especially when we need to support a large number of file uploads.
68
So how do we implement async processing for all of these operations?
69
Well, we need to introduce another component into our system.
70
So let's add some sort of pipeline and this is going to be our queue.
71
Let's add it here below the database and then we have a couple of ways how we could integrate this.
72
Either we could have our object storage enqueue a message after upload
73
and this could kick off the processing inside of our background services as simple message consumers
74
or we could have our object storage send some sort of callback to our file upload API
75
and then our file upload API would be responsible for sending a message to the queue on behalf of the object store.
76
I think the first approach here is probably more scalable as most object stores already have support for this built-in
77
and they can integrate with many popular messaging systems.
78
So let me actually move all of these components over here
79
as I'm going to need the bottom part of the screen for one more thing we want to add
80
and that is after mostly solving the file upload part we also have to solve how to reliably
81
and securely allow our users access to these files which means giving them the option to download the files.
82
So for this we can introduce what's called a content delivery
83
network where our clients can send a request to download the file and if it's not available, the content delivery network can reach out to our API to provide this file
84
and this is mostly good for public or static files.
85
So you can think of things like documentation that can be publicly accessible and things that don't change that often.
86
Of course, static assets for your website.
87
And why a content delivery network is good is
88
because it's usually globally distributed and it can route your user's request to the geographically closest component.
89
Now, what about requests for some specific files?
90
Those we can route directly to our API.
91
And to implement this securely, we're also going to utilize pre-signed URLs, except this is going to be some sort of download endpoint for example
92
and this is going to follow a similar idea as uploading to the object store
93
and is going to allow our clients to leverage the power of our object store to get access to their files.
94
So this final design should now check most of our boxes.
95
We can upload and download file, we can store the metadata either in the object store
96
or inside of our custom database and we can pull this value after a callback
97
or we can consume the message from a queue.
98
We can work with large files as most object stores support this.
99
We also have security built in as we have dedicated access
100
control for each file we can make them public we can make them private we can share them between users
101
and we've also got the ability to do async processing as
102
we can pick up messages from a queue from some background worker
103
and perform the work behind the scenes and then notify our file upload service
104
when the processing is done and lastly i just want to leave off with an idea
105
if you want to self-host an object store there are open source options out there like for example rustfs
106
which is fully s3 compatible and you could run it on your own system
107
if for some reason you don't want to use a cloud solution like AWS S3 or Azure Blob Storage.
108
And another option I ran into is Seaweed FS.
109
There are options out there like Mini.io, which was open source but now isn't, then Rust FS or Seaweed FS, and I'm going to leave some useful resources and links in the description of this video.
110
Let me know in the comments what you would change about this design
111
and what other considerations you would have made that I may have possibly missed.
112
Also, if you would like to see more system design discussions like this one, consider leaving a suggestion for what topic I should cover.
113
If you enjoyed this video, gently tap the like button to let me know.
114
Thanks a lot for watching, and until next time, stay awesome!

संदर्भ और पृष्ठभूमि

इस यूट्यूब वीडियो में, वक्ता एक स्केलेबल फ़ाइल अपलोड सेवा का डिज़ाइन करने पर चर्चा कर रहे हैं, जिसमें सरल स्थिति से प्रारंभ करके इसे एक अधिक विश्वसनीय और स्केलेबल समाधान में विस्तारित किया जाएगा। वीडियो में विभिन्न तकनीकी पहलुओं के साथ-साथ फ़ाइल अपलोड API और डेटा स्टोरेज के लिए आवश्यकताएं बताई गई हैं। यह चर्चा न केवल तकनीकी ज्ञान बढ़ाने के लिए है, बल्कि यह अंग्रेजी बोलने में धाराप्रवाह बनाने में भी सहायक होगा, जब आप इसे अपने दैनिक संचार में इस्तेमाल करने का प्रयास करेंगे।

दैनिक संचार के लिए शीर्ष 5 वाक्यांश

  • “फाइल अपलोड कैसे करें?” - यह एक सामान्य सवाल है जो आप उस समय पूछ सकते हैं जब आपको किसी को फाइल भेजने की आवश्यकता हो।
  • “क्या यह प्रणाली सुरक्षित है?” - सुरक्षा बनाना एक महत्वपूर्ण बिंदु है, खासकर जब ऑनलाइन फ़ाइल स्टोर कर रहे हों।
  • “मुझे एक प्री-साइंड URL कैसे मिलेगा?” - यह प्रश्न फ़ाइल अपलोड के लिए सही तरीके को बुझाने में सहायक होता है।
  • “क्या हम बड़े फाइल के साथ काम कर सकते हैं?” - यह पूछना आवश्यक है जब आप बड़े डेटा फाइल्स के बारे में बात कर रहे हों।
  • “इस प्रणाली में समस्याएँ क्या हैं?” - यह एक महत्वपूर्ण प्रश्न है जो आपको तकनीकी चर्चा में शामिल करने में मदद करता है।

चरण-दर-चरण शैडोइंग गाइड

इस वीडियो की कठिनाई को पार करने के लिए आप निम्नलिखित चरणों का पालन कर सकते हैं:

  1. सुनना: सबसे पहले वीडियो को ध्यान से सुनें, ध्यान दें कि कैसे वक्ता अपने विचारों को प्रस्तुत करते हैं।
  2. पुनरावृत्ति: वीडियो के हिस्सों को बार-बार सुनें और नोट्स बनाएं। साथ में बोलने का प्रयास करें, ताकि आप शैडो स्पीच की तकनीक का अभ्यास कर सकें।
  3. व्याख्या: इस सामग्री को अपने शब्दों में समझें और फिर इसे अनुवादित करें। इससे आपको बड़े शब्दों और टेक्निकल वाक्यांशों का अर्थ समझने में मदद मिलेगी।
  4. व्यवहार: वीडियो में कहे गए वाक्यांशों को अपने दैनिक संवाद में इस्तेमाल करें, जिससे आप अधिक आत्मविश्वास से बोल सकें।
  5. प्रकाशित करना: यदि संभव हो तो अपने अभ्यास को रिकॉर्ड करें और सुनें। यह आपको अपनी प्रगति पर विचार करने में मदद करेगा।

इन प्रयासों से, आप यूट्यूब से अंग्रेजी सीखने के साथ-साथ अपने शैडो स्पीच कौशल को भी विकसित कर सकते हैं। चाहे आप एक शैडो स्पीक करने वाले हों या सिर्फ रोज़मर्रा में अंग्रेजी बोलने का अभ्यास कर रहे हों, ये टिप्स आपके लिए फायदेमंद साबित होंगे।

शैडोइंग तकनीक क्या है?

शैडोइंग (Shadowing) एक विज्ञान-समर्थित भाषा सीखने की तकनीक है जो मूल रूप से पेशेवर दुभाषिया प्रशिक्षण के लिए विकसित की गई थी। विधि सरल लेकिन शक्तिशाली है: आप मूल अंग्रेज़ी ऑडियो सुनते हैं और तुरंत इसे ज़ोर से दोहराते हैं — जैसे वक्ता की छाया 1-2 सेकंड की देरी से। शोध से पता चलता है कि यह उच्चारण सटीकता, स्वर, लय, जुड़ी हुई ध्वनियाँ, सुनने की समझ और बोलने की प्रवाहशीलता में काफ़ी सुधार करता है।