OpenBucket() extremely slow

I noticed that OpenBucket() call in my application has very slow response, it would take from a few seconds to dozens of seconds for OpenBucket() call to return. The following are highlights of my environment:

  • Couchbase 5.0.1 Community on Windows server 2008 R2
  • Couchbase.NetClient 2.5.9 on Windows 7
  • Memcached bucket. I cut down to just one node in the cluster and the slowness still exists.

The code that sets up connection to the bucket:

        var config = new ClientConfiguration
                Servers = servers.Select(p => new Uri($"http://{p.Host}:{(p.PortSpecified ? p.Port : 8091)}")).ToList(),
                ConfigPollEnabled = false,
                VBucketRetrySleepTime = 200,
                BucketConfigs = new Dictionary<string, BucketConfiguration>
                            cacheElement.BucketName, new BucketConfiguration
                                    Username = cacheElement.UserName,
                                    Password = cacheElement.Password,
                                    BucketName = cacheElement.BucketName,
                                    PoolConfiguration = new PoolConfiguration
                                            MaxSize = 10,
                                            MinSize = 2

        _cluster = new Cluster(config);
        _bucket = _cluster.OpenBucket(_bucketName);

In one test to took more than 25 seconds for OpenBucket to return:

[07/09/2018 16:32:24.950573] CouchbaseCache: OpenBucket…
[07/09/2018 16:32:50.657143] CouchbaseCache: OpenBucket done.

I have packet capture which shows shows lots of packets exchanged on port 11210. I’ll upload the file once I am allowed to upload.

New users are not allowed to upload files, so I had to put the packet trace file in the cloud:!AuD-2O_ZRWVilWHeESMkCdOI1UQ7

Looking at the I/O Graph in Wireshark there’s a lot of TCP errors - and indeed you can see a lot of retransmissions in the packet capture:

Suggest you check the health of your network.

(You could also try running the client on the same machine as the server to remove the physical network from the picture and see what effect that has).

1 Like

@wqiu -

Try doing this:

config.ConfigurationProviders = ServerConfigurationProviders.HttpStreaming;

It will bypass TCP bootstrapping which isn’t supported by Memcached buckets. It should shave off some time; the other part of the slowdown is caused by the MaxSize of the connections being created up front in later SDK versions. This is a side effect and will be improved in a later SDK release.


1 Like

Thanks! Both suggestions helped.

Just by moving the application into the same domain/subnet where Couchbase server resides, the response time was cut down to around 2 seconds. There are some segmentation mechanism between the domains which may have contributed to the massive re-transmissions.

Using Jeff’s suggestion of HttpStreaming provider, I was able to get the response time under 2 seconds with the application and Couchbase servers in separate domains.

1 Like