Jump to content

Cache Pro and Zend OPCache


Valery
 Share

Recommended Posts

Hello everyone,

I have a question to Ryan and the PW experts here: in the upcoming PHP release 5.5.0 we are going to see Zend OPCache, a caching mechanism similar to APC. How does it compare to Cache Pro? Will Cache Pro still be needed if OPCache is used?

Just a side note: I am buying CP as soon as my web project goes into production simply because I love PW and want to contribute. But will it decrease the page loading time any more than it will be possible with OPCache?

Thank you.
 

Link to comment
Share on other sites

I think it's the other way around - you might not need OPcache at all if you use ProCache :D

Multiple caching methods can't hurt though as it's highly unlikely there will be any conflict (like Martijn says ProCache is all about serving static versions of site pages with no PHP or database). OPcache could be useful if it offers any more compression on plain HTML and certainly on pages you might choose to keep out of ProCache like pages with dynamic elements etc.

Link to comment
Share on other sites

Thanks, Pete, Martijn.

What I believe OPCache does is:

1. When a PHP script is invoked, it checks if it has one in the pre-compiled form already.

2. If it does not, it runs the script through the PHP parser, sends the output (if any) back, and caches the PHP script as a binary in the shared memory.

3. If the invoked script already exists as a pre-compiled binary, OPCache calls it from the shared memory saving

a) the time to load the script file from disk;

b) the time needed to parse the script.

While ProCache (I misnamed it in my previous post) does the following (my understanding):

1. Keeps track of what PW pages have been previously called and caches them as static HTML files.

2. When a page is called, ProCache looks it up in the cache pile, and if the page is there, ProCache feeds it back to the user agent as static content.

3. If the cached page was modified, ProCache removes the static page for it. When the updated page is called again, ProCache repeats Step 1.

Basically, if you have a PW+ProCache website that does not get updated often, you are likely to end up with all of its pages served statically in some certain time.

When this happens, OPCache can still be useful because it will cache, well, ProCache itself.

Link to comment
Share on other sites

Valery I think your analysis is correct. An opcode cache and ProCache are very different animals, as you've identified. Ideally you have both. There really isn't any crossover between the two because an opcode cache only comes into play when PHP is active. ProCache bypasses PHP, making the request completely static (and thus a lot faster than one delivered via a PHP opcode cache). The apachebench results I posted in the ProCache thread were actually with APC enabled. While ProCache can technically make a bigger impact on front-end performance, ProcessWire is a PHP application and having an opcode cache is a good idea either way. I would guess that most of us are already running some kind of opcode cache whether we know it or not (usually APC, eAccelerator, etc.)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...