memcached增长因子导致的问题

javantsky 2010-08-31

memcached版本为:1.4.5

xmemcached版本为:1.2.5

 

我的memcached启动命令为:

 memcached -p 11211 -u root -f 1.001 -m 64 -n 128 -vv

 启动后:

slab class   1: chunk size       176 perslab    5957
slab class   2: chunk size       176 perslab    5957
slab class   3: chunk size       176 perslab    5957
slab class   4: chunk size       176 perslab    5957
slab class   5: chunk size       176 perslab    5957
slab class   6: chunk size       176 perslab    5957
slab class   7: chunk size       176 perslab    5957
slab class   8: chunk size       176 perslab    5957
slab class   9: chunk size       176 perslab    5957
slab class  10: chunk size       176 perslab    5957
slab class  11: chunk size       176 perslab    5957
slab class  12: chunk size       176 perslab    5957
slab class  13: chunk size       176 perslab    5957
slab class  14: chunk size       176 perslab    5957
slab class  15: chunk size       176 perslab    5957
slab class  16: chunk size       176 perslab    5957
slab class  17: chunk size       176 perslab    5957
slab class  18: chunk size       176 perslab    5957
slab class  19: chunk size       176 perslab    5957
slab class  20: chunk size       176 perslab    5957
slab class  21: chunk size       176 perslab    5957
slab class  22: chunk size       176 perslab    5957
slab class  23: chunk size       176 perslab    5957
slab class  24: chunk size       176 perslab    5957
slab class  25: chunk size       176 perslab    5957
slab class  26: chunk size       176 perslab    5957
slab class  27: chunk size       176 perslab    5957
slab class  28: chunk size       176 perslab    5957
slab class  29: chunk size       176 perslab    5957
slab class  30: chunk size       176 perslab    5957
slab class  31: chunk size       176 perslab    5957
slab class  32: chunk size       176 perslab    5957
slab class  33: chunk size       176 perslab    5957
slab class  34: chunk size       176 perslab    5957
slab class  35: chunk size       176 perslab    5957
slab class  36: chunk size       176 perslab    5957
slab class  37: chunk size       176 perslab    5957
slab class  38: chunk size       176 perslab    5957
slab class  39: chunk size       176 perslab    5957
slab class  40: chunk size       176 perslab    5957
slab class  41: chunk size       176 perslab    5957
slab class  42: chunk size       176 perslab    5957
slab class  43: chunk size       176 perslab    5957
slab class  44: chunk size       176 perslab    5957
slab class  45: chunk size       176 perslab    5957
slab class  46: chunk size       176 perslab    5957
slab class  47: chunk size       176 perslab    5957
slab class  48: chunk size       176 perslab    5957
slab class  49: chunk size       176 perslab    5957
slab class  50: chunk size       176 perslab    5957
slab class  51: chunk size       176 perslab    5957
slab class  52: chunk size       176 perslab    5957
slab class  53: chunk size       176 perslab    5957
slab class  54: chunk size       176 perslab    5957
slab class  55: chunk size       176 perslab    5957
slab class  56: chunk size       176 perslab    5957
slab class  57: chunk size       176 perslab    5957
slab class  58: chunk size       176 perslab    5957
slab class  59: chunk size       176 perslab    5957
slab class  60: chunk size       176 perslab    5957
slab class  61: chunk size       176 perslab    5957
slab class  62: chunk size       176 perslab    5957
slab class  63: chunk size       176 perslab    5957
slab class  64: chunk size       176 perslab    5957
slab class  65: chunk size       176 perslab    5957
slab class  66: chunk size       176 perslab    5957
slab class  67: chunk size       176 perslab    5957
slab class  68: chunk size       176 perslab    5957
slab class  69: chunk size       176 perslab    5957
slab class  70: chunk size       176 perslab    5957
slab class  71: chunk size       176 perslab    5957
slab class  72: chunk size       176 perslab    5957
slab class  73: chunk size       176 perslab    5957
slab class  74: chunk size       176 perslab    5957
slab class  75: chunk size       176 perslab    5957
slab class  76: chunk size       176 perslab    5957
slab class  77: chunk size       176 perslab    5957
slab class  78: chunk size       176 perslab    5957
slab class  79: chunk size       176 perslab    5957
slab class  80: chunk size       176 perslab    5957
slab class  81: chunk size       176 perslab    5957
slab class  82: chunk size       176 perslab    5957
slab class  83: chunk size       176 perslab    5957
slab class  84: chunk size       176 perslab    5957
slab class  85: chunk size       176 perslab    5957
slab class  86: chunk size       176 perslab    5957
slab class  87: chunk size       176 perslab    5957
slab class  88: chunk size       176 perslab    5957
slab class  89: chunk size       176 perslab    5957
slab class  90: chunk size       176 perslab    5957
slab class  91: chunk size       176 perslab    5957
slab class  92: chunk size       176 perslab    5957
slab class  93: chunk size       176 perslab    5957
slab class  94: chunk size       176 perslab    5957
slab class  95: chunk size       176 perslab    5957
slab class  96: chunk size       176 perslab    5957
slab class  97: chunk size       176 perslab    5957
slab class  98: chunk size       176 perslab    5957
slab class  99: chunk size       176 perslab    5957
slab class 100: chunk size       176 perslab    5957
slab class 101: chunk size       176 perslab    5957
slab class 102: chunk size       176 perslab    5957
slab class 103: chunk size       176 perslab    5957
slab class 104: chunk size       176 perslab    5957
slab class 105: chunk size       176 perslab    5957
slab class 106: chunk size       176 perslab    5957
slab class 107: chunk size       176 perslab    5957
slab class 108: chunk size       176 perslab    5957
slab class 109: chunk size       176 perslab    5957
slab class 110: chunk size       176 perslab    5957
slab class 111: chunk size       176 perslab    5957
slab class 112: chunk size       176 perslab    5957
slab class 113: chunk size       176 perslab    5957
slab class 114: chunk size       176 perslab    5957
slab class 115: chunk size       176 perslab    5957
slab class 116: chunk size       176 perslab    5957
slab class 117: chunk size       176 perslab    5957
slab class 118: chunk size       176 perslab    5957
slab class 119: chunk size       176 perslab    5957
slab class 120: chunk size       176 perslab    5957
slab class 121: chunk size       176 perslab    5957
slab class 122: chunk size       176 perslab    5957
slab class 123: chunk size       176 perslab    5957
slab class 124: chunk size       176 perslab    5957
slab class 125: chunk size       176 perslab    5957
slab class 126: chunk size       176 perslab    5957
slab class 127: chunk size       176 perslab    5957
slab class 128: chunk size       176 perslab    5957
slab class 129: chunk size       176 perslab    5957
slab class 130: chunk size       176 perslab    5957
slab class 131: chunk size       176 perslab    5957
slab class 132: chunk size       176 perslab    5957
slab class 133: chunk size       176 perslab    5957
slab class 134: chunk size       176 perslab    5957
slab class 135: chunk size       176 perslab    5957
slab class 136: chunk size       176 perslab    5957
slab class 137: chunk size       176 perslab    5957
slab class 138: chunk size       176 perslab    5957
slab class 139: chunk size       176 perslab    5957
slab class 140: chunk size       176 perslab    5957
slab class 141: chunk size       176 perslab    5957
slab class 142: chunk size       176 perslab    5957
slab class 143: chunk size       176 perslab    5957
slab class 144: chunk size       176 perslab    5957
slab class 145: chunk size       176 perslab    5957
slab class 146: chunk size       176 perslab    5957
slab class 147: chunk size       176 perslab    5957
slab class 148: chunk size       176 perslab    5957
slab class 149: chunk size       176 perslab    5957
slab class 150: chunk size       176 perslab    5957
slab class 151: chunk size       176 perslab    5957
slab class 152: chunk size       176 perslab    5957
slab class 153: chunk size       176 perslab    5957
slab class 154: chunk size       176 perslab    5957
slab class 155: chunk size       176 perslab    5957
slab class 156: chunk size       176 perslab    5957
slab class 157: chunk size       176 perslab    5957
slab class 158: chunk size       176 perslab    5957
slab class 159: chunk size       176 perslab    5957
slab class 160: chunk size       176 perslab    5957
slab class 161: chunk size       176 perslab    5957
slab class 162: chunk size       176 perslab    5957
slab class 163: chunk size       176 perslab    5957
slab class 164: chunk size       176 perslab    5957
slab class 165: chunk size       176 perslab    5957
slab class 166: chunk size       176 perslab    5957
slab class 167: chunk size       176 perslab    5957
slab class 168: chunk size       176 perslab    5957
slab class 169: chunk size       176 perslab    5957
slab class 170: chunk size       176 perslab    5957
slab class 171: chunk size       176 perslab    5957
slab class 172: chunk size       176 perslab    5957
slab class 173: chunk size       176 perslab    5957
slab class 174: chunk size       176 perslab    5957
slab class 175: chunk size       176 perslab    5957
slab class 176: chunk size       176 perslab    5957
slab class 177: chunk size       176 perslab    5957
slab class 178: chunk size       176 perslab    5957
slab class 179: chunk size       176 perslab    5957
slab class 180: chunk size       176 perslab    5957
slab class 181: chunk size       176 perslab    5957
slab class 182: chunk size       176 perslab    5957
slab class 183: chunk size       176 perslab    5957
slab class 184: chunk size       176 perslab    5957
slab class 185: chunk size       176 perslab    5957
slab class 186: chunk size       176 perslab    5957
slab class 187: chunk size       176 perslab    5957
slab class 188: chunk size       176 perslab    5957
slab class 189: chunk size       176 perslab    5957
slab class 190: chunk size       176 perslab    5957
slab class 191: chunk size       176 perslab    5957
slab class 192: chunk size       176 perslab    5957
slab class 193: chunk size       176 perslab    5957
slab class 194: chunk size       176 perslab    5957
slab class 195: chunk size       176 perslab    5957
slab class 196: chunk size       176 perslab    5957
slab class 197: chunk size       176 perslab    5957
slab class 198: chunk size       176 perslab    5957
slab class 199: chunk size       176 perslab    5957
slab class 200: chunk size   1048576 perslab       1
<36 server listening (auto-negotiate)
<37 server listening (auto-negotiate)
<38 send buffer was 135168, now 268435456
<39 send buffer was 135168, now 268435456
<38 server listening (udp)
<39 server listening (udp)
<38 server listening (udp)
<39 server listening (udp)
<38 server listening (udp)
<39 server listening (udp)
<38 server listening (udp)
<39 server listening (udp)

 一切正常。

