I am ingesting millions of records into Elasticsearch and also extracting records from Elasticsearch. I am actually using Elasticsearch Java client. I am creating only one client on each JVM. Using this client, ingesting data into Elasticsearch and also extrating data from Elasticsearch using same. Extracted data writing into files and doing some analysing, again writing into files and ingestng data back into elasticsearch using.
Is this best way to create only one Java client on one JVM and keep it alive?
or create client when needed and ingest/extract data, close it.
Or create pool of clients and reuse it. (Like connection pooling)
What is the best way to do this ?
Its a really good question but based on my experience with really scalable and huge Elasticsearch systems, I have not seen more than one ES client in single JVM, these clients are singleton and thread-safe and for below reasons you should also stick to single ES client per JVM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With