Skip to content

feat: rebalancing connection pooling #679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged

Conversation

fenos
Copy link
Contributor

@fenos fenos commented Apr 24, 2025

What kind of change does this PR introduce?

Feature

What is the current behavior?

Currently, storage opens 1 connection to the database for every request and tears it down once it ends

What is the new behavior?

  • Dedicated connection poolers for each tenant
  • The pools are torn down after 5 seconds of inactivity
  • starts with small pools and allows expanding the connection with additional pools to handle spiky traffic
  • rebalances the pool when container autoscale
  • Optional JWT caching

Additional context

Add any other context or screenshots.

@fenos fenos force-pushed the feat/rabalancing-pooling branch 5 times, most recently from 4c44932 to cb59fb7 Compare April 25, 2025 08:17
@fenos fenos force-pushed the feat/rabalancing-pooling branch 6 times, most recently from 03e43f5 to fa6e345 Compare April 30, 2025 14:21
)

- Supports async jwt signing/verification using libuv
- Add support for OKP (ed25519/Ed448) jwks
- Cleaner implementation across jwt code
@fenos fenos force-pushed the feat/rabalancing-pooling branch from fa6e345 to dc03884 Compare April 30, 2025 15:33
@itslenny itslenny mentioned this pull request Apr 30, 2025
@fenos fenos merged commit c3cbf2e into master Apr 30, 2025
1 check passed
@fenos fenos deleted the feat/rabalancing-pooling branch April 30, 2025 15:49
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14756882622

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 298 of 497 (59.96%) changed or added relevant lines in 16 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 77.871%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/config.ts 4 5 80.0%
src/internal/database/client.ts 9 10 90.0%
src/internal/database/connection.ts 14 17 82.35%
src/internal/concurrency/wait.ts 0 5 0.0%
src/internal/database/tenant.ts 31 50 62.0%
src/internal/cluster/ecs.ts 13 36 36.11%
src/internal/auth/jwt.ts 18 50 36.0%
src/internal/cluster/cluster.ts 15 53 28.3%
src/internal/database/pool.ts 167 244 68.44%
Files with Coverage Reduction New Missed Lines %
src/internal/database/client.ts 1 72.53%
Totals Coverage Status
Change from base Build 14753950118: -0.4%
Covered Lines: 16879
Relevant Lines: 21505

💛 - Coveralls

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.

None yet

4 participants