Skip to content

feat: add connection pooling infrastructure for future features#1

Merged
inureyes merged 3 commits intomainfrom
feature/connection-pooling
Aug 21, 2025
Merged

feat: add connection pooling infrastructure for future features#1
inureyes merged 3 commits intomainfrom
feature/connection-pooling

Conversation

@inureyes
Copy link
Member

Summary

This PR adds a connection pooling module as infrastructure for future features. After thorough analysis, connection pooling provides no benefit for bssh's current one-shot execution model, but the infrastructure is added for future interactive features.

Changes

  • Add ConnectionPool module (src/ssh/pool.rs) as placeholder implementation
  • Export pool module from src/ssh/mod.rs
  • Document pooling design decision in ARCHITECTURE.md
  • Include unit tests for the pool API

Analysis Results

Connection pooling is not beneficial for current usage because:

  • Each CLI invocation executes exactly one operation per host then terminates
  • No scenarios exist where connections would be reused within a single execution
  • The async-ssh2-tokio Client type doesn't support cloning or connection reuse

When Pooling Would Help

The infrastructure will be useful when implementing:

  • Interactive shell mode with persistent sessions
  • Watch mode for periodic command execution
  • HTTP API server mode
  • Batch command execution from files
  • Command pipelining on the same hosts

Implementation Details

  • Pool is disabled by default (no performance overhead)
  • Provides complete API surface for future activation
  • Always creates new connections in current implementation
  • Includes proper documentation explaining the limitations

Testing

  • Added 3 unit tests verifying pool behavior
  • All tests pass successfully
  • No impact on existing functionality

Recommendation

Focus on more impactful optimizations like:

  • Connection timeout tuning
  • SSH compression for large outputs
  • Buffered I/O optimizations
  • Parallel DNS resolution

- Implement ConnectionPool module as placeholder for future use
- Add analysis showing pooling provides no benefit for current usage
- Document design decision in ARCHITECTURE.md
- Include unit tests for pool API surface
@inureyes inureyes self-assigned this Aug 21, 2025
@inureyes inureyes added the type:enhancement New feature or request label Aug 21, 2025
@inureyes inureyes merged commit 9bef6eb into main Aug 21, 2025
1 check failed
@inureyes inureyes added priority:low Low priority issue status:done Completed feature labels Sep 9, 2025
@inureyes inureyes deleted the feature/connection-pooling branch October 30, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:low Low priority issue status:done Completed type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant