Hi all.  I need some guidance on implementing a PHP cache engine in a
"multi-tenant" environment.  I've done some research on the open-source
cache engines available--specifically, APC, XCache, and
eAccelerator--but I haven't found anything that speaks to my use case.
Hopefully someone will be able to point me in the right direction.


Here's the basic use case:  I've got multiple instances of one PHP
application running on a single server.  This is accomplished in a
fairly straightforward manner:  We just create multiple copies of the
application on the filesystem.  It looks something like this:

/var/www/html/abc
/var/www/html/def
/var/www/html/ghi

Etc.


Each of the directories above ('abc', 'def', and 'ghi') contains a
complete copy of the PHP applicationwith slight variations based on
customer need.  Examples of these differences are LDAP parameters,
layout customizations, field names, etc.  Note that these variations
often occur in the PHP code, i.e. there will be multiple occurrences of
file "ldap.php" 


This works without incident but due to increasing adoption, performance
has become an issue.  In an attempt to improve performance, I
implemented APC.  This resulted in a significant performance gain, but
after several days we noticed intermittent problems that clearly
indicated one instance's code was being "leaked" to another instance.
As a specific example, we began seeing one customner's layout changes in
another instance.  These were quite obvious in that a field bearing the
wrong company name suddenly appeared.


After ruling out obvious filesystem mistakes I was forced to conclude
that the cache engine was serving the "wrong" version of a file.  I
enclose that in quotes because APC may technically doing the right
thing; given multiple copies of the same source file--as would
frequently occur in our environment--it cached the latest one and served
it up as requested.  However, this behavior is not compatible with our
hosting approach.


My question then becomes the following:  Is there a cache engine
available which can store multiple (different) copies of a source file
and serve them only to the appropriate request?  Perhaps a better way to
describe this would be a sort of "mapping" feature allowing
per-directory control.  I'm imagining a simple list of directories that
instructs the cache engine to keep their caches separate.  This might
even be implemented by incorporating the directory name into the key
used for lookups, but frankly I haven't spent much time looking at APC's
code (nor have I looked at XCache's or eAccelerator's at all.)


Thanks in advance for any guidance.



Regards,

Damon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to