Getting low TPS, when doing high number of concurrent Reads

I have an API in .net where I am returning a couchbase document. In every one request I am trying to read 100 docs, but I am not able to get more than 20 TPS. Similar API in JAVA is easily giving more than 150 TPS.

I am using .net SDK version 2.4.8, the configuration I am using is











Code to read documents

private IList<CouchbaseDataResult> Get(IList keys, string guid)
{
var parellelOptions = new ParallelOptions {MaxDegreeOfParallelism = 4};
var operationResult = _bucket.Get(keys,parellelOptions);
var result = BuildResult(operationResult);
return result;
}

I also tried using MUX, but don’t see any difference in performance
Can somebody tell if there is something wrong in the configuration or code

@shaurya -

I would suggest using the async API instead, something like this:

private async IList<CouchbaseDataResult> Get(IList keys)
{
    var operationResult = await _bucket.GetAsync(keys).ConfigureAwait(false);
    var result = BuildResult(operationResult);
    return result;
}

Note that the overloads for Get<T>(List<string> keys) has been deprecated in SDK 2.5.0.

-Jeff

@jmorris

Thanks for your suggestion, i used async method and was able to get the required TPS. Below is the code I used

  private List<CouchbaseDataResult<T>> GetAsync<T>(IList<string> keys)
 {
     var operationResultList = keys.Select(key => _bucket.GetAsync<T>(key)).ToList();
     Task.WhenAll(operationResultList);
     return BuildResult(operationResultList);
 }
1 Like