Where Facebook stores several million images and videos. In a database or somewhere else? if so, where?

I am completely new to the database. I need information about where Facebook is located, which stores millions and millions of images and videos. Do they save it in their database and then retrieve the images / videos through the request? I read several times from some people that you should not store images / videos in a database, but they never talked about why and where else to store them if not in the database. Please provide me as much information as possible. He will be highly appreciated.

+4
source share
4 answers

Usually? Like files. On disk. Then save the paths to these files in the database for easy search. (Or save a key that can be used by some network service to find the file and transfer it.)

+7
source

Facebook uses a specialized and optimized solution that exactly matches the task of storing millions of images. This solution will not be useful for the general case, especially for those who are just starting to study databases.

Also remember that a database does not necessarily mean that it uses SQL. The file system is also a database for storing files. It is also optimized only for this task, which means that an attempt to save something other than files and try to return it will be either impossible or ineffective.

SQL databases have the function of storing all types of data and offer the programmer to decide which data will be returned at a later point in time. This makes them more inefficient when there is no need to decide later which data to return, but more adaptable to changing requirements. Facebook Image Storage can only be used to store images.

+4
source

Facebook does not save its images and videos in the database. Each file is uploaded directly to a server dedicated to this, and they are located around the world, for example, Pineville, Oregon or recently created servers in Sweden. However, as said, they have them everywhere.

What is stored in the database is simply the paths to these different files. Based on your location, the paths you are looking for will change, and for this you can access various servers from around the world depending on where you are.

+2
source

You do not store images or files in the database, you only save data (numbers, text, etc.). The files themselves are simply stored on a content distribution network that can serve images in browsers based on the closest location. THE NAMES of these images can be stored in a database anywhere. It is impossible to say how they are stored.

+1
source

Source: https://habr.com/ru/post/1493341/


All Articles