开始用xmemcached测试

public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
				.getAddresses("10.189.8.116:11211"));
		//builder.setSessionLocator(new ElectionMemcachedSessionLocator());
		MemcachedClient mc = builder.build();
		int tm = (int)(Math.random()*100);
		mc.add("key" + tm, 0, "中国包装总公司中国包装总公司中国包装总公司中国包装总公司中国包装总公司" + tm);
		
		String val = mc.get("key" + tm);
		
		System.out.println(val);
		
		mc.shutdown();

	}

 异常为:

Exception in thread "main" java.util.concurrent.TimeoutException: Timed out(1000) waiting for operation
	at net.rubyeye.xmemcached.XMemcachedClient.latchWait(XMemcachedClient.java:2200)
	at net.rubyeye.xmemcached.XMemcachedClient.fetch0(XMemcachedClient.java:491)
	at net.rubyeye.xmemcached.XMemcachedClient.get0(XMemcachedClient.java:847)
	at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:805)
	at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:816)
	at net.rubyeye.xmemcached.XMemcachedClient.get(XMemcachedClient.java:838)
	at XMTest.main(XMTest.java:21)

 memcached后台提示:

<40 new auto-negotiating client connection
40: Client using the ascii protocol
<40 add key50 0 0 107
>40 STORED
<40 get key50
Segmentation fault
[root@p2ash004 ~]# 

 memcached居然直接挂了!!!!!!!!!!!!

 

如果memcached启动命令的修改为:

memcached -p 11211 -u root -f 1.01 -m 64 -n 128 -vv

仅仅是 -f 1.001 修改为 -f 1.01,程序就正常了!

 

 

 

有人碰到过和我类似的问题吗?

javantsky 2010-08-31
用“二进制协议”存取含中文的数据就没这个问题了
javaDevil 2014-02-10
今天按照楼主的方法 试了一下,果然 好了。
Global site tag (gtag.js) - Google Analytics