snowflake-jdbc icon indicating copy to clipboard operation
snowflake-jdbc copied to clipboard

Use sendBatch() instead of sendBatchAsync().get()

Open Nandakumar-M opened this issue 3 years ago • 1 comments

In TelemetryClient.close(), sendBatchAsync().get() makes the TelemetryThreadPool do the work and current thread waits for it to complete.

When large number of threads are closing connections concurrently using sendBatchAsync().get(), the TelemetryThreadPool gets overloaded (max threads : 10) and this in turn makes SnowflakeConnectionV1.close() a bottleneck.

Instead, sendBatch() can be called directly on the same thread that is closing the connection.

Overview

SNOW-XXXXX

External contributors - please answer these questions before submitting a pull request. Thanks!

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR adressing? Make sure that there is an accompanying issue to your PR.

    Fixes #NNNN

  2. Fill out the following pre-review checklist:

    • [ ] I am adding a new automated test(s) to verify correctness of my new code
    • [ ] I am adding new logging messages
    • [ ] I am modyfying authorization mechanisms
    • [ ] I am adding new credentials
    • [ ] I am modyfying OCSP code
    • [ ] I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

Pre-review checklist

  • [ ] This change has passed precommit
  • [ ] I have reviewed code coverage report for my PR in (Sonarqube)

Nandakumar-M avatar Dec 22 '21 09:12 Nandakumar-M

Fixes #665

Nandakumar-M avatar Dec 22 '21 09:12 Nandakumar-M

@Nandakumar-M Please take action on this old PR or close it.

sfc-gh-igarish avatar Oct 20 '22 18:10 sfc-gh-igarish