jnturton commented on code in PR #2698: URL: https://github.com/apache/calcite/pull/2698#discussion_r840530306
########## elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java: ########## @@ -53,6 +60,24 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ElasticsearchSchemaFactory.class); + // RestClient objects allocate system resources and are thread safe. Here, we + // cache them using a key derived from the hashCode()s of the parameters that + // define a RestClient. + private static Cache<Integer, RestClient> restClients = CacheBuilder.newBuilder() + .maximumSize(1000) Review Comment: @ILuffZhe the choices were just made conservatively (no one will connect to more than 1000 ElasticSearch servers and replacing each RestClient at most hourly will not amount to a great load. Testing a custom build of Drill based on a custom build of Calcite would be quite lot of effort for us so can I propose that a first PR just aims to stop the resource leaking? We can then monitor it for an extended period in one of our Drill environments and report back to you with our data if it looks like these parameters need fine tuning. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
