new memcached slab display/tuning tool
Brad Fitzpatrick
brad@danga.com
Fri, 16 Jul 2004 10:48:18 -0700 (PDT)
It's Friday, so here's something fun for y'all:
I finally wrote that script I talk about a lot to show and tune your slab
page usage in memcached.
There's no automatic mode yet, because I can't decide the heuristics to
use, but I'll let you smart people decide that for yourself, and send me
patches perhaps. :-)
First off, the script is both in cvs and at:
http://www.danga.com/memcached/dist/memcached-tool
Here's a demo of it in action on one of LiveJournal's memcached processes:
lj@grimace:~$ memcached-tool
Usage: memcached-tool <host[:port]> [mode]
memcached-tool 10.0.0.5:11211 display # shows slabs
memcached-tool 10.0.0.5:11211 # same. (default is display)
memcached-tool 10.0.0.5:11211 move 7 9 # takes 1MB slab from class #7
# to class #9.
You can only move slabs around once memory is totally allocated, and only
once the target class is full. (So you can't move from #6 to #9 and #7
to #9 at the same itme, since you'd have to wait for #9 to fill from
the first reassigned page)
lj@grimace:~$ memcached-tool 10.0.0.41:11211
# Item_Size Max_age 1MB_pages Full?
6 64 B 12869 s 82 yes
7 128 B 12446 s 74 yes
8 256 B 11069 s 91 yes
9 512 B 12184 s 54 yes
10 1 kB 12120 s 106 yes
11 2 kB 11498 s 181 yes
12 4 kB 10087 s 189 yes
13 8 kB 8322 s 124 yes
14 16 kB 7335 s 69 yes
15 32 kB 4591 s 31 yes
16 64 kB 3378 s 17 yes
17 128 kB 39944 s 6 yes
lj@grimace:~$ memcached-tool 10.0.0.41:11211 move 17 16
Success.
lj@grimace:~$ memcached-tool 10.0.0.41:11211 move 17 16
Error: can't move from 17 to 16. Destination not yet full? See usage docs.
lj@grimace:~$ memcached-tool 10.0.0.41:11211
# Item_Size Max_age 1MB_pages Full?
6 64 B 12687 s 82 yes
7 128 B 12338 s 74 yes
8 256 B 10968 s 91 yes
9 512 B 11950 s 54 yes
10 1 kB 11931 s 106 yes
11 2 kB 11421 s 181 yes
12 4 kB 9986 s 189 yes
13 8 kB 8356 s 124 yes
14 16 kB 7240 s 69 yes
15 32 kB 4584 s 31 yes
16 64 kB 3257 s 18 no
17 128 kB 40287 s 5 yes
Enjoy! Have a nice weekend!
- Brad