Mysql高性能之Memcached(1)(二)

2015-01-23 22:07:47 · 作者: · 浏览: 9
+flags (default: 48) -L Try to use large memory pages (if available). Increasing the memory page size could reduce the number of TLB misses and improve the performance. In order to get large pages from the OS, memcached will allocate the total item-cache in one large chunk. -D Use as the delimiter between key prefixes and IDs. This is used for per-prefix stats reporting. The default is ":" (colon). If this option is specified, stats collection is turned on automatically; if not, then it may be turned on by sending the "stats detail on" command to the server. -t number of threads to use (default: 4) -R Maximum number of requests per event, limits the number of requests process for a given connection to prevent starvation (default: 20) -C Disable use of CAS -b Set the backlog queue limit (default: 1024) -B Binding protocol - one of ascii, binary, or auto (default) -I Override the size of each slab page. Adjusts max item size (default: 1mb, min: 1k, max: 128m) 初始化Memcached:
memcached -u root -d -m 512 -p 11211 -l 192.168.56.12

[root@ogg1 bin]# ps -ef |grep mem
root      4382     1  0 02:01 ?        00:00:00 memcached -u root -d -m 512 -p 11211 -l 192.168.56.12
查看当前Memcached的状态:
[root@ogg1 bin]# telnet 192.168.56.12 11211  
Trying 192.168.56.12...
Connected to 192.168.56.12.
Escape character is '^]'.
stats
STAT pid 4382
STAT uptime 7288
STAT time 1418893354
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 0.353946
STAT rusage_system 0.379942
STAT curr_connections 5
STAT total_connections 8
STAT connection_structures 6
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 144
STAT bytes_written 1732
STAT limit_maxbytes 536870912
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
END

对应参数解释:
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  总发送字节数(结果字节数)
limit_maxbytes  分配给memcache的内存大小(字节)
threads  当前线程数