How to use Aerospike Java client in a web application?


#1

We have an Aerospike cluster that consists of 3 nodes. I need to write a Java library that will be used by our web application to read data from Aerospike. The closest example/documentation that I found is this: https://github.com/aerospike/aerospike-client-java/blob/master/servlets/src/com/aerospike/servlets/AerospikeServlet.java

But I don’t see a connection pool in this example. So I’m confused how to implement this library. For example, I think that the library should receive as a parameter an Aerospike connection from whatever context is using it. So the web application (which runs on Tomcat and uses Spring) should be maintaining an Aerospike connection pool I’m assuming?

Can I get help?


#2

Hi,

Another example of using Aerospike in a Java Spring web application is here https://github.com/aerospike/build-restful-web-service-with-spring-boot

The BIG difference with Aerospike and every other data source that you are use to is that id does not need a connection pool.

Only one instance of AerospikeClient is needed per process, it is fully thread safe and it has its own optimized pool of worker threads.

I hope this helps.

regards Peter