Is it an effect way to save all 100,000 cached files inside one
directory if it is allowed? Or will it be worth arranging these files
into sub directories to reduce the file size, to speed up web page
request?
Is it an effect way to save all 100,000 cached files inside one
directory if it is allowed? Or will it be worth arranging these files
into sub directories to reduce the file size, to speed up web page
request?
I cache fragments with an explicit path for the type of fragment cached
and model.
Has made it easy to clear out some fragments while keeping other if I
change the rendering of a certain piece. Like:
/show/project/ <- individual project fragments go here
/show/scenario/ <- scenario fragments go here
/related/project/ <- “relations” fragments for projects go here
/related/scenario/ <- “relations” fragments for scenario go here
along with keeping the file counts per folder lower, if I change the
“show” rendering of a model, or all models, I have a specific tree to
prune to dump those cached fragments. Same goes for the “related” tree
(which is comparatively expensive to generate versus the “show”
fragment).
I cache fragments with an explicit path for the type of fragment cached
and model.
Has made it easy to clear out some fragments while keeping other if I
change the rendering of a certain piece.
I think it is a good solution for you.
In my case, I want to cache the whole page, and there will be more than
100,000 page, which sharing a common layout. I want to know if I should
put all the cached files inside one single directory. By default, rails
will do so. But I am worry it may go beyond the limit of the file system
to store so many files, and to put too many files inside one directory
may make fetching one file take more time.
In ext3 I think the number of files is irrelevant to directories. Its a
matter of the drive itself, size of inodes and size of all the files,
etc.
I seem to remember seeing a presentation from Joyent where they found
they need a limit of 32,000 files in a dir, from a practical point of
view - could be wrong though I can’t find it at the moment.