R
R
RomanoFFUA2014-06-05 11:55:09
Computer networks
RomanoFFUA, 2014-06-05 11:55:09

Method for storing a large number of images on the site

Hello.
Here 's one of the responses that came up:

a good practice that is used in many places, for example, Microsoft
calculates md5 for a file - 2274facdbca56499fe397344c633e25a
put the file in the avatars/227/4fa/cdb/2274facdbca56499fe397344c633e25a.jpg folder

Please explain why so? Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikhail Alekseev, 2014-06-05
@RomanoFFUA

I will assume that this is done in order not to store the entire path to the
avatars/227/4fa/cdb/2274facdbca56499fe397344c633e25a.jpg file
, but only its name 2274facdbca56499fe397344c633e25a.jpg, from which you can easily restore the full path.
Plus, we still get the distribution of files into subfolders, which speeds up the file system.

P
Pavel Solovyov, 2014-06-05
@pavel_salauyou

increases the speed of listing a folder
easier to transfer, or even split files across multiple servers to
quickly find the desired file

R
RomanoFFUA, 2014-06-05
@RomanoFFUA

Well, with the acceleration of work with the FS - by itself. Are there any other hidden benefits?

V
Vlad Zhivotnev, 2014-06-05
@inkvizitor68sl

The speed of working with the FS increases (however, the web server does not care, it does not list, and chdir() is instant, regardless of the number of files).
Accidental overwriting of one file by another with the same name is excluded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question