your mail (fwd)

Ryan Gilfether ryan@gilfether.com
Sat, 26 Jul 2003 03:27:58 -0400


I appologize for the warnings in the PHP api for MemCached. They have 
been taken care of. They dont affect the API other than the annoying 
warnings it prints to the screen.

After correcting the warnings in PHP I tested the API with a file 
roughly 400k of ascii data and it stored and retreived the data from the 
MemCache with no problems using the same code provided in the email. I 
don't know the format of the file in question, but it really shouldn't 
make a difference.

Either way, I've sent the revised MemCachedClient.inc.php file to Brad 
Fitzpatrick so it can be included in the MemCached distribution.

-- 
Ryan Gilfether
Software Engineer
http://www.gilfether.com


Brad Fitzpatrick wrote:
> Bad stuff belongs on the list as much as good stuff.
> 
> As for PHP warnings:  perhaps the PHP client maintainer can submit a fix,
> or somebody who knows PHP... I'm rusty.
> 
> About the Storable error:  you can't mix and match use of Perl and PHP
> when it comes to frozen structures.  Perl's storable isn't compatible with
> PHP's.  If this is a requirement for your app, freeze/thaw on both sides
> with YAML or XML, which work on both.  We used Storable for speed and
> memory efficiency.
> 
> No C library?  Make one and we'll maintain it.  The protocol isn't
> changing, and is now documented in CVS under doc/.
> 
> Other than the PHP warnings and perl/php binary structure mismatch, did
> you find any real bugs?
> 
> - Brad
> 
> 
> On Fri, 25 Jul 2003 akasindorf@mail.communityconnect.com wrote:
> 
> 
>>Hey,
>>
>>I don't think I really want this going on the mailing list, as it's not
>>too 'friendly' ... can you get him going in the right direction at all? I
>>have blind fear of them attempting to use MySQL again. Ideas of what's
>>actually wrong here? Some of the stuff he brings up looks legit. I'll be
>>poking at it myself, but I have a big lack of time as I'm supposed to be
>>building the servers this particular project is running on...
>>
>>-Alan
>>
>>
>>>Here are some of my notes and attached files.  Unfortunately I did a lot
>>>of messing around before I started taking notes.  What follows is that I
>>>was able to eventually reproduce.  I completely admint that I would be
>>>using the software incorrectly...the lack of documentation didn't help
>>>make things easier and the documentation that does exist is wrong in
>>>various places.  All in all I think we can use memcached and I'm fairly
>>>certain it will hold up just fine.  The application code scares the crap
>>>at me and I'm not sure how I feel about including in our API and API that,
>>>1 we didn't write and 2 we know is buggy.  The lack of a C API bothers me
>>>as well.  I think for HitCounter (given the contraints we're under
>>>time-wise) I might either use Dan's in memory structures or just use the
>>>RAM disk based caching we've done in the past.
>>>
>>>The PHP unnecessarily raises warnings, see below:
>>>
>>>test_put.php:
>>>[25-Jul-2003 15:59:10] PHP Notice:  Undefined variable:  host_dead in
>>>/usr/src/m
>>>emcached-1.1.6/api/php/MemCachedClient.inc.php on line 211
>>>[25-Jul-2003 15:59:10] PHP Notice:  Undefined variable:  host_dead in
>>>/usr/src/m
>>>emcached-1.1.6/api/php/MemCachedClient.inc.php on line 212
>>>
>>>test_get.php:
>>>[25-Jul-2003 15:59:30] PHP Notice:  Undefined variable:  host_dead in
>>>/usr/src/m
>>>emcached-1.1.6/api/php/MemCachedClient.inc.php on line 211
>>>[25-Jul-2003 15:59:30] PHP Notice:  Undefined variable:  host_dead in
>>>/usr/src/m
>>>emcached-1.1.6/api/php/MemCachedClient.inc.php on line 212
>>>[25-Jul-2003 15:59:30] PHP Notice:  Undefined variable:  sock_keys in
>>>/usr/src/m
>>>emcached-1.1.6/api/php/MemCachedClient.inc.php on line 154
>>>[25-Jul-2003 15:59:30] PHP Notice:  Undefined offset:  1 in
>>>/usr/src/memcached-1
>>>.1.6/api/php/MemCachedClient.inc.php on line 157
>>>[25-Jul-2003 15:59:30] PHP Notice:  Undefined variable:  socks in
>>>/usr/src/memca
>>>ched-1.1.6/api/php/MemCachedClient.inc.php on line 160
>>>
>>>Using test_put.php I can add the file.dat file to memcached.  However,
>>>test_get.php fails. PHP is silent...just reports no data.  But Perl spits
>>>up this:
>>>
>>>Storable binary image v57.58 more recent than I am (v1.0) at
>>>blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line
>>
>>238,
>>
>>><GEN0> line 31, at a pi/perl/MemCachedClient.pm line 222
>>>
>>>At first glance it might appear that something is wrong with the Perl
>>>versions of software.  I did a Google search and found this:
>>>
>>>http://archive.develooper.com/perl5-porters@perl.org/msg97244.html
>>>
>>>The problem is actually with the code.  I suspect the problem with
>>>test_get.p* is that the APIs don't handle binary data well at all.  If I
>>>base 64 encode the same file, it works fine.
>>>
>>>I'm too lazy to find the bugs in the code....but the problem is
>>>reproducible here.
>>>
>>>The example code in the MemCachedClient.pm makes these references:
>>> use MemCached;
>>> $memc = new MemCached {
>>>These are clearly wrong as the file is called MemCachedClient and the
>>>package MemCachedClient.
>>>
>>>
>>>--
>>>Michael C. Montero
>>>Chief Technology Officer
>>>Community Connect Inc. Co-founder
>>>-=-=-=-=-= Community Connect Inc.
>>
>>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>
>>>The Premier Source of Interactive Online Communities 149 Fifth Avenue
>>>http://www.CommunityConnectInc.com/ New York, NY 10010
>>>
>>>http://www.AsianAvenue.com/ http://www.BlackPlanet.com/
>>>Click into Asian America The World Is Yours
>>>
>>>http://www.MiGente.com/ http://www.DiversityJobMarket.com/
>>>The Power of Latinos In partnership with The New
>>>York Times
>>>
>>>----- Your Message May Appear Below This Line
>>>
>>>
>>>
>>>#!/usr/bin/perl
>>>
>>>use lib "./api/perl" ;
>>>use MemCachedClient ;
>>>
>>> $memc = new MemCachedClient {
>>>   'servers' => [ "192.168.101.24:11211" ],
>>>   'debug' => 0,
>>> };
>>> $memc->set_servers($array_ref);
>>>
>>> $val = $memc->get("key");
>>> if ($val) { print $val->{'complex'}->[2]; }
>>>
>>>
>>>
>>>#!/usr/bin/php -q
>>><?
>>>	include_once( "./api/php/MemCachedClient.inc.php" ) ;
>>>
>>>	$memc_options[ "servers" ] =
>>>		array( "192.168.101.24:11211" ) ;
>>>	$memc_options[ "debug" ]   =
>>>		false ;
>>>
>>>	$memc_handle = new MemCachedClient( $memc_options ) ;
>>>
>>>	$fp = fopen( "./file.dat", "r" ) ;
>>>	if ( !$fp )
>>>	{
>>>		print "Could not open ./file.dat!\n" ;
>>>		exit ;
>>>	}
>>>
>>>	$data = fread( $fp, filesize( "./file.dat" ) ) ;
>>>	fclose( $fp ) ;
>>>
>>>	print "Data length is " . strlen( $data ) . "\n" ;
>>>
>>>	$memc_handle->set( "key", $data ) ;
>>>?>
>>>
>>>
>>>
>>>#!/usr/bin/php -q
>>><?
>>>	include_once( "./api/php/MemCachedClient.inc.php" ) ;
>>>
>>>	$memc_options[ "servers" ] =
>>>		array( "192.168.101.24:11211" ) ;
>>>	$memc_options[ "debug" ]   =
>>>		false ;
>>>
>>>	$memc_handle = new MemCachedClient( $memc_options ) ;
>>>
>>>	$data = $memc_handle->get( "key" ) ;
>>>
>>>	print "Data length is " . strlen( $data ) . "\n" ;
>>>?>
>>>
>>
>>
>>
>>
> 
>