使用 memdump 转储密钥时,"one page per slab class" 限制意味着什么?
What does the "one page per slab class" limitation mean when dumping keys with memdump?
出于调试目的,我想计算我们的内存缓存服务器中的键数,所以我做了一些研究并最终使用了 memdump
实用程序,它似乎与 libmemcached 一起提供。
在命令的描述中说:
memdump dumps a list of “keys” from all servers that it is told to fetch from. Because memcached does not guarentee to provide all keys it is not possible to get a complete “dump”.
也在另一个网站上 (Memcached Cheat Sheet) 我读到:
[…] The memcache protocol provides commands to peek into the data that is organized by slabs (categories of data of a given size range). There are some significant limitations though:
You can only dump keys per slab class (keys with roughly the same content size)
You can only dump one page per slab class (1MB of data)
This is an unofficial feature that might be removed anytime.
[…]
那么 You can only dump one page per slab class (1MB of data)
在实践中意味着什么?一兆字节的数据是什么?如果一个 slab 包含超过 1 MB 的数据(包括键?)那么剩余的数据将不会被提取并且我可能会遗漏一些键?
举个例子,我有 3 个键 A,有 500 KB 的数据,B 有另外 600 KB 的数据,C 有 300 KB 的数据,它们都在同一个平板上。那么在转储密钥时,只有A和B会随数据一起转储(然后可能也会被切断?)
memdump
实用程序使用内存缓存协议未记录的命令 stats cachedump
通过 slab id 获取键列表。您可以在 memcached 源代码中查看 stats cachedump <slabs_id> <limit>
实现 items.c:
char *item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes) {
unsigned int memlimit = 2 * 1024 * 1024; /* 2MB max response size */
while (it != NULL && (limit == 0 || shown < limit)) {
// ... key copying occurs here
if (bufcurr + len + 6 > memlimit) /* 6 is END\r\n[=10=] */
break;
// ...
}
因此,如果不重新编译 memcached,就不可能在给定的每个 slab 中获得超过 2 Mb 的密钥。值不会复制到响应缓冲区,响应大小限制仅适用于键。
出于调试目的,我想计算我们的内存缓存服务器中的键数,所以我做了一些研究并最终使用了 memdump
实用程序,它似乎与 libmemcached 一起提供。
在命令的描述中说:
memdump dumps a list of “keys” from all servers that it is told to fetch from. Because memcached does not guarentee to provide all keys it is not possible to get a complete “dump”.
也在另一个网站上 (Memcached Cheat Sheet) 我读到:
[…] The memcache protocol provides commands to peek into the data that is organized by slabs (categories of data of a given size range). There are some significant limitations though:
You can only dump keys per slab class (keys with roughly the same content size)
You can only dump one page per slab class (1MB of data)
This is an unofficial feature that might be removed anytime.
[…]
那么 You can only dump one page per slab class (1MB of data)
在实践中意味着什么?一兆字节的数据是什么?如果一个 slab 包含超过 1 MB 的数据(包括键?)那么剩余的数据将不会被提取并且我可能会遗漏一些键?
举个例子,我有 3 个键 A,有 500 KB 的数据,B 有另外 600 KB 的数据,C 有 300 KB 的数据,它们都在同一个平板上。那么在转储密钥时,只有A和B会随数据一起转储(然后可能也会被切断?)
memdump
实用程序使用内存缓存协议未记录的命令 stats cachedump
通过 slab id 获取键列表。您可以在 memcached 源代码中查看 stats cachedump <slabs_id> <limit>
实现 items.c:
char *item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes) {
unsigned int memlimit = 2 * 1024 * 1024; /* 2MB max response size */
while (it != NULL && (limit == 0 || shown < limit)) {
// ... key copying occurs here
if (bufcurr + len + 6 > memlimit) /* 6 is END\r\n[=10=] */
break;
// ...
}
因此,如果不重新编译 memcached,就不可能在给定的每个 slab 中获得超过 2 Mb 的密钥。值不会复制到响应缓冲区,响应大小限制仅适用于键。