Member-only story
How do we store files?
There are many ways to store the file.
- Store file in server.
A server is a machine like your PC, Laptop so you can store files in the local file system.
It works perfectly if you have a single server and fewer requests to serve.
Let’s assume you are getting more requests and one server is insufficient to handle them. You may add one more server and load balancer to serve more requests.
Let’s assume you are uploading two images: image_1.jpg and image_2.jpg
Request 1 -> UploadImage[image_1.jpg] handled by server 2 and stored inside server 2 local storage.
Request 2-> UploadImage[image_2.jpg] handled by server 1 and stored inside server 1 local storage.
Those files are stored on different machines.
You requested to download an image.
Request 3 -> downloadImage[image_2.jpg]
image_2.jpg stored inside server 1 local storage.
Request 3 may or may not land on server 1.
if the request lands on server 1 then it will return image_2.jpg
if the request lands on…