php and values not returning from memcached
Gregory Whalin
gwhalin@meetup.com
Wed, 2 Jun 2004 15:42:39 -0400 (EDT)
I was under the impression that flush_all merely marked the records as
being available to delete. Meaning, the memory is not actually cleared,
but if you request a key after a flush_all, you will get nothing back. I
could be wrong about this?
On Wed, 2 Jun 2004 sjohnsonlist@feedster.com wrote:
> Hi Richard,
>
> I've had the same results with 1 or 3 and with many different settings of
> available memory. There are other processes that are contributing to
> memcache so that explains the difference in the total #s but none are
> using a key style like this (I grepped the source code to make sure).
>
> The flush_all failing is bothersome since that's supposed to be an
> absolute thing at least according to Brad's docs.
>
> Scott
>
> > Scott,
> >
> > Have you tried working with just one memcached server? The stats you show
> > look good (total_items = cmd_set), but don't match the number of items you
> > put in the cache.
> >
> > toast
> >
> > 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
> >>
> >>
> >>
> >>
> >>
> >>
> >
>