Memcache查看運行狀況

Memcache是danga.com的一個開源項目,它是一個高性能的分佈式的內存對象緩存系統,通過在內存裏維護一個統一的巨大的Hash表,能夠用來存儲各種格式的數據。

查看當前的memcache連接數:

[root@mem1 ~]# netstat -n | grep :11211 | wc -l
15752

查看默認允許的連接數:
[root@mem1 ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/local/bin/memcached -d -m 15360 -u root -l 172.20.1.54 -p 11211 -c 40960 
/usr/local/bin/memcached -d -m 512 -u root -l 172.20.1.54 -p 11212 -c 10000


這裏設置的11211端口默認連接數是40960

 

在網絡上查到資料, Memcache也有自己的查看工具:

如何查看memcache服務器端版本:  ./memcached  -h

memcache的運行狀態可以方便的用 stats 命令顯示。
首先用telnet 127.0.0.1 11211這樣的命令連接上memcache,然後直接輸入stats就可以得到當前memcache的狀態。
這些狀態的說明如下:

pid memcache服務器的進程ID
uptime 服務器已經運行的秒數
time 服務器當前的unix時間戳
version memcache版本
pointer_size 當前操作系統的指針大小(32位系統一般是32bit)
rusage_user 進程的累計用戶時間
rusage_system 進程的累計系統時間
curr_items 服務器當前存儲的items數量
total_items 從服務器啓動以後存儲的items總數量
bytes 當前服務器存儲items佔用的字節數
curr_connections 當前打開着的連接數
total_connections 從服務器啓動以後曾經打開過的連接數
connection_structures 服務器分配的連接構造數
cmd_get get命令(獲取)總請求次數
cmd_set set命令(保存)總請求次數
get_hits 總命中次數
get_misses 總未命中次數
evictions 爲獲取空閒內存而刪除的items數(分配給memcache的空間用滿後需要刪除舊的items來得到空間分配給新的items)
bytes_read 總讀取字節數(請求字節數)
bytes_written 總髮送字節數(結果字節數)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章