Skip to content

Reuse a Faraday client per Trino::Client instance - #168

Open
p623 wants to merge 7 commits into
treasure-data:masterfrom
p623:reuse-faraday-connection
Open

p623 wants to merge 7 commits into
treasure-data:masterfrom
p623:reuse-faraday-connection

Conversation

@p623

@p623 p623 commented Sep 16, 2026

Copy link
Copy Markdown

Purpose

Reuse a single Faraday HTTP client for each Trino::Client instance.

Currently, query operations create a new Faraday client for each request.
Reusing the client reduces connection and TLS handshake overhead and enables HTTP keep-alive with a compatible Faraday adapter.

This PR is based on the idea and implementation proposed in #137. Since that PR has not been updated for over a year, this PR provides a fresh implementation for the current codebase with expanded test coverage.

Thank you to @redox for the original proposal and implementation.

Overview

  • Reuse one Faraday client per Trino::Client instance
  • Set query-specific HTTP headers for each request
  • Preserve the existing behavior of query operations
  • Add extensive tests for client reuse and request-specific behavior
  • Update the implementation for the current codebase

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

@p623
p623 marked this pull request as ready for review September 17, 2026 08:37
@p623
p623 requested a review from a team as a code owner September 17, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant