K
K
korsikov2018-07-02 14:36:17
Data storage
korsikov, 2018-07-02 14:36:17

Features of storing a large number of files on the server?

Question on the topic of the habr article https://habr.com/post/227855/ .
What is the maximum possible number of directories with the following initial data:
- there is an image 1.png;
- there is an MD5 hash from the image name md5('1') c4ca4238a0b923820dcc509a6f75849b ;
- there is a parent directory /gallery/ ;
Is it true that when using the file save path pattern by MD5 hash
/gallery/c4/ca/42/1.png, the
maximum possible number of folders will be /gallery/ [256 ] / [256] / [256] /1.png
and respectively:
/gallery/c4c/a42/38a/1.png == /gallery/ [4096] / [4096] / [4096]/1.png
or
/gallery/c/4c/a42/1.png == /gallery/ [16] / [256] / [4096] /1.png?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2018-07-02
@sim3x

0) there is an MD5 hash from the image content (before or after optimization)
1) c4ca/4238/a0b9/2382/0dcc509a6f75849b.png
/[65k]/

K
korsikov, 2018-07-02
@korsikov

i.e.
/x/== 16 folders per nesting level;
/xx/==256;
/xxx/==4096;
/xxxx/ == 65k;
And /xxxx/xxxx/xxxx/ total will give 274 625 *10^9 directories

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question