Support » Plugins » [Plugin: WP Super Cache] Too many files causes problems

  • niska


    I have more than 50000 posts. I’ve enabled “WP Cache and Super Cache enabled = ON” and “Super Cache Compression = ON”. ALL other settings are unchecked. I’m only caching posts and have set expire time to 0 seconds (never expire).

    When 30000 – 35000 posts are in the cache I get problems:

    Dynamic page generated in 2.014 seconds.
    File not cached! Super Cache Couldn’t write to: wp-content/cache/supercache/

    At this time my disk has 16 GB free. After clearing the cache, everything works again.

    My guess is that there are too many files in the supercache directory.

    Would it be possible to change the cache directory structure so that “12345.html” would go into /1/2/3/4/12345.html ?

Viewing 10 replies - 1 through 10 (of 10 total)
  • If you know how to get mod_rewrite to serve a file like that I’d gladly change the plugin as it would be very useful! I don’t know how to do it unfortunately.

    If you’re using the preload function, you’ll have to cache less posts, otherwise, set your expiry time smaller so that number of posts aren’t cached.

    It’s a filesystem issue unfortunately. You could also change your permalinks and add a mod_rewrite rule to redirect with a 301 redirect. You won’t lose any pagerank that way.



    This checks to see if the URL has more than 4 characters. If so it rewrites using the subdirectory:

    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/$2/$3/$4/index.html.gz -f
    RewriteRule ^([a-zA-Z0-9])([a-zA-Z0-9])([a-zA-Z0-9])(.+) /wp-content/cache/supercache/%{HTTP_HOST}/$1/$2/$3/$4/index.html.gz [L]

    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/$2/$3/$4/index.html -f
    RewriteRule ^([a-zA-Z0-9])([a-zA-Z0-9])([a-zA-Z0-9])(.+) /wp-content/cache/supercache/%{HTTP_HOST}/$1/$2/$3/$4/index.html [L]

    Since there might be URLs that are less than 4 characters long, you still need to keep the old rewrite-rules.



    Did you get any time to have a look at this?

    Thanks for those, no I haven’t had time to look at this right now, and won’t for a few days.

    Oh, it’s unlikely something like this will go into the next version. It will make cache generation and maintenance a lot more complicated. 🙁



    For the layman, is there a maximum for what supercache will work with? I’m intending to have a lot of posts and custom post types in the longrun

    Does each custom post type go into a different cache folder?

    If you use a permalink structure like /yyyy/dd/postname/ you can probably have as many posts as you want but if you only use /postname/ then you’ll be limited to whatever your server’s filesystem can handle. That differs from operating system to operating system, and filesystem.

    ext2/ext3 on Linux can hold 32,000 files or directories in a directory. So you can have 31,998 posts cached. The other 2 files will be the cached copies of the front page, gzipped and not gzipped.

    I’m not sure about other filesystems.

    I blogged about this in the announcement post for the latest version of the plugin.



    So since I use /category/postname/ I should be fine, because I don’t have more than a couple thousand in any category?




    Great, thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WP Super Cache] Too many files causes problems’ is closed to new replies.