Hi All,
Before putting my actual question on performance I want to put below the server configuration and some details regarding our setup:
Couchbase server version: 3.0.1 Community Edition (build-1444)
Couchbase Java SDK version: 2.1
I have setup a Couchabse cluster of three nodes, with each node having the following or better configuration:
Cluster 1, Server 1,2,3:
Total Processor: Output from nproc is 8 and each having 2 cores, so in total its is a 16 core machine.
Total RAM: ~23 GB (shared with three other apps running in the same servers taking a total of less than 10GB)
No of Buckets: 1
Replication factor: 1
Couchbase bucket size: 1 GB
Number of documents in Couchbase: 191778 or less
RAM/Quota Usage: 197MB or less
Disk Usage: 169MB or less
All three nodes are in the same network in the same data center.
From this configuration my opinion is that even if I request a unique document everytime I should find it in the RAM all the time, I may be wrong here so please correct me.
For my testing purposes I setup a Jmeter on a 4th server and request a URL in our app deployed over mule with 64 threads configured to cater to HTTP requests in the same VM as Couchbase. The service on this URL has the only purpose to request a unique document everytime from Couchbse. And in the same service using JAVA System.currentTimeInMillis() method I record the difference in time before and after the couchbase call.
Jmeter starts 400 threads at a time and shoots them simultaneusly then waits for 2 minutes and again shoots those 400 threads with a loop count set to 10 i.e. total 4000 requests.
What I have noticed is that out of the total 4000 requests ~300 requests took more than 50ms ranging from 50ms to 260ms.
Please note that my intention was to find out how many requests are taking more than 50 ms as our application needs to respond within 500 ms of a client request where each request may have upto 6-8 couchbase requests.
So now my questions are:
What are Couchbase typical get times?
Is a single couchbase client(bucket) (we are using JAVA sdk) able to comprehand with 1000s of requests to Couchabse at a given time?
Is there anything simple that I am missing in my setup?
Are my expectaions from Couchabse too much for it to respond within 50ms everytime?
Following is my reference implementation:
public class CouchbaseTest implements Callable {
private static final Logger LOG = Logger.getLogger(CouchbaseTest.class);
private static final CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder().connectTimeout(ApplicationConstants.COUCHBASE_CLUSTER_CONNECTION_TIMEOUT).build();
private static final Cluster CLUSTER = CouchbaseCluster.create(env,Arrays.asList(ApplicationConstants.COUCHBASE_CLUSTER_IPS.split(",")));
public static final Bucket syncBucket = CLUSTER.openBucket(ApplicationConstants.COUCHBASE_BUCKET_NAME,ApplicationConstants.COUCHBASE_BUCKET_PASSWORD);
private static final AtomicLong impl1PrefixCount = new AtomicLong(1);
@Override
public Object onCall(final MuleEventContext context) throws Exception {
couchbaseGetImpl1();
return "success";
}
private void couchbaseGetImpl1() {
final String eventId = "impl1_" + impl1PrefixCount.getAndIncrement();
long methodCallStartTimeInMillis = System.currentTimeMillis();
getImpl1(eventId);
long timeTaken = System.currentTimeMillis() - methodCallStartTimeInMillis;
if(timeTaken > 50){
LOG.error("Implementation: 1,Thread Name: " + Thread.currentThread().getName()+"," + timeTaken);
}
}
private JsonDocument getImpl1(String documentId){
return syncBucket.get(documentId);
}
}
Any input would be much appreciated, please let me know if you need any more details regarding the same.