Timeouts with .NET Couchbase Client

We’ve been having issues for quite awhile with the .NET Membase Client we use in our web service often timing out when storing some login details in Couchbase. The timeout is set to 10 seconds, which seems fairly high given it’s only 8KB or so of data being sent. Originally I thought the issue may have been with the Couchbase server, but it’s very under-utilised, and updating it to the latest version didn’t help anything. I also tried using the CouchbaseClient instead of the MembaseClient, but this didn’t help either. After trying quite a few things and going a little crazy I managed to track the issue down to the client instance being a static variable that only gets initialised when it’s first accessed. I tried creating a new instance every time it gets used, and haven’t had any timeout issues since. But, I know that creating a new instance for each request is very inefficient because we’re not taking advantage of connection pooling. I’ve looked through some tutorials and in those they use a static couchbase client… so I’m not really sure what the issue could be. Note that when we do use a static client a good number of the communications don’t time out, but then it will all of a sudden timeout about three times in a row, then the next attempt will be fine.

Any ideas?

Nieldy -

What version of the client are you using? What about the server? Can you describe your cluster configuration and your client (Web server/service) configuration? Can you enable logging and provide a log file?

This could also be caused by something network related.

The preferred way of using the client is as a long-lived static variable that is created when the process is created and destroyed when the process is shutdown. If you could provide a sample project illustrating the issue, that would help as well.


Thanks for the reply Jeff,

There are two server nodes, both installed on CentOS and both version 2.2.0 Enterprise Edition (build-821-rel). I only updated this recently, but it made no difference to the timeouts. There are seven buckets, and this issue is happening storing Json data in one of those buckets. The resources on the servers are more than sufficient to deal with the very low Couchbase usage we have. E.g., each server has 64GB RAM, and between them they are storing 322MB data in all the buckets combined.

The .NET client library is Enyim.Caching v2.8.0.0 and Membase v2.11.0.0. I realise the client is pretty old now, but I did try changing to the latest Couchbase (not Membase) client (i.e. from https://github.com/couchbase/couchbase-net-client), but that didn’t help anything.

We never have any timeout issues if we re-create an instance of the Couchbase client for each request, so I don’t think the issue would be related to the network connection to the Couchbase servers.

The settings we use for the Membase client connection are -

I think it would be difficult to reproduce this issue with a sample program, because it rarely happens outside of our production environment.

What logging would you like to see? On the server-side or from the client? We don’t currently have logging set up from the Membase client.

Thanks again,


Nieldy -

Here is some information for enabling logging: http://docs.couchbase.com/couchbase-sdk-net-1.3/#appendix-configuring-logging

Without a stacktrace, it’s pretty much impossible to diagnose what is causing the timeouts. I would use a file appender and log to a file and set the verbosity to ERROR so we just capture exceptions.

Also, I would stay up to date and use the latest supported client drivers. These can be found either on Nuget or on the “Current Releases” on the left hand column of this page. As of today the latest supported version is https://packages.couchbase.com/clients/net/1.3/Couchbase-Net-Client-1.3.3.zip.

Note that what is on github is not QA verified and is largely a work in progress (towards the net release), so using in a production environment is not suggested.