1

我有很多 10 字节的键和 int 值。使用默认设置的 Memcached 对一条记录使用 90 个字节。我想太多了。我做了这个测试。

# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="4096"
CACHESIZE="256"
OPTIONS="-l 127.0.0.1 -n 1 -f 1.1"

# service memcached restart

# telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set k1 0 360 1
3
STORED
quit
Connection closed by foreign host.

# memcached-tool 127.0.0.1 display

  #  Item_Size  Max_age   Pages   Count   Full?  Evicted Evict_Time OOM
  3      72B         4s       1       1     yes        0        0    0

# memcached -vv -unobody -n 1 -f 1.1
slab class   1: chunk size        56 perslab   18724
slab class   2: chunk size        64 perslab   16384
slab class   3: chunk size        72 perslab   14563
slab class   4: chunk size        80 perslab   13107
slab class   5: chunk size        88 perslab   11915
slab class   6: chunk size        96 perslab   10922
slab class   7: chunk size       112 perslab    9362
slab class   8: chunk size       128 perslab    8192

为什么项目大小是 72B ?为什么这么贪心?

4

0 回答 0