Closed srinisubramanian closed 3 years ago
Hi @srinisubramanian, java sdk is thread-safe. It means a single instance of immuClient can be used from multiple threads, such in this unit test: https://github.com/codenotary/immudb4j/blob/master/src/test/java/io/codenotary/immudb4j/MultithreadTest.java
immudb is thread-safe as well, so you can create a pool of client connections.
Please lets us know if you experience any issue or you need some guidance
Hi @jeroiraz
Thanks for the guidance.
From a performance standpoint what is recommended? A single ImmuClient or multiple?
Similar to the test thread eg., can login on a ImmuClient be done once and set/get called? Or each usage needs a login/logout pair?
Thanks. Excited to get this into our solution
Using multiple immuClients may boost performance given the grpc stub is blocking.
immudb is able to concurrently process transactions whenever possible, so having multiple clients concurrently submitting transactions result convenient and safe.
multiple operations can be requested as part of the same client session, no need to re-login, currently only it's needed to handle auth token expiration (60min duration).
Thanks @jeroiraz One last question. Will tge isConnected() method be a sufficient check if the authentication is valid? How does one determine if a reauthenticate is necessary?
Thanks
currently, it the operation will raise an exception and you may need to check if the token as expired. Some error refinement is still under progress
What is the recommendation for connection pooling using the Java SDK?
Can we have single instance of ImmuClient and login/logout multiple times? Is it threadsafe?
What is the recommendation for reuse in a Wildfly server environment. Web requests will result in data being populated in ImmuDb.