[CentOS] lots of small files in a folder on Linux centos

Sun Jul 24 11:03:36 UTC 2011
Eero Volotinen <eero.volotinen at iki.fi>

2011/7/24 yonatan pingle <yonatan.pingle at gmail.com>:
> Hello,
> I have a rather annoying issue on going with one of my centos virtual servers.
> the server hosts a website using apache and mysql ,there are three
> persons involved with keeping the site up and running.
> and i am his root due to the fact he does not know anything with about Linux.
> there is an php/sql coder , and the site owner which only knows to use
> the CMS and upload new articles to the website.
>
> the coder and the site owner work together for a long time already , i
> am their new admin ( as the last one was a major ISP which failed to
> host the site properly ).
>
> lately the server is under-preforming and load averages are high,
> mysql service keeps crashing and the server is hitting max memory
> usage ( so i added ram .. ) ,
> after looking into the website folders, i have found one folder which
> from my point of view is one of the causes for the server loads.
>
> (sorry for piping ls ).
>
> uploads]# ls | wc -l
> 3123
>
> I have talked with the site owner, which in turn showed this to the
> coder ,now he throws the ball back claiming: it has nothing to do with
> server performance.
> the folder is full of images, about 40K each, and i have good reason
> to believe this is the problem, as this is not the first time i see
> that a folder which includes a large amount of files causes a server
> to under-perform.
>
> the coder is not tech savvy as one might expect, so it's really hard
> for me to explain the issue of having lots of files in one folder to
> the site owner or to the coder.
>
> the hardware is a decent machine dual E5530 24RAM with six hard drives in raid.
> the virtual server has 2GB of ram and it's own CPU share ( 4 cores 8 threads ).
> the coder is arguing with facts sadly to say he has the site owner on
> "his side".
>
> long story short, how should i explain in the most simple way in plain
> english that having that much files in a folder will cause a server to
> work slower?
>
> pros vs cons of having a large amount of small files in the same
> folder on Linux Centos?

I assume that you are using ext3 or ext4 filesystems? Both ext3 and
ext4 slows down, if there is too much files in same directory.
XFS-fs is solution to fix this problem.

--
Eero