David Collier-Brown
2000-Mar-09 14:00 UTC
why is samba so slow with many files in one directory?
Jeremy Allison wrote:>> Nope, I don't think so. Look at the kernel mailing lists for comments > comments about ext2fs performance with 10,000+ files - it sucks. > The developers consider this a broken application decision (ie. storing > that many files in a directory for an application, rightly > or wrongly). Try doing a regular ls of a directory with that many files, > time it and then see if Samba is using equivalent time (I bet it is).Yup! In scanning a directory of 85,783 files, real user sys smbclient took 43.11s 4.59s 3.55s ls -l took 1m46.69s 42.33s 10.40s ls took 19.49s 3.16s 0.82s smbclient does a readdir and a stat for each file, as does ls -l: the getdents times are equivalent, the difference is in the formatting and sorting. Very very roughly, ls takes .000272 second/dir entry for this size directory. The directory size is 1369088, so that's roughly 70 KB/S. Ext2fs is only slightly faster at reading than ufs, so I expect similar times. Hint: if your directory needs indirect blocks, it's **way** too big! --dave -- David Collier-Brown, | Always do right. This will gratify some people 185 Ellerslie Ave., | and astonish the rest. -- Mark Twain Willowdale, Ontario | //www.oreilly.com/catalog/samba/author.html Work: (905) 415-2849 Home: (416) 223-8968 Email: davecb@canada.sun.com