gwhalin memcached Java客户端设置对象大小> 1 MB增加平板大小

时间:2018-12-11 07:03:27

标签: java caching memcached spymemcached xmemcached

我正在使用com.whalin / Memcached-Java-Client库版本3.0.2。默认平板大小为1 MB,并且我已使用-I命令来启动内存缓存服务器-memcached -d -u nobody -m 4096 127.0.0.1 -p 11211 -I 5242880。 Memcached服务器版本为1.4.26。我有一个旧系统,我想将memcached平板的大小增加到5 MB。当我尝试在memcached中添加/设置对象大小超过1 MB时,我将获得以下异常

Dec 11, 2018 12:13:31 PM com.schooner.MemCached.BinaryClient set
SEVERE: ++++ exception thrown while writing bytes to server on set
Dec 11, 2018 12:13:31 PM com.schooner.MemCached.BinaryClient set
SEVERE: Connection reset by peer
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at com.schooner.MemCached.SockOutputStream.writeToChannel(Unknown Source)
at com.schooner.MemCached.SockOutputStream.write(Unknown Source)

我尝试将TransCoder设置为与xmemcached客户端相似,但是whalin客户端具有不同的实现。

实施WhalinMemcachedJavaClient示例:

    private static void implementWhalinMemcachedJavaClient() {
    String[] servers = { "127.0.0.1:11211" };
    SockIOPool sockIOPool = SockIOPool.getInstance("SanTest");

    sockIOPool.setMinConn(2);
    sockIOPool.setMaxConn(20);
    sockIOPool.setServers(servers);
    sockIOPool.setFailover(true);
    sockIOPool.setInitConn(30);
    sockIOPool.setMaintSleep(90);
    sockIOPool.setSocketTO(2000);
    sockIOPool.setAliveCheck(true);
    sockIOPool.setHashingAlg(SockIOPool.NATIVE_HASH);
    sockIOPool.initialize();

    MemCachedClient whalinClient = new MemCachedClient("SanTest", true);
    //MemCachedClient whalinClient = new MemCachedClient("SanTest");

    whalinClient.add("Result", "Success");

    System.out.println("get Result=" + whalinClient.get("Result"));
}

我想将平板大小增加到5MB。请告知whalin memcached客户端中是否有任何选项可以将平板大小从1 MB增加到5 MB。

0 个答案:

没有答案