なるようにしかならん

そういうことです

memcache-topでクラスタ全体の統計情報を見る

memcache-topっつーのがあるってことで使ってみました。


対象のホストは、104行目あたりの@default_instancesって所で設定できたりします。
もう使うクラスタ情報が固定だバカヤロウって人は書き換えちゃってもいいかも。

# List of servers/ ports to query.
@default_instances = (
"127.0.0.1:11211", "127.0.0.1:11212"
);

もしくは--instancesオプション使って、カンマ区切りでhostを列挙する感じ。

一旦オプション列挙しておく。

- Specify instances w/ --instances (multiple times or comma separated)
- Specify default port w/ --port (defaults to 11211)
- Specify sleep time w/ --sleep (default 3)
- Specify color output w/ --color (default) or --nocolor
- Specify lifetime stats w/ --lifetime or --nolifetime (default)
   NOTE: lifetime stats break thresholds for evictions, bytes.
- Specify read and write bytes w/ --bytes (default) or --nobytes
- Specify get and set commands w/ --commands or --nocommands (default)
- Specify cumulative numbers w/ --cumulative (don't use with lifetime)

evictionの回数も見れるから、「えっ、キャッシュ溢れてる・・・・?」ってのも
一覧で見られるので、助かります。たまに設定値がデフォのとか混ざってるとすぐにわかりますね。


環境によってはしきい値(上回るとデフォルトで文字が赤くなります)を変更したいって時に
以下の項目ををいぢるといいかも。

# 'Alert' threshold values at which to color the text red.
%threshold = (
    cache_hit           => 60,          # Cache hit ratio
    usage               => 90,          # % space used
    time                => 5,           # Number of ms to run the stats query
    evictions           => 0,           # Number of evictions per second
    curr_connections    => 3500,        # Number of current connections
    bytes_read          => 1000000,     # Bytes read, per second
    bytes_written       => 1000000,     # Bytes written, per second
    limit_maxbytes      => 0,           # Total space allocated
    bytes               => 0,           # Total space used
    cmd_get             => 1000,        # Get commands
    cmd_set             => 1000,        # Set commands
);

slabs情報の取得は、これを改変してきっとすてきな人が作ってくれるはず(ぇ