1

A Tomcat server worker thread replying to an incoming request must access at least one of several possible cloud API services (Google Cloud Storage in particular; non-modifying, that is, only performing Reads). Tomcat offers out-of-the-box pooling for JDBC and JNDI compatible DB's and services. What is the best strategy for pooling connections to multiple cloud services to be shared across worker threads?

ChaimKut
  • 2,759
  • 3
  • 38
  • 64

2 Answers2

1

Your application access API over HTTP(S). The connection pooling must be performed at HTTP Client level.

If you're using Apache HTTPClient, there are examples of usage of pool.

Setop
  • 2,262
  • 13
  • 28
1

As you mentioned Tomcat allows defining JDBC/JNDI resources that can be used by web applications. If there is a JDBC driver available for the service you want to use then you can use the same approach. For example, a quick search for GCS JDBC driver returns this.

For pooling, you could define HikariCP as a tomcat resource and configure it to connect to GCS using the third-party driver using the driverClassName property.

Alternatively, applications can use the HTTP-based SDKs that cloud providers usually make available.

andrebask
  • 774
  • 1
  • 7
  • 18
  • how does this answer to the need of **pooling** the connections ? – Setop Feb 09 '23 at 11:43
  • For pooling, you could define [HikariCP as a tomcat resource](https://liferay.dev/blogs/-/blogs/tomcat-hikaricp) and configure it to connect to GCS using the third-party driver using the `driverClassName` property. – andrebask Feb 09 '23 at 18:45