Skip to content
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

Implement client connection pooling #1479

Closed
jdegoes opened this issue Sep 15, 2022 · 0 comments · Fixed by #1493
Closed

Implement client connection pooling #1479

jdegoes opened this issue Sep 15, 2022 · 0 comments · Fixed by #1493
Assignees
Labels
enhancement New feature or request

Comments

@jdegoes
Copy link
Member

jdegoes commented Sep 15, 2022

Is your feature request related to a problem? Please describe.

The performance of the Http client can be improved through connection pooling.

Describe the solution you'd like

Connection pooling is easier to implement with a keyed pool, which ZIO 2 does not yet support.

We can build a ZKeyedPool here and upstream to ZIO 2 later:

trait ZKeyedPool[+Error, -Key, Item] {
  def get(key: Key)(implicit trace: Trace): ZIO[Scope, Error, Item]

  def invalidate(item: Item)(implicit trace: Trace): UIO[Unit]
}
object ZKeyedPool {
  def makeWith[K, R, E, A](get: K => ZIO[R, E, A], total: => Range, maxPerKey: => Int)(implicit trace: Trace): ZKeyedPool[E, K, A] = ???
}

Then we can utilize this connection pool in the implementation of Client to ensure that we have ready-to-use connections to common targets.

Describe alternatives you've considered

None.

@jdegoes jdegoes added the enhancement New feature or request label Sep 15, 2022
@vigoo vigoo self-assigned this Sep 15, 2022
@vigoo vigoo mentioned this issue Sep 17, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants