There are thousands and thousands of files under cache/*/0/node folder. So the 'node' folder is not very efficient. Because all files are kept on remote file servers not on web server, meaning every time a folder is accessed, every single file has to be accessed over the remote LAN connection.
I think it will be helpful that I separate(divide) those files into many sub-folders and only put 100 files in each sub-folder to speed up your sites access.
For example:
use path like cache/*/0/node/1/2/3/4/5/6/7.html to save cached files instead of cache/*/0/node/1234567.html
But I don't know how to modify the RewriteCond and RewriteRule in .htaccess file to do that.
My website is stopped by DreamHost because it is overloading and slowing the whole web server.
DreamHost tell me that: Anything you can do to make smaller folders would speed up your sites access.
Please help me out. Thank you very much.
Comments
Comment #1
Arto commentedHmm, interesting problem. Your proposed solution is reasonable, but I don't think mod_rewrite will allow it, and I can't immediately think of a workable alternate workaround. Suggestions welcome.
Comment #2
bingjiw commentedI finally figured out a way to solve this problem.
First, add following lines into your .htaccess file. To redirect request to sub-folders.
Then, I have set a cron job to run following bash .sh script per 10 minutes. This script will move cached files from 'node' to corresponding sub-folders.
I have tested this solution on my website wbj123.com, and it works well.
Comment #3
toma commentedAre this solution added to new release or not ? because i have the same problem in my server
Thanks for this great module
Comment #4
Arto commentedNo, the release does not have any new features per se. I still need to review your solution.
Comment #5
Hetta commentedOK, I've tested this.
I added the .htaccess bits to the end of the boost part of the .htaccess file. The rewrite part now looks like this:
The bash script works as advertised, and moves pages from /node/ into subfolders.
However. After I've run the bash script, /node/12345.html is moved to /node/12/34/12345.html. AND: whenever I look at a page as user 0 (= anonymous), a new page gets generated under cache/$server/0/node/12345.html .
That's not what I'd call caching ... @bingjiw, what else did you do, to get this to work?
Thanks!
Comment #6
bingjiw commentedYes. So you have to run that bash script often. For my website, I have setted it in cron to run it every ten minutes, that's my solution.
Comment #7
Hetta commentedThe problem is, that's defeats the whole idea of caching, and thus is a non-solution to this particular problem.
Have you set the expiry for your files to 10 minutes, too? Personally, I think the longer the better, so I'd love to have a week in there ... 1 day max isn't all that much, for a mostly static site.
Comment #8
bingjiw commentedYou can not expect a real solution without modifying the core code of this module. The idea of 12/34/12345.html need to be writen into this module to solve this problem from the root. For now, my "solution" can avoid the heavy load of web server. That's it.
Comment #9
mikeytown2 commentedMoved to #410730: System limits: Number of files in a single directory. We are no longer dealing with the node folder, and running a separate cron doesn't sound like an idea solution.