I'm seeing occasional pauses/hangs that last a few seconds each when sending data to Elastic via the Java BulkAPI. They are happening frequently, sometimes every few seconds. I'm not sending nearly enough data that I would imagine the elastic nodes to hang they way they are. I'm sending at most 480 documents at once spread over 12 different Java threads. The documents are small too, only a few KB each. The end goal being to send tens of thousands of documents via looping in pieces.
Pseudo code looks like this, again spread across 3 different application servers each with 4 threads performing this same chunk of code at the same time...
BulkRequestBuilder bulkRequestBuilder = client.prepareBulk();
for (...) {
IndexRequestBuilder indexRequest = // create new index request builder
indexRequest.setSource(somedata);
bulkRequestBuilder.add(indexRequest);
}
bulkRequestBuilder.get();
Is there anything in my configuration that looks wrong or might account for the hiccups? I would expect these calls to only take a few milliseconds each, and often they do, but then other times with the pauses they all get stuck together and might freeze for 5-10 seconds, at which point they all finish together.
Profiling with JVisualVM I see that Elastic is spending a lot of time stuck in BaseFuture$Sync.get() during the pauses.
Thanks for any help!
Webapp Environment: 3 tomcat nodes, each with 4 worker threads sending data (so 12 total)
Elastic Environment: 3 node cluster (all nodes master/data eligible), each with 8GB RAM and 4 CPUs
Elastic Version: 5.0.2