I am working on a website where users have ability to store all kinds of media on the server and there can be any number of users.
I thought I would store all the media which users upload like this:
MediaRootDIR/UserRootDIR/file.xyz (UserRootDIR is unique for every user)
There is another way of storing this:
MediaRootDIR/file.xyz
I dont worry about organization cause I have path of the files stored in DB anyway.
My Question:
Which method is faster? (Search,Retrieve & Write for Filesystem - Using EXT4 File system as of now).
Does using subdirectories speed up the retrieval since less no. of files need to be loaded every level in the directory tree?
Is it advisable to use subdirectories since I heard there is a limit to the number of subfolders a folder can have in EXT4 is around 64,000
Is there any better alternative to store media like this?
Thanks in advance
EDIT: Name conflicts wont be a problem for me since every file uploaded has unique name