쉐도잉 연습: 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!

이 수업에 대하여

이번 수업에서는 파일 업로드 서비스 설계를 통해 시스템 디자인에 대한 이해를 넓히고, 영어 표현을 연습합니다. 우리는 사용자의 요구사항을 분석하고, 대규모 파일을 처리하는 방법을 학습하면서 필요한 어휘와 구문을 익히게 됩니다. 이 과정을 통해 영어 쉐도잉 기술을 활용하여 발음을 개선하고, 더 자연스럽게 영어를 구사할 수 있는 능력을 키울 것입니다.

주요 어휘 및 구문

  • 파일 업로드: files upload
  • 비례 관계: relational database
  • 메타데이터: metadata
  • 비동기 처리: async processing
  • 사전 서명된 URL: pre-signed URL
  • 객체 저장소: object store
  • 보안 처리: securing
  • 확장성: scalability

연습 팁

이 비디오의 속도와 어조를 고려하여 영어 쉐도잉을 할 때는 몇 가지 점을 염두에 두세요. 첫째, 발음을 정확히 따라 하려면 원어민의 속도에 맞춰 반복하는 것이 중요합니다. 쉐도잉 할 때, shadowspeak 기술을 활용하여 듣는 것과 말하는 것을 동시에 연습하세요. 예를 들어, 특정 문장을 듣고 즉시 따라 말하는 연습을 해보세요. 또한 IELTS 스피킹 시험과 비슷한 상황을 가정하여 말하기 연습을 하며, 자연스럽게 문장을 연결해 보십시오. 이러한 연습이 여러분의 영어 말하기 능력을 한층 더 발전시키는 데 도움이 될 것입니다. 최종적으로, 다양한 shadowing site를 활용하여 여러 주제에 대해 반복 연습을 통해 자신감을 기르세요.

쉐도잉이란? 영어 실력을 빠르게 키우는 과학적 방법

쉐도잉(Shadowing)은 원래 전문 통역사 훈련을 위해 개발된 언어 학습 기법으로, 다언어 학자인 Dr. Alexander Arguelles에 의해 대중화된 방법입니다. 핵심 원리는 간단하지만 매우 강력합니다: 원어민의 영어를 들으면서 1~2초의 짧은 지연으로 즉시 소리 내어 따라 말하는 것——마치 '그림자(shadow)'처럼 화자를 따라가는 것입니다. 문법 공부나 수동적인 청취와 달리, 쉐도잉은 뇌와 입 근육이 동시에 실시간으로 영어를 처리하고 재현하도록 훈련합니다. 연구에 따르면 이 방법은 발음 정확도, 억양, 리듬, 연음, 청취력, 말하기 유창성을 크게 향상시킵니다. IELTS 스피킹 준비와 자연스러운 영어 소통을 원하는 분들에게 특히 효과적입니다.