`

cacheServer memcache / varnish / redis

阅读更多

memcache download

http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.15-stable.tar.gz

http://code.jellycan.com/files/memcached-1.2.6.tar.gz

http://code.jellycan.com/files/memcached-1.2.6-win32-bin.zip

http://hi.baidu.com/loveyoursmile/blog/item/1177312af38429335243c16f.html

http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/

http://www.urielkatz.com/projects/memcached-win64/memcached-win64.zip

在64位Linux上安装MemCached

http://www.ningoo.net/html/2009/install_memcached_on_linux_64.html

命令行启动memcache服务

[root@B2Cmonitor Desktop]# /usr/local/bin/memcached -d -u root -m 1024 -l 192.168.100.149 -p 11211

[root@B2Cmonitor nmon]# crontab -l

00 00 * * * /nmon/nmon_x86_rhel45 -s60 -c1440 -f -m /nmon

命令行查看memcache状态

http://www.51testing.com/?uid-116228-action-viewspace-itemid-107545

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

 

[lindows@B2Cmonitor ~]$ /usr/local/bin/memcached -h
memcached 1.4.5

-p <num>      TCP port number to listen on (default: 11211)
-U <num>      UDP port number to listen on (default: 11211, 0 is off)
-s <file>     UNIX socket path to listen on (disables network support)
-a <mask>     access mask for UNIX socket, in octal (default: 0700)
-l <ip_addr>  interface to listen on (default: INADDR_ANY, all addresses)
-d            run as a daemon
-r            maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-m <num>      max memory to use for items in megabytes (default: 64 MB)
-M            return error on memory exhausted (rather than removing items)
-c <num>      max simultaneous connections (default: 1024)
-k            lock down all paged memory.  Note that there is a
              limit on how much memory you may lock.  Trying to
              allocate more than that would fail, so be sure you
              set the limit correctly for the user you started
              the daemon with (not for -u <username> user;
              under sh this is done with 'ulimit -S -l NUM_KB').
-v            verbose (print errors/warnings while in event loop)
-vv           very verbose (also print client commands/reponses)
-vvv          extremely verbose (also print internal state transitions)
-h            print this help and exit
-i            print memcached and libevent license
-P <file>     save PID in <file>, only used with -d option
-f <factor>   chunk size growth factor (default: 1.25)
-n <bytes>    minimum space allocated for key+value+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 <char>     Use <char> 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 <num>      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)

lindowsmatoMacBook-Pro:~ lindows$ telnet 192.168.100.149 11211
Trying 192.168.100.149...
Connected to 192.168.100.149.
Escape character is '^]'.

ERROR
stats
STAT pid 21251
STAT uptime 12550645
STAT time 1320139198
STAT version 1.4.5
STAT pointer_size 64
STAT rusage_user 10126.795493
STAT rusage_system 21859.064917
STAT curr_connections 216
STAT total_connections 5374458
STAT connection_structures 426
STAT cmd_get 684113237
STAT cmd_set 2941276
STAT cmd_flush 0
STAT get_hits 683389325
STAT get_misses 723912
STAT delete_misses 520993
STAT delete_hits 51931
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 22365116565
STAT bytes_written 960876073524
STAT limit_maxbytes 3145728000
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 313173
STAT curr_items 260
STAT total_items 2941276
STAT evictions 0
STAT reclaimed 467616
END

ERROR

 

quit

Connection closed by foreign host.
lindowsmatoMacBook-Pro:~ lindows$

memcache充当session server方案

http://netli.iteye.com/blog/686925

java_memcached-release_2.6.2.zip

https://github.com/gwhalin/Memcached-Java-Client /downloads

http://dl.iteye.com/topics/download/685c752b-8690-34c5-8783-6d05c9060aab

lindowsmatoMacBook-Pro:java_memcached-release_2.6.2 lindows$ ls -l
total 512
-rwxr-xr-x  1 lindows  staff    1814  8 12 09:04 README
-rwxr-xr-x  1 lindows  staff  100472  5 25 13:37 commons-pool-1.5.6.jar
-rwxr-xr-x  1 lindows  staff  118424  8 12 09:00 java_memcached-release_2.6.2.jar
-rwxr-xr-x  1 lindows  staff   25496  5 25 12:35 slf4j-api-1.6.1.jar
-rwxr-xr-x  1 lindows  staff    7669  5 25 12:35 slf4j-simple-1.6.1.jar

192.168.121.17

java_memcached-release_2.0.1.jar

[root@arvato4snweb2 ~]# ps -ef | grep memcache
apache    2780     1  0 Jul05 ?        00:01:47 /usr/local/memcached/bin/memcached -d -m 128 -l 127.0.0.1 -p 11211 -u apache
apache    2782     1  0 Jul05 ?        00:00:00 /usr/local/memcached/bin/memcached -d -m 128 -l 127.0.0.1 -p 11210 -u apache
root     14800     1  0 Jul30 ?        00:01:49 java -Xms1024m -Xmx1024m -classpath /home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/ant.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/jdom.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/classes12.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/commons-logging-1.0.4.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/java_memcached-release_2.0.1.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/log4j-1.2.8.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/mysql-connector-java-3.1.12-bin.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/Sys_Lib/proxool-0.9.0RC3.jar:/home/ecccs/work/LiveChat41/Live_Chat41_Server/ReportForICC/classes -Djava.nio.use_epoll=true business.JReportApp 1

[root@arvato4snweb2 ~]# netstat -atpln | grep 11211
tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN      2780/memcached     
tcp        0      0 127.0.0.1:37875             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:37879             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:37878             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:37876             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:37121             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:37122             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:37126             127.0.0.1:11211             TIME_WAIT   -                  
tcp        0      0 127.0.0.1:11211             127.0.0.1:50781             ESTABLISHED 2780/memcached     
tcp        0      0 ::ffff:127.0.0.1:50781      ::ffff:127.0.0.1:11211      ESTABLISHED 9671/java

[root@arvato4snweb2 ~]# netstat -an | grep 11211 | wc -l
15

192.168.100.149

[root@B2Cmonitor bin]# ps -ef | grep memcache
root     10159  9611  0 17:20 pts/1    00:00:00 grep memcache
lindows  21251     1  0 Jun09 ?        06:02:56 /usr/local/bin/memcached -d -u root -m 3000 -l 192.168.100.149 -p 11211
[root@B2Cmonitor bin]# netstat -an | grep 11211 | wc -l
142

[root@B2Cmonitor lib]# netstat -atpln | grep 11211 | more
tcp        0      0 192.168.100.149:11211       0.0.0.0:*                   LISTEN      21251/memcached    
tcp        0      0 192.168.100.149:11211       192.168.100.99:38319        ESTABLISHED 21251/memcached    
tcp        0      0 192.168.100.149:11211       192.168.119.129:37421       ESTABLISHED 21251/memcached    
tcp        0      0 192.168.100.149:11211       192.168.119.129:42541       ESTABLISHED 21251/memcached    
tcp        0      0 192.168.100.149:11211       192.168.119.129:37679       ESTABLISHED 21251/memcached    
tcp        0      0 192.168.100.149:11211       192.168.119.129:42536       ESTABLISHED 21251/memcached

[root@B2Cmonitor lib]# ls -l   /usr/local/lib
total 4980
lrwxrwxrwx 1 root root      21 Jun  9 10:48 libevent-2.0.so.5 -> libevent-2.0.so.5.1.0
-rwxr-xr-x 1 root root  946708 Jun  9 10:48 libevent-2.0.so.5.1.0
-rw-r--r-- 1 root root 1541136 Jun  9 10:48 libevent.a
lrwxrwxrwx 1 root root      26 Jun  9 10:48 libevent_core-2.0.so.5 -> libevent_core-2.0.so.5.1.0
-rwxr-xr-x 1 root root  555297 Jun  9 10:48 libevent_core-2.0.so.5.1.0
-rw-r--r-- 1 root root  930318 Jun  9 10:48 libevent_core.a
-rwxr-xr-x 1 root root     977 Jun  9 10:48 libevent_core.la
lrwxrwxrwx 1 root root      26 Jun  9 10:48 libevent_core.so -> libevent_core-2.0.so.5.1.0
lrwxrwxrwx 1 root root      27 Jun  9 10:48 libevent_extra-2.0.so.5 -> libevent_extra-2.0.so.5.1.0
-rwxr-xr-x 1 root root  413593 Jun  9 10:48 libevent_extra-2.0.so.5.1.0
-rw-r--r-- 1 root root  610890 Jun  9 10:48 libevent_extra.a
-rwxr-xr-x 1 root root     984 Jun  9 10:48 libevent_extra.la
lrwxrwxrwx 1 root root      27 Jun  9 10:48 libevent_extra.so -> libevent_extra-2.0.so.5.1.0
-rwxr-xr-x 1 root root     942 Jun  9 10:48 libevent.la
lrwxrwxrwx 1 root root      30 Jun  9 10:48 libevent_pthreads-2.0.so.5 -> libevent_pthreads-2.0.so.5.1.0
-rwxr-xr-x 1 root root   18094 Jun  9 10:48 libevent_pthreads-2.0.so.5.1.0
-rw-r--r-- 1 root root   18678 Jun  9 10:48 libevent_pthreads.a
-rwxr-xr-x 1 root root    1005 Jun  9 10:48 libevent_pthreads.la
lrwxrwxrwx 1 root root      30 Jun  9 10:48 libevent_pthreads.so -> libevent_pthreads-2.0.so.5.1.0
lrwxrwxrwx 1 root root      21 Jun  9 10:48 libevent.so -> libevent-2.0.so.5.1.0
drwxr-xr-x 2 root root    4096 Jun  9 10:48 pkgconfig

[root@B2Cmonitor lib]# ls -l /usr/local/lib/pkgconfig/
total 8
-rw-r--r-- 1 root root 333 Jun  9 10:48 libevent.pc
-rw-r--r-- 1 root root 370 Jun  9 10:48 libevent_pthreads.pc

 

 

http://pecl.php.net/package/memcache

http://downloads.php.net/pierre/

http://sunney2010.iteye.com/blog/656905

http://hi.baidu.com/%D6%B0%B3%A1%D0%C2%CA%D6%B9%FE%B9%FE/blog/item/1765f3d6c7763ad4a144dfda.html

http://www.cnblogs.com/daviyang/archive/2010/04/16/1859385.html

http://hi.baidu.com/baijunhui/blog/item/e395ddd40804b90ca08bb769.html/cmtid/ddde05433540ce1f9213c6cc

http://pecl.php.net/package/memcache

http://www.360doc.com/content/10/1210/15/59865_76785815.shtml

http://www.it118.org/Specials/c1b83237-8710-472c-8ceb-dd3059340f7d/9ff63b86-6629-4a99-8162-84506ccf3c06.htm

http://hi.baidu.com/lzyu/blog/item/05eac813dba80d045baf5364.html

http://hi.baidu.com/%D2%BB%D2%B3%B0%C9/blog/item/1ec6ed79ced80de20bd18759.html

http://hi.baidu.com/baijunhui/blog/item/e395ddd40804b90ca08bb769.html

http://my.oschina.net/wdlinux/blog/8993

http://www.monkey.org/~provos/libevent/

 

 

http://www.danga.com/memcached/apis.bml

Java API

A Java API is maintained by Greg Whalin from Meetup.com . You can find that library here:

An improved Java API maintained by Dustin Sallings is also available. Aggressively optimised, ability to run async, supports binary protocol, etc. See site for details:

 

http://num7.iteye.com/blog/212778

Memcache是什么
Memcache是danga.com的一个项目,最早是为 LiveJournal 服务的,目前全世界不少人使用这个缓存项目来构建自己大负载的网站,来分担数据库的压力。
它可以应对任意多个连接,使用非阻塞的网络IO。由于它的工作机制是在内存中开辟一块空间,然后建立一个HashTable,Memcached自管理这些HashTable。
Memcache官方网站:http://www.danga.com/memcached,更多详细的信息可以来这里了解 :)

为什么会有Memcache和memcached两种名称?
其实Memcache是这个项目的名称,而memcached是它服务器端的主程序文件名,知道我的意思了把~~~~。一个是项目名称,一个是主程序文件名,在网上看到了很多人不明白,于是混用了。

 

Memcache的安装
分为两个过程:memcache服务器端的安装和memcached客户端的安装。
所谓服务器端的安装就是在服务器(一般都是linux系统)上安装Memcache实现数据的存储
所谓客户端的安装就是指php(或者其他程序,Memcache还有其他不错的api接口提供)去使用服务器端的Memcache提供的函数,需要php添加扩展。

具体的配置大家可以参考:
Linux下的Memcache安装 :http://www.ccvita.com/257.html
Windows下的Memcache安装 :http://www.ccvita.com/258.html
Memcache基础教程 :http://www.ccvita.com/259.html
Discuz!的Memcache缓存实现 :http://www.ccvita.com/261.html
Memcache协议中文版http://www.ccvita.com/306.html

 

Memcache的使用和协议分析详解

http://blog.csdn.net/heiyeshuwu/archive/2006/11/13/1380838.aspx

http://baike.baidu.com/view/1193094.htm


Spring+memcache

http://neptune.iteye.com/blog/220454

 

MemCached 压力测试

http://www.iteye.com/topic/77560

 

 

命令行查看memcache状态

http://www.51testing.com/?uid-116228-action-viewspace-itemid-107545

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

 


memcached安装

http://www.51testing.com/?uid-116228-action-viewspace-itemid-149319

 

1、  安装文件准备

1)、Memcache的服务器端程序:当前最新版本号为

  下载地址:http://www.danga.com/memcached/download.bml

2)、Memcache的安装先决条件:先安装libevent,当前最新版本号为

  Libevent介绍:libevent是一个事件触发的网络库,适用于windows、linux、bsd等多种平台,内部使用select、epoll、kqueue等系统调用管理事件机制。著名的用于apache的php缓存库memcached 据说也是libevent based,而且libevent在使用上可以做到跨平台,而且根据libevent官方网站上公布的数据统计,似乎也有着非凡的性能。

  下载地址:http://monkey.org/~provos/libevent/

2、  操作系统 要求

鉴于我们线上环境和线下的要保持一致,我们都将采用linux。具体的版本号为:

Redhat advance server4 v4,可以使用更高版本(更高版本未经测试

如果是redhat advance server4 v2 ,请保证gcc编译器可以使用,或者升级到v4然后安装gcc编译器。一般升级的方式都是从光盘启动升级过程,升级后安装gcc编译器。默认的v2版本没有安装gcc编译器。

3、  编译器要求

Memcache的安装文件是要求我们安装gcc编译器的。否则我们的libevent和memcache都无法安装。

检查是否有gcc编译器的命令:gcc –v

如果系统的gcc编译器可以用,将会有一段描述,否则提示找不到类库。

成功的例如:

Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux

Thread model: posix

gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)

4、  安装

 先安装libevent,然后才能安装memcache

 1)、libevent安装

//先解压缩

[root@localhost]#tar -zxvf  libevent-1.4.8-stable.tar.gz

//切换到libevent的目录中

[root@localhost]#cd  libevent-1.4.8-stable

//指定安装路径到/usr/目录下
[root@localhost]#./configure --prefix=/usr/

//编译

[root@localhost]#make

//安装

[root@localhost]#.make install

 

 

 2)、memcache服务器安装

//先解压缩memcached-1.2.6.tar.gz

[root@localhost]#tar -zxvf  memcached-1.2.6.tar.gz

//切换到memcache的目录中

[root@localhost]#cd  memcached-1.2.6

//指定安装路径到/usr/local/server/memcache目录下,同时指定libevent的安装位置
[root@localhost]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/

//编译

[root@localhost]#make

//安装

[root@localhost]#.make install

 测试每步是否安装成功:

   测试libevent:

   [root@localhost]# ls /usr/lib |grep libevent

libevent-1.4.so.2

libevent-1.4.so.2.1.1

libevent.a

libevent.la

libevent.so

libevent_core-1.4.so.2

libevent_core-1.4.so.2.1.1

libevent_core.a

libevent_core.la

libevent_core.so

libevent_extra-1.4.so.2

libevent_extra-1.4.so.2.1.1

libevent_extra.a

libevent_extra.la

libevent_extra.so

  测试memcache:

[root@localhost]# ls -al /usr/local/memcached/bin

total 264

drwxr-xr-x  2 root root   4096 Sep 19 15:31 .

drwxr-xr-x  4 root root   4096 Sep 19 15:31 ..

-rwxr-xr-x  1 root root 120949 Sep 19 15:31 memcached

-rwxr-xr-x  1 root root 129947 Sep 19 15:31 memcached-debug

5、  启动memcache

1)、启动Memcache的服务器端:

[root@localhost]# /usr/local/bin/memcached -d -m 100 -u root -l 192.168.36.200 -p 11211 -c 256 -P /tmp/memcached.pid 

# /usr/local/bin/memcached -d -m 10 -u root -l 192.168.0.200 -p 12000 -c 256 -P /tmp/memcached.pid


    -d选项是启动一个守护进程,
    -m是分配给Memcache使用的内存数量,单位是MB,我这里是100MB,
    -u是运行Memcache的用户,我这里是root,
    -l是监听的服务器IP地址,如果有多个地址的话,我这里指定了服务器的IP地址192.168.36.200,
    -p是设置Memcache监听的端口,我这里设置了11211,最好是1024以上的端口,我们这里统一使用11211
    -c选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定。
    -P是设置保存Memcache的pid文件,我这里是保存在/tmp/memcached.pid,

2)、如果要结束Memcache进程,执行:

[root@localhost]# kill cat /tmp/memcached.pid

6、  监测是否启动成功方式

我们可以使用telnet来对我们的memcache服务器进行访问

例如:telnet 192.168.36.199 11211 (访问的是192.168.36.199这个ip的11211端口)

连接上后,直接敲击stats命令看当前缓存服务器状态

7、  设定memcache的telnet访问限制

请限定telnet的访问,使之只能在中转机上访问

8、  memcache的常见概念

memcached会预先分配内存,memcached分配内存方式称之为allocator,首先,这里有3个概念:
1 slab
2 page
3 chunk
解 释一下,一般来说一个memcahced进程会预先将自己划分为若干个slab,每个slab下又有若干个page,每个page下又有多个chunk, 如果我们把这3个咚咚看作是object得话,这是两个一对多得关系。再一般来说,slab得数量是有限得,几个,十几个,或者几十个,这个跟进程配置得 内存有关。而每个slab下得page默认情况是1m,也就是说如果一个slab占用100m得内存得话,那么默认情况下这个slab所拥有得page得 个数就是100,而chunk就是我们得数据存放得最终地方。

9、  Memcache的常用命令

 Memcache常见的命令都在协议文件上:安装文件的的doc目录下的protocol.txt文件中有详细说明

 1)、查询状态命令:stats:

    Name              Type     Meaning

----------------------------------

pid               32u      Process id of this server process

uptime            32u      Number of seconds this server has been running

time              32u      current UNIX time according to the server

version           string   Version string of this server

pointer_size      32       Default size of pointers on the host OS

                           (generally 32 or 64)

rusage_user       32u:32u  Accumulated user time for this process

                           (seconds:microseconds)

rusage_system     32u:32u  Accumulated system time for this process

                           (seconds:microseconds)

curr_items        32u      Current number of items stored by the server

total_items       32u      Total number of items stored by this server

                           ever since it started

bytes             64u      Current number of bytes used by this server

                           to store items

curr_connections  32u      Number of open connections

total_connections 32u      Total number of connections opened since

                           the server started running

connection_structures 32u  Number of connection structures allocated

                           by the server

cmd_get           64u      Cumulative number of retrieval requests

cmd_set           64u      Cumulative number of storage requests

get_hits          64u      Number of keys that have been requested and

                           found present

get_misses        64u      Number of items that have been requested

                           and not found

evictions         64u      Number of valid items removed from cache                                                                          

                           to free memory for new items                                                                                      

bytes_read        64u      Total number of bytes read by this server

                           from network

bytes_written     64u      Total number of bytes sent by this server to

                           network

limit_maxbytes    32u      Number of bytes this server is allowed to

                           use for storage.

threads           32u      Number of worker threads requested.

                           (see doc/threads.txt)

2)、查询版本号 version

3)、退出命令 quit

4)、显示各个slab的信息,包括chunk的大小、数目、使用情况等:stats slabs5)、显示各个slab中item的数目和最老item的年龄(最后一次访问距离现在的秒数):stats items
6)、显示内存分配:stats malloc

7)、清空缓存数据(其实是将所有缓存数据标记为过期):flush_all

 

end

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics