Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.3.9
-
None
-
None
Description
I have been benchmarking the Java client vs .NET client. During a rebalance, I see frequent pauses within the .NET client that greatly impacts overall throughput. These pauses are not seen in the Java client with equivalent code (gets). I've captured a 30 second video as well as a 30 second network capture, attached. It is connecting to a 3 node 2.5.1 cluster where I add or remove a node, and rebalance.
ASK: Why is the .NET client pausing for 10-15 seconds each minute during a rebalance?
http://screencast.com/t/kNyXkauaEPK3
Here is the relevant C# code, performing a GetWithCas with random keys in a loop:
private static void Main(string[] args)
{
var config = new CouchbaseClientConfiguration();
config.Bucket = "TestBucket";
config.Username = "";
config.Password = "";
config.SocketPool.MaxPoolSize = 20;
config.SocketPool.MinPoolSize = 20;
config.RetryCount = 10;
config.HeartbeatMonitor.Interval = 30000;
config.SocketPool.ReceiveTimeout = TimeSpan.FromMilliseconds(2500);
config.RetryTimeout = TimeSpan.FromMilliseconds(1000);
config.Urls.Add(new Uri("http://10.4.2.57:8091/pools"));
config.Urls.Add(new Uri("http://10.4.2.107:8091/pools"));
config.Urls.Add(new Uri("http://10.4.2.108:8091/pools"));
var Client = new CouchbaseClient(config);
// create threads to read random documents:
ParallelOptions parallelOptions = new ParallelOptions();
parallelOptions.MaxDegreeOfParallelism = 1;
Parallel.For((long)0, 1, parallelOptions, i =>
{
for (int j = 100071; j < 1000000; j++)
{
string key = "Couch_" + j.ToString();
var casVal = Client.GetWithCas(key);
if (casVal.Result != null)
}
});
Client.Dispose();
}
}
FYI, here is the corresponding Java code that does not paused during a rebalance:
public static void main(String[] args) throws Exception
{ new App().run(); } private void run() throws InterruptedException, ExecutionException {
int numThreads = 1;
ExecutorService pool = Executors.newFixedThreadPool(numThreads);
List<Future> fs = new ArrayList<Future>(numThreads);
for (int i=0; i<numThreads; i++)
for (Future f : fs)
{ f.get(); }}
private class Reader implements Runnable {
private int id;
private long runningTime;
public Reader(int id, long runningTime)
{ this.id = id; this.runningTime = runningTime; } @Override
public void run() {
long n=100071;
long start, end=0;
long initTime = System.currentTimeMillis();
List<URI> uris = null;
try
catch (URISyntaxException e)
{ e.printStackTrace(); } String bucketName = "TestBucket";
String result = "";
String password = "";
CouchbaseConnectionFactoryBuilder builder = new CouchbaseConnectionFactoryBuilder();
builder.setReadBufferSize(20000);
builder.setOpTimeout(2500);
builder.setFailureMode(FailureMode.Redistribute);
builder. setOpQueueMaxBlockTime(1000);
CouchbaseConnectionFactory connectionFactory = null;
CouchbaseClient client = null;
try
catch (IOException e)
{ e.printStackTrace(); } while (true) {
String key = "Couch_" + n;
start = System.currentTimeMillis();
if (client.gets(key) !=null)
{ System.out.println("N=" + n); } n++;
if (runningTime>0 && (end-initTime)>runningTime)
}
}
}