php and values not returning from memcached

Brad Fitzpatrick brad@danga.com
Wed, 2 Jun 2004 22:24:25 -0700 (PDT)


Yeah, I can't remember the differences between 1.1.9 and the current
release.

But it looks like the two slab stats below are fine... you're not using
much memory at all.  I'd be interested in seeing your test case to see
what items aren't being inserted/retrieved.


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

> Hi Brad,
>
> stats slabs
> STAT 6:chunk_size 64
> STAT 6:chunks_per_page 16384
> STAT 6:total_pages 1
> STAT 6:total_chunks 16384
> STAT 6:used_chunks 16383
> STAT 6:free_chunks 1
> STAT 6:free_chunks_end 15648
> STAT 7:chunk_size 128
> STAT 7:chunks_per_page 8192
> STAT 7:total_pages 1
> STAT 7:total_chunks 8192
> STAT 7:used_chunks 8192
> STAT 7:free_chunks 0
> STAT 7:free_chunks_end 7211
> STAT 8:chunk_size 256
> STAT 8:chunks_per_page 4096
> STAT 8:total_pages 1
> STAT 8:total_chunks 4096
> STAT 8:used_chunks 4096
> STAT 8:free_chunks 0
> STAT 8:free_chunks_end 3204
> STAT 9:chunk_size 512
> STAT 9:chunks_per_page 2048
> STAT 9:total_pages 1
> STAT 9:total_chunks 2048
> STAT 9:used_chunks 2048
> STAT 9:free_chunks 0
> STAT 9:free_chunks_end 1092
> STAT 10:chunk_size 1024
> STAT 10:chunks_per_page 1024
> STAT 10:total_pages 1
> STAT 10:total_chunks 1024
> STAT 10:used_chunks 1024
> STAT 10:free_chunks 0
> STAT 10:free_chunks_end 60
> STAT 11:chunk_size 2048
> STAT 11:chunks_per_page 512
> STAT 11:total_pages 1
> STAT 11:total_chunks 512
> STAT 11:used_chunks 512
> STAT 11:free_chunks 0
> STAT 11:free_chunks_end 210
> STAT 12:chunk_size 4096
> STAT 12:chunks_per_page 256
> STAT 12:total_pages 1
> STAT 12:total_chunks 256
> STAT 12:used_chunks 256
> STAT 12:free_chunks 0
> STAT 12:free_chunks_end 73
> STAT 13:chunk_size 8192
> STAT 13:chunks_per_page 128
> STAT 13:total_pages 1
> STAT 13:total_chunks 128
> STAT 13:used_chunks 128
> STAT 13:free_chunks 0
> STAT 13:free_chunks_end 57
> STAT 14:chunk_size 16384
> STAT 14:chunks_per_page 64
> STAT 14:total_pages 1
> STAT 14:total_chunks 64
> STAT 14:used_chunks 64
> STAT 14:free_chunks 0
> STAT 14:free_chunks_end 51
> STAT 15:chunk_size 32768
> STAT 15:chunks_per_page 32
> STAT 15:total_pages 1
> STAT 15:total_chunks 32
> STAT 15:used_chunks 32
> STAT 15:free_chunks 0
> STAT 15:free_chunks_end 29
> STAT 16:chunk_size 65536
> STAT 16:chunks_per_page 16
> STAT 16:total_pages 1
> STAT 16:total_chunks 16
> STAT 16:used_chunks 16
> STAT 16:free_chunks 0
> STAT 16:free_chunks_end 15
> STAT 17:chunk_size 131072
> STAT 17:chunks_per_page 8
> STAT 17:total_pages 1
> STAT 17:total_chunks 8
> STAT 17:used_chunks 8
> STAT 17:free_chunks 0
> STAT 17:free_chunks_end 7
> STAT active_slabs 12
> STAT total_malloced 12582912
>
> That's from one of my servers and here's from the other one heavily in use:
>
> stats slabs
> STAT 6:chunk_size 64
> STAT 6:chunks_per_page 16384
> STAT 6:total_pages 1
> STAT 6:total_chunks 16384
> STAT 6:used_chunks 16383
> STAT 6:free_chunks 1
> STAT 6:free_chunks_end 15751
> STAT 7:chunk_size 128
> STAT 7:chunks_per_page 8192
> STAT 7:total_pages 1
> STAT 7:total_chunks 8192
> STAT 7:used_chunks 8191
> STAT 7:free_chunks 1
> STAT 7:free_chunks_end 7167
> STAT 8:chunk_size 256
> STAT 8:chunks_per_page 4096
> STAT 8:total_pages 1
> STAT 8:total_chunks 4096
> STAT 8:used_chunks 4096
> STAT 8:free_chunks 0
> STAT 8:free_chunks_end 3265
> STAT 9:chunk_size 512
> STAT 9:chunks_per_page 2048
> STAT 9:total_pages 1
> STAT 9:total_chunks 2048
> STAT 9:used_chunks 2047
> STAT 9:free_chunks 1
> STAT 9:free_chunks_end 1131
> STAT 10:chunk_size 1024
> STAT 10:chunks_per_page 1024
> STAT 10:total_pages 1
> STAT 10:total_chunks 1024
> STAT 10:used_chunks 1023
> STAT 10:free_chunks 1
> STAT 10:free_chunks_end 641
> STAT 11:chunk_size 2048
> STAT 11:chunks_per_page 512
> STAT 11:total_pages 1
> STAT 11:total_chunks 512
> STAT 11:used_chunks 511
> STAT 11:free_chunks 1
> STAT 11:free_chunks_end 224
> STAT 12:chunk_size 4096
> STAT 12:chunks_per_page 256
> STAT 12:total_pages 1
> STAT 12:total_chunks 256
> STAT 12:used_chunks 256
> STAT 12:free_chunks 0
> STAT 12:free_chunks_end 106
> STAT 13:chunk_size 8192
> STAT 13:chunks_per_page 128
> STAT 13:total_pages 1
> STAT 13:total_chunks 128
> STAT 13:used_chunks 127
> STAT 13:free_chunks 1
> STAT 13:free_chunks_end 72
> STAT 14:chunk_size 16384
> STAT 14:chunks_per_page 64
> STAT 14:total_pages 1
> STAT 14:total_chunks 64
> STAT 14:used_chunks 63
> STAT 14:free_chunks 1
> STAT 14:free_chunks_end 42
> STAT 15:chunk_size 32768
> STAT 15:chunks_per_page 32
> STAT 15:total_pages 1
> STAT 15:total_chunks 32
> STAT 15:used_chunks 31
> STAT 15:free_chunks 1
> STAT 15:free_chunks_end 24
> STAT active_slabs 10
> STAT total_malloced 10485760
>
>
> Oh and it is memcached 1.1.9.  That's the standard one emerged by gentoo
> and I'm starting to wonder if this is version hell now that I see I'm
> dated back to 2003.  Time for an upgrade ...
>
> Scott
>
> > 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
> >>
> >>
> >>
> >>
> >>
> >>
> >
>
>