PHP Daemon marks Memcache as failed every few days

Iain Bapty ibapty+memcached at gmail.com
Wed May 23 09:23:12 UTC 2007


Apologies for the second E-mail.

Dug around a little more and found that 2 of the 4 class instances
which are being saved to the Memcache are around 1MB when the daemon
fails. The size of the remaining 2 class instances is negligible. It
looks very likely we are reaching the 'max bucket size' mentioned.

Unless anyone knows of anyway of changing the 'max bucket size', I'll
look to modify the class instances to store less data. I'll also
experiment with the ZLib compression to see if this resolves this
issue without adding too much of an overhead.

Any other suggestions would be very much appreciated.

Thanks,
Iain.

On 5/23/07, Iain Bapty <ibapty+memcached at gmail.com> wrote:
> Hi Nathan,
>
> I ran a test overnight to determine the string length at the point of failure.
>
> Updating Graph Data
> str len = 2044967
>
> Notice: Memcache::set(): marked server 'localhost:11211' as failed in
> D:\AJAX3\daemon.php on line 62
>
> Note that, in my original E-mail, I slightly simplified what is
> actually saved every 5 seconds. There is actually 4 different class
> instances which I'm saving on each loop. The 2044967 figure is the
> string length of all 4 instances in serialized form.
>
> Thanks for your help,
>
> Iain.
>
> On 5/22/07, Nathan Schmidt <nathan at pbwiki.com> wrote:
> > Are you setting data which is 'around 1 Mb' when serialized? You
> > might be going over the 'max bucket size' every now and then. I've
> > seen that happen when using otherwise reasonable defaults in php --
> > client libs essentially go dark for the remainder of their lives when
> > they get a NOT_STORED or SERVER_ERROR message. It's bad for web
> > clients but awful with a long-running command line program.
> >
> > What is strlen(serialize($oGraph)) ?
> >
> > -n
> >
> > On May 22, 2007, at 2:01 AM, Iain Bapty wrote:
> >
> > > Dear All,
> > >
> > > I've developed a PHP Daemon application which retrieves data from a
> > > web service every 5 seconds and saves the data using Memcache. The
> > > application has been in development for a week with the daemon
> > > running solidly for nearly 7 days. Over those 7 days, the daemon
> > > has terminated a few times due to a loss of connectivity to the
> > > Memcache.
> > >
> > > Notice: Memcache::set(): marked server 'localhost:11211' as failed
> > > in D:\AJAX3\daemon.php on line 44
> > >
> > > The following line is used to add data to the Memcache.
> > >
> > > $memcache->set('Graph', $oGraph, false, 10)
> > >
> > > Note that the 5-second loop does not reconnect to Memcache on each
> > > iteration. An initial connection is made when the daemon is started
> > > and this connection is reused for each loop. Would it be better to
> > > reconnect to Memcache every 5 seconds?
> > >
> > > The Memcached is running as a Windows service and there isn't
> > > anything in the Windows Event Viewer to suggest that the daemon has
> > > terminated.
> > >
> > > The error handling in the daemon is currently being revised so it
> > > will gracefully handle this situation and reconnect to the
> > > Memcache. However, I am planning on relying on the Memcache so any
> > > comments on how to debug this issue would be very much appreciated.
> > >
> > > I'm running:
> > >
> > > PHP 5.2.1
> > > Memcache extension taken from http://pecl4win.php.net/ext.php/
> > > php_memcache.dll
> > > Memcached 1.2.1 ( http://jehiah.cz/projects/memcached-win32/)
> > > Running on Windows XP
> > >
> > > Thanks,
> > > Iain
> >
> >
>


More information about the memcached mailing list