Memcache配置

用于存储session的memcache

/usr/bin/memcached -m 64 -c 2048 -f 1.10 -l 192.168.2.10 -p 11200 -n 1024 -I 5242880 -u apache &

-r  maximize core file limit

-c 客户端连接数

-f slab最小chunk(存储单元,实际存储数据的单元)增长因子(slab1 比 slab2大多少倍)

-n chunk的最小大小

-I slab的大小,一个用户1k,5m大约存能够5000个在线

/usr/bin/memcached -m 32 -c 2048 -f 1.25 -l 192.168.2.10 -p 11200 -n 1024 -I 5242880 -u apache &

 

目的是够用,当session远小于1k时,会有浪费,当总的来说不过用5M就能存储5000人。

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

[root@sc-centos6-1 ~]# memcached-tool 192.168.2.10:11200                               
  #  Item_Size  Max_age   Pages   Count   Full?  Evicted Evict_Time OOM
  1     1.0K       205s       1       2      no        0        0    0



[root@sc-centos6-1 ~]# telnet 127.0.0.1 11200
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
[root@sc-centos6-1 ~]# telnet 192.168.2.10 11200                                 
Trying 192.168.2.10...
Connected to 192.168.2.10.
Escape character is '^]'.
set aa 33 3600 10
1234567890
STORED
set aa 33 3600 100                        
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
STORED
get aa
VALUE aa 33 100
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
END
set aa1 33 3600 10
1234567890
STORED
get aa1
VALUE aa1 33 10
1234567890
END
stats slabs
STAT 1:chunk_size 1072
STAT 1:chunks_per_page 4890
STAT 1:total_pages 1
STAT 1:total_chunks 4890
STAT 1:used_chunks 2
STAT 1:free_chunks 0
STAT 1:free_chunks_end 4888
STAT 1:mem_requested 250
STAT 1:get_hits 2
STAT 1:cmd_set 3
STAT 1:delete_hits 0
STAT 1:incr_hits 0
STAT 1:decr_hits 0
STAT 1:cas_hits 0
STAT 1:cas_badval 0
STAT active_slabs 1
STAT total_malloced 5242080
END


 

 

posted @ 2013-04-25 13:32  javawebsoa  Views(266)  Comments(0Edit  收藏  举报