有哪些有用的提示/工具可用于监视/调整内存缓存的运行状况? [英] What are some useful tips/tools for monitoring/tuning memcached health?

查看:115
本文介绍了有哪些有用的提示/工具可用于监视/调整内存缓存的运行状况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我发现了这个很酷的脚本' memcache-top ',它很好地打印了memcached live的统计信息.看起来像

memcache-top v0.6       (default port: 11211, color: on, refresh: 3 seconds)

INSTANCE                USAGE   HIT %   CONN    TIME    EVICT/s READ/s  WRITE/s
127.0.0.1:11211         88.8%   94.8%   20      0.8ms   9.0     311.3K  162.8K

AVERAGE:                88.8%   94.8%   20      0.8ms   9.0     311.3K  162.8K

TOTAL:          1.8GB/  2.0GB           20      0.8ms   9.0     311.3K  162.8K
(ctrl-c to quit.)

当您应该注意某些内容时,它甚至会使某些文本变成红色!

问:大致来说,您使用哪些有用的工具/技术来检查memcached是否设置正确?

解决方案

访问Memcached服务器实例的良好界面是 phpMemCacheAdmin .

我更喜欢使用telnet从命令行进行访问.

要使用Telnet连接到Memcached,请在命令行中使用以下telnet localhost 11211命令.

如果您希望随时终止Telnet会话,只需键入quit并按回车即可.

连接后,通过运行stats命令,您可以概述Memcached服务器的重要统计信息.

内存在内部按块分配,并不断重复使用.由于内存分为不同大小的平板,因此如果您的商品不能完全适合服务器选择放入的平板,则会浪费内存.

因此Memcached会根据数据大小自动将数据分配到不同的"slab"内存中(将其视为分区),从而使内存分配更加优化.

要使用您要连接的实例列出平板,请使用stats slab命令.

更有用的命令是stats items,它将为您提供一个平板列表,其中包括每个平板中存储的项目的数量.

现在您知道如何列出平板,您可以使用stats cachedump [slab ID] [number of items, 0 for all items]命令浏览每个平板内部以列出其中包含的项目.

如果要获取该项目的实际值,可以使用get [key]命令.

要从缓存中删除项目,可以使用delete [key]命令.

Yesterday, I found this cool script 'memcache-top' which nicely prints out stats of memcached live. It looks like,

memcache-top v0.6       (default port: 11211, color: on, refresh: 3 seconds)

INSTANCE                USAGE   HIT %   CONN    TIME    EVICT/s READ/s  WRITE/s
127.0.0.1:11211         88.8%   94.8%   20      0.8ms   9.0     311.3K  162.8K

AVERAGE:                88.8%   94.8%   20      0.8ms   9.0     311.3K  162.8K

TOTAL:          1.8GB/  2.0GB           20      0.8ms   9.0     311.3K  162.8K
(ctrl-c to quit.)

it even makes certain text red when you should pay attention to something!

Q. Broadly, what are some useful tools/techniques you've used to check that memcached is set up well?

解决方案

Good interface to accessing Memcached server instances is phpMemCacheAdmin.

I prefer access from the command line using telnet.

To make a connection to Memcached using Telnet, use the following telnet localhost 11211 command from the command line.

If at any time you wish to terminate the Telnet session, simply type quit and hit return.

You can get an overview of the important statistics of your Memcached server by running the stats command once connected.

Memory is allocated in chunks internally and constantly reused. Since memory is broken into different size slabs, you do waste memory if your items do not fit perfectly into the slab the server chooses to put it in.

So Memcached allocates your data into different "slabs" (think of these as partitions) of memory automatically, based on the size of your data, which in turn makes memory allocation more optimal.

To list the slabs in the instance you are connected to, use the stats slab command.

A more useful command is the stats items, which will give you a list of slabs which includes a count of the items store within each slab.

Now that you know how to list slabs, you can browse inside each slab to list the items contained within by using the stats cachedump [slab ID] [number of items, 0 for all items] command.

If you want to get the actual value of that item, you can use the get [key] command.

To delete an item from the cache you can use the delete [key] command.

这篇关于有哪些有用的提示/工具可用于监视/调整内存缓存的运行状况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