Can DataStax Java Driver be used safely in EE containers?

The documentation for the com.datastax.driver.core.Session class states that

(...) Each session supports several connections to cluster nodes (...)

However, general guidelines for EE environments are to leave the pool and flow control in the container.

It seems to me that the DataStax driver, which is not primarily focused on EE environments, violates this rule. This makes me worry if it is safe to use the driver in my EE application.

+6
source share
2 answers

I remember this advice. I think the old recommendation meant to emphasize that in most cases the application should not try to perform additional flow control for the container (the keyword here is โ€œcontainerโ€). Also messing up threads can lead to overuse of your server resources. In the days of single / double cores, this was very important.

In any case, today we have:

  • more cores
  • more applications using the asynchronous model

The DataStax driver allows you to configure the maximum thread pool size so you can keep it under control.

In conclusion, I believe that using the driver is enough. You can configure the thread pool according to the needs of your application and the resources of the server (s).

+5
source

The advantage of having multiple connections, regardless of environment, is that the Java client is a token. This means that he knows where the data is in the cluster, and therefore can run queries on the correct node, thereby avoiding unnecessary searches for other nodes for data that the node does not belong to. In addition, the client knows about the cluster and its state and can redirect unsuccessful requests to other nodes transparently. If you only support one connection to one machine, your application will distract requests naively.

+5
source

Source: https://habr.com/ru/post/958627/


All Articles