Summary | Enhancements for memcache session driver |
Queue | Horde Framework Packages |
Queue Version | HEAD |
Type | Enhancement |
State | Resolved |
Priority | 1. Low |
Owners | |
Requester | kevin_myer (at) iu13 (dot) org |
Created | 10/14/2005 (7285 days ago) |
Due | |
Updated | 10/17/2005 (7282 days ago) |
Assigned | |
Resolved | 10/17/2005 (7282 days ago) |
Milestone | |
Patch | No |
State ⇒ Resolved
New Attachment: memcached.php.patch
- the operators in _getConForId() need some more horizontel whitespace
webpage had a fixed font specified, as it's somewhat difficult to
pickup the spacing from there. I know I could look the same doc up in
a terminal window but a Courier font would help the webpage.
memcached extension. The OO interface doesn't gain us anything here
is probably not available in older versions of the extension.
$foo=$bar->getConId($id)->get($id) but that didn't work under PHP 4,
so I had partially backed it out but its not much of a difference to
use the functional interface, and maybe easier to read.
I think this will be the extent of how far this particular session
handler, using the PECL memcache extension can really go. With
libmemcache and the php-mcache, more robust configurations with easier
failover are possible, but since the base PECL memcache functions
don't support multiple servers, I think a different driver based on a
different memcache library would be better. The downside to that is
an additional dependency but anyone who needs that kind of reliability
has probably already worked out something in-house anyway. But it
would be nice to get something into public code, so us smaller players
don't have as much to maintain locally.
Summary of enhancements over original driver:
Ability to specify more than one server (but no automatic failover of
data for downed servers)
Ability to specify persistent connections
Ability to specify compression of data
- the operators in _getConForId() need some more horizontel whitespace
- I personally would prefer to use the functional interface to the
memcached extension. The OO interface doesn't gain us anything here is
probably not available in older versions of the extension.
New Attachment: memcached.php[1].patch
standards (at least better than the first one). Minor code
adjustments to the first patch - removed extra persistent check in the
close function and took the connect/pconnect logic outside the loop
for the _connect function.
This seems to work on OpenBSD 3.7, with Apache/1.3.29 (Unix)
PHP/5.0.4, although something is causing Apache to segfault.
Because of the way RHEL 4 handles malloc/free calls that fail, this
code doesn't work on RHEL 4, as glibc throws an exception.
So can someone spot what I'm doing wrong? Or am I running into a bug
in the PECL memcache extension?
horizontal whitespace, curly braces placement, etc. Can you update
your patch accordingly?
the changes and it was not a good idea at all... So back to vi..
State ⇒ Feedback
But there are a bunch of coding style issues, like indenting,
horizontal whitespace, curly braces placement, etc. Can you update
your patch accordingly?
New Attachment: horde-conf.xml.patch
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Enhancements for memcache session driver
Queue ⇒ Horde Framework Packages
New Attachment: memcached.php.patch
State ⇒ New
the memcache driver.
Enhancements:
Support for persistent connections
($conf['sessionhandler']['params']['persistent']
Support for compression ($conf['sessionhandler']['params']['compression']
Support for multiple servers, comma separated 'hostspec' and 'port'
values (is there a cleaner way to do this??)
Sessions are hashed to determine what server they should be stored on
and all read/write/delete functions are passed through this function
to get the proper connection.
The ideas for this are synthesized from the various generic and
session-specific memcache implementations in APIs I've found. The
hash function to determine the server to write the session to is
supposed to distribute the values the most evenly and be the higher
performance function for those available.
TODO:
Test extensively (works for me, with one bogus server in my config,
representing a down server, and one real server, but the usual no
warranty implied, don't use in healthcare settings, etc. applies)
Add support for down server detection, with a timer to repoll down
servers to see if they've come back. $_connected should probably be
an array which maintains up/down state for each potential connection.
Add support for session enumeration (with memcached, 'stats items'
yields a list of the buckets, 'stats cachedump bucket#' would yield
the sessionid, both of which I think can be mapped to PHP memcache
stat functions, or a stat function can be written that returns a list
of sessionids)
Add a prefix to the sessionid so multiple sites sessions can be stored
in the same set of memcached servers, but can be enumerated by each
separate site
Better error handling and logging