php and values not returning from memcached

Brad Fitzpatrick brad@danga.com
Wed, 2 Jun 2004 12:48:05 -0700 (PDT)


New items push old items out, unless you use the command line option to
override that.  Try pasting to us the results of "stats slabs" so we can
see how much memory is actually being used, and how.

flush_all won't make the results of "stats" change.  It just sets an
internal time that items have to be newer than to be returned with "get"
or "get_multi".  So they'll be flushed lazily when they're gotten later.

- Brad


On Wed, 2 Jun 2004 sjohnsonlist@feedster.com wrote:

> Hi all,
>
> Note: 1st post here so please excuse obvious stupidity but I did read
> through the api docs and server docs w/o seeing anything.
>
> I'm running memcached across 3 servers on gentoo linux, kernel 2.6.5
> environment (400 megs ram, 100 megs ram, 300 megs ram).
>
> What I'm doing is writing a cache loader to pre-populate a cache of data
> pulled from a mysql table.  And what I'm finding is that caching a large
> number of items is leaving a handful without values.
>
> My code is using the php API from this:
> http://www.danga.com/memcached/dist/php-memcached-1.0.10.tar.gz
>
> Basically all I do is loop over my database and call $memc->set($key,
> $value, $expire) and then kill the job if $memc returns false.  It never
> dies so memcache seems to be accepting all my objects fine.  That works
> fine and here's my internal diagnostics at the end of the job:
>
> Total size = 10795847 (this is the sum of the string lengths I loaded)
> 22734 total objects loaded (this is the total # of keys I sent to memcache)
>
> Now when I go to retrieve the content, I get this result:
>
> Key=|raw_content_47519384|
> err=No value found for key raw_content_47519384
>
> But I know this was set correctly or my code would have died (and my logs
> show it was set correctly).  My guess is that objects are being expired
> from the cache as new objects come in but I am setting a 5 day expiration
> time as measured by a time() + (5*86400) value. And this doesn't seem to
> be enough data to overflow a cache of this size.
>
> Here are my stats from the server:
> stats
> STAT pid 25901
> STAT uptime 503
> STAT time 1086201062
> STAT version 1.1.9
> STAT rusage_user 0:118981
> STAT rusage_system 0:190970
> STAT curr_items 4395
> STAT total_items 4395
> STAT bytes 2498844
> STAT curr_connections 1
> STAT total_connections 5094
> STAT connection_structures 4
> STAT cmd_get 697
> STAT cmd_set 4395
> STAT get_hits 498
> STAT get_misses 199
> STAT bytes_read 2454699
> STAT bytes_written 338016
> STAT limit_maxbytes 524288000
> END
> flush_all
> ERROR
>
> Interestingly I'm finding that the flush_all command isn't working.  That
> feeds very, very wrong.
>
> Comments ?  Thanks in advance.
>
> Scott
>
>
>
>
>
>