?

Log in

No account? Create an account
entries friends calendar profile My Website Previous Previous Next Next
PHP accelerator cache that uses memcached? - Mark Atwood
fallenpegasus
fallenpegasus
PHP accelerator cache that uses memcached?
Last year, when I was doing MySQL Professional Services, I encountered a client that was already using memcached. Something they said they were doing was they were caching the compiled bytecode of their PHP code in their memcached, which was a big win because they ran a large fleet of identical PHP based application servers. As soon as any one server encountered a given new piece of PHP, it would compile it and cache it, and immediately all the other app servers could use the same cached compiled bytecode, rather than repeat that work. They had recently changed to this approach, from caching the compiled bytecode on the disk of each app server.

I thought that was really neat, and kept digging elsewhere into their performance and scaling issues.

I had just assumed that this was some open source project, a modification or module to an existing PHP bytecode compiler / cacher / accelerator.

Except, it seems to not be. I've spend a couple of days now googling and reading up on the various "PHP accelerators", and they all appear to cache to disk or cache to local shared memory, but I can't find a reference anywhere to coupling one with memcached.

Am I just missing something, is my google-fu failing me, is this something this shop had written from scratch?

Do any of my readers know?

Tags: , ,
Current Location: Joe's Bar and Cafe, Capitol Hill, Seattle WA

2 comments or Leave a comment
Comments
mauser From: mauser Date: December 9th, 2009 07:31 pm (UTC) (Link)
Totally separate thing, but I'm starting to play with PHP again. I noticed something strange. I was writing something that put out a relative link e.g. /TestDir/Gallery.php , which is what it said in the code, but when I hovered over the link, FireFox was putting the host name in front of it (i.e. it prepended http://home.kendra.com ) The problem of course is that that action by Firefox left out two steps in the path, so the link would be bad. What is the fix? Customizing the code to add in a base path or some method of determining the path programmatically?

The other issues is that while the code walked the directory, the paths it pulled up for files were based on the server's file system, rather than the URL, which was very different. I'm sure it's basic stuff, which is why my google-fu is weak in this case too.
topbit From: topbit Date: December 9th, 2009 10:17 pm (UTC) (Link)
I've never heard of storing PHP byte-code into Memcache. I don't think that it would be a significant benefit anyhow. A good part of why APC (for example) can do so much for a PHP site is that it runs the code (and accesses the cached variables) right out of memory - no copying required. For such things as arrays, I don't believe it even serialises them, just stores and returns them as the native PHP format.

Reading them from a memcache cluster would almost certainly involve a network copy, but reading (from the OS filecache), and then parsing the original code might actually be quicker.
2 comments or Leave a comment