TCP connection pool design advice
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- scala
- Domain
- networking
Research direction
Review the existing PoolTracer, ConnectionStore, TcpConnectionFactory, and ConnectionStoreSuite components described in the issue, then run the MUnit suite to understand the current pool behavior. The issue does not define a concrete implementation target; progress requires community agreement on HTTP support, the client-facing interface, and the state-management design.
Written by the indexing model from the issue text.
Description
problem
currently, several client libraries in the Typelevel ecosystem (like Ember, Skunk, and Rediculous) implement their own individual pooling logic for TCP connections. This leads to duplicated effort and inconsistent behavior across the ecosystem.
I am proposing TCP connection pool library designed specifically for these client libraries to share.i am seeking design advice from the community . my goal is to build a shared API that handles pooling, error conditions, and metrics consistently.
I have started the project using sbt new typelevel/typelevel.g8 and have built a basic connection pool that successfully holds connections.
Steps I have taken so far
1.PoolTracer: implemented a tracking mechanism using a trait and console logger to monitor real-time pool activity, such as additions, removals, and total available connections.
2.ConnectionStore: Built the core storage layer using cats.effect.Ref and Map .
3.TcpConnectionFactory: Created a factory to establish real fs2.io.net.Socket[IO] connections, demonstrating how the library integrates with the FS2 Network module.
4.ConnectionStoreSuite (Tests): Developed an MUnit test suite that verifies the logic using both dummy strings and real local TCP server sockets to prove the store can safely hold and retrieve active socket references.
Speaking more specifically about the connection pool, I need help from the community with these questions
1.can this pool support both HTTP/1.1 and HTTP/2?
2.What should the interface look like for client libraries to integrate with this pool?
3.What's the best internal state manager? internally, to manage the queue of waiting clients and idle connections, what is the most robust approach? Should we rely on cats.effect.std.Queue combined with Semaphore, or is a custom state machine backed by cats.effect.Ref and Deferred the better way to go for performance and fairness?
These are the immediate questions that came to my mind as I started building the core logic, and I would really appreciate the community's guidance on them. As the project progresses, I will definitely be looking for more feedback and help to ensure the pool's design perfectly aligns with the ecosystem.
- Dominant language
- Scala
- Stars
- 2.5k
- Forks
- 633
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typelevel/fs2
-
Reading from a socket gets stuck on Node.js 26Possibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
Unix socket bind may delete an existing file when binding failsPossibly taken @abhinav-phi claimed this 3 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 3 days
-
Scala Native TLSSocket#applicationProtocol behavior is inconsistent with JVMPossibly taken @reardonj claimed this 20 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
Maintainers usually reply within 3 days
-
Feature Proposal: report progress writing to socketsPossibly taken @reardonj claimed this 27 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 45/100
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 3 days
Similar issues
-
area:writer enhancement requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
apache/datafusion-comet#7463 ·
Maintainers usually reply within 2 days
-
v4 LSU does not mask TLB exceptions on miss: PTW refill causes Load Access Fault on M-mode loadOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
riscv-boom/riscv-boom#835 ·
-
Add a base64url Stringable helperPossibly taken @nafg claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nafg/simple-router#362 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
propensive/soundness#2351 ·
Maintainers usually reply within 1 day
-
Traffic event delivered/rejected counters appear swapped in TrafficStateController.updateWithReceiptOpen
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
digital-asset/canton#705 ·
Maintainers usually reply within 2 days