Filipe Brandenburger wrote:
In general, having directories with a huge number of files tends to be a bad idea, you will most likely have performance bottlenecks with specific filesystems or tools. If possible, try to change the application to create two or three levels of directories using a hash on the filename and then creating directories with a small number of files on each of them.
This is particularly true of directories with a lot of activity. Whenever an open for writing happens, the directory has to be searched to see if the file already exists, and if it doesn't it must be created - and the search/create must be atomic so the directory must be locked while it completes.