操作超时使用CouchbaseClient

时间:2012-10-18 12:41:47

标签: java couchbase timeoutexception spymemcached

即使Couchbase服务器上没有太多负载,我也会收到超时异常。

net.spy.memcached.OperationTimeoutException: Timeout waiting for value
        at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1003)
        at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1018)
        at com.eos.cache.CacheClient.get(CacheClient.java:280)
        at com.eos.cache.GenericCacheAccessObject.get(GenericCacheAccessObject.java:55)
...
...
Caused by: net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node: /192.168.4.12:11210
        at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:157)
        at net.spy.memcached.internal.GetFuture.get(GetFuture.java:62)
        at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:997)
        ...30 more

这就是我创建客户端的方式。

List<URI> uris = new ArrayList<URI>();
        String[] serverTokens = getServers().split(" ");
        for (int index = 0; index < serverTokens.length; index++) {
            uris.add(new URI(serverTokens[index]));
        }
        CouchbaseConnectionFactoryBuilder ccfb = new CouchbaseConnectionFactoryBuilder();
        ccfb.setProtocol(Protocol.BINARY);
        ccfb.setOpTimeout(10000); // wait up to 10 seconds for an operation to
        // succeed
        ccfb.setOpQueueMaxBlockTime(5000); // wait up to 5 seconds when trying
        // to enqueue an operation
        ccfb.setMaxReconnectDelay(1500);
        CouchbaseConnectionFactory cf = ccfb.buildCouchbaseConnection(uris, bucket, "");
        CouchbaseClient client = new CouchbaseClient(cf);

我在Web服务器中维护一个持久客户端池。我们甚至没有触及仅设置为15的最大连接限制。 请帮助我解决这个问题。

0 个答案:

没有答案