The MU forums have moved to WordPress.org

can someone explain the caching concept, please (9 posts)

  1. Ovidiu
    Member
    Posted 18 years ago #

    ok, I know there are severall caches, I heard about the object cache, about wp-cahce plugin and about caching that is being done by php optimizers like eaccelerator.

    can someone explain how all these caches work together? which one is the first to cache?

  2. Fryer
    Member
    Posted 18 years ago #

    I don't think you can run more then one. I tried running zend optimizer and eaccelerator, but it didn't allow me to use both. I personally am satisfied with just zend optimizer. I tried eaccelerator for awhile but it kept crashing apache for some reason, so then I ended up sticking with zend. Zend optimizer is the most common one used and it is free as well. It has made a big improvement in all my php based websites as far as speed and smoothness goes.

    Fryer

  3. Ovidiu
    Member
    Posted 18 years ago #

    I am happily using zendoptimizer, but I would like to know more how it interacts with the wordpress caches...

    what exactly the object cacahe is and where wp-cache (plugin) jumps into all of this :-)

  4. Ovidiu
    Member
    Posted 18 years ago #

    anyway, the way I understood it, wp-cache seems to cache "static pages" and serve them, so it cuts down the number of DB queries, while wpmu caches DB-queries, right?

    can someone explain all these to me please?

  5. quenting
    Member
    Posted 18 years ago #

    3 levels of cache:

    1) wp-cache -> stores the output of pages to static html files, and serves them if no changes were made to the backend.
    2) php cache (zend, ea, apc) -> stores compiled version of .php files so that they don't have to be parsed every time a script is run.
    3) query cache (mysql) -> mysql stores in memory the result sets for the most frequent sql queries (or all queries if it has enough space). If a sql query is run and the result set is cached, the cache is served instead of having to execute the query again and fetch the data from the disk.

    I'd say 2) and 3) are easy to implement, and quite beneficial, and i don't see any reason not to implement them. 1) can be somewhat beneficial too, but more particularly if you have few blogs that are visited a lot as opposed to many blogs each receiving few visits. 1) is the one that needs the more care, especcially because the conditions that make a flush of a file from the cache needed are not always easy to see and because any side operation you make needs to adapat to the cache system. By this I mean, for instance if you have batch jobs running against your DB, you need to make them flush the appropriate caches if needed.

    I'm not too sure about wpmu cache. I thought it was the same as wp-cache.

  6. lunabyte
    Member
    Posted 18 years ago #

    I also gave eaccelerator a spin here a few months ago. I had mixed results with it. Overall it did help the particular box, but I was finding the need to restart Apache every 36-48 hours or so, or some pages on some sites would quit rendering and in turn just try to force the browser to download a blank php file.

    While it doesn't take much to rekick apache, it seemed more of a hassle than it was worth. It may have been to OS or something that eaccelerator didn't like, but whatever it was I didn't have the time to really hunt it down.

  7. quenting
    Member
    Posted 18 years ago #

    I had personnally many problems with EA, which choked on a file ( kses.php ), causing apache processes to hang and return blank pages as you mention. I installed APC, which also choked on the same file, but which unlike EA has the option to exclude it from the cache by a simple line in the configuration. I'm not sure about zend.
    PHP caching gives me a 10-15% decrease in the load, which is nice on a busy system.

  8. Ovidiu
    Member
    Posted 18 years ago #

    @ quentin

    so how do your 3 types of caching relate to this object caching? which one is that?

    would enabling the object cache, then implementing wp-cache and (already using eaccelerator) make sense?

    or is that too much caching involved there?
    also mysql already has its own settings regarding cache, I'll leave those aside for now.

  9. quenting
    Member
    Posted 18 years ago #

    I'm not sure what's the difference between wp-cache and wpmu's embedded cache, if there's any. I've actually asked in another thread on the topic, and i'd need to look through the code more toroughly to understand it properly.
    2 caches at the script level (wp-cache and wpmu cache) is probably redundant. One would have to understand the difference and see which is the most efficient / has the less constraints and pick one.
    Using ea and mysql cache is independant and shouldn't impact the choice at the script level. Also depending on your number of blogs, settings and the box your db runs on, you might actually want to tweak the mysql cache settings.

About this Topic