Max (practical) files per folder on a Windows file share

network-shareserver-message-blockwindows-server-2003

I support an internal application that stores files on a Windows Server 2003 SP2 file share. Because of how it is currently configured to store files, one folder has ~116,000 files in it (another has ~65,000, and the other folders have less, but still several thousand in each). The application has become very slow to write files to.

The file layout is configurable to an extant, so I'm trying to come up with a better plan. Does anyone have any experience on how many items per folder SMB can handle before it starts to become unusable? In this case, it's been slow for quite a while, but it didn't start become unberable until the folder exceeded 100,000 files.

Best Answer

It's more dependent on bandwidth and latency (especially latency) than it is on the number of files and scaling in the algorithms being used to enumerate the directory. There is no "magic number", I guess, is what I'm saying.

The SMB protocol is hideous for requiring lots and lots of round trips. That number of files, with double the latency, would be many times more than twice as slow, for example.

You've done the benchmarking by accident for your LAN, your network infrastructure's latency, and your server computer's IO subsystem latency. You've obviously found a "magic number". I'd get that directory pared down until performance gets better. There's no other way!