Why randomize your file names for cloud storage/CDN?

后端 未结 3 2045
無奈伤痛
無奈伤痛 2021-02-09 21:33

When you look at a profile picture on a social networking site like Twitter, they store image files like:

http://a1.twimg.com/profile_images/1082228637/a-smile_t         


        
3条回答
  •  执念已碎
    2021-02-09 22:14

    Mainly, it prevents name collisions. More than one person might upload "IMG_0001.JPG", for example. You also avoid limits on the number of files in one directory, and you can shard images across multiple servers - there's no way a huge site like Twitter or Facebook could store all photos on one server, no matter how large.

提交回复
热议问题