日期:2014-05-16  浏览次数:20625 次

初步测试memcachedb时碰到的问题

今天在内网搭建memcachedb时,服务端搭建好后,用Java的客户端进行访问测试,在数据量设置为100,1000,10000时,都能正常访问,当我把数据量设置为10000条时,出现了下面的错误:

?

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
=================================== 开始存储 =================================================
Exception in thread "main" java.lang.IllegalArgumentException: Cannot cache data larger than 1MB (you tried to cache a 1965471 byte object)
	at net.rubyeye.xmemcached.transcoders.CachedData.<init>(CachedData.java:95)
	at net.rubyeye.xmemcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:229)
	at net.rubyeye.xmemcached.command.text.TextStoreCommand.encodeValue(TextStoreCommand.java:172)
	at net.rubyeye.xmemcached.command.text.TextStoreCommand.encode(TextStoreCommand.java:127)
	at net.rubyeye.xmemcached.impl.MemcachedTCPSession.wrapMessage(MemcachedTCPSession.java:150)
	at com.google.code.yanf4j.core.impl.AbstractSession.write(AbstractSession.java:405)
	at net.rubyeye.xmemcached.impl.MemcachedConnector.send(MemcachedConnector.java:325)
	at net.rubyeye.xmemcached.XMemcachedClient.sendCommand(XMemcachedClient.java:223)
	at net.rubyeye.xmemcached.XMemcachedClient.sendStoreCommand(XMemcachedClient.java:2181)
	at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1128)
	at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1186)
	at net.rubyeye.xmemcached.XMemcachedClient.set(XMemcachedClient.java:1173)
	at com.client.MemcachedDBClient.testCacheList(MemcachedDBClient.java:41)
	at com.client.MemcachedDBClient.main(MemcachedDBClient.java:24)
?

?

目前正在找资料解决这个问题,记录下来作为备案,以作继续处理的笔记。

?

此问题已经解决,主要原因是因为我在测试时,把一个List当作一个对象存储进去,当然,这个List对象保存的是10W条经过MD5后的Hash数据,超大了。

?