djc/bb8

Support for pool creation with concurrent connections creation

bbigras opened this issue · 5 comments

The shitty SQL server/drive I use takes 15 seconds to connect.

With min_idle(Some(4)) it takes 1 minute to launch.

With min_idle(Some(1)) it only takes 15 seconds, but I would like to have 3 connections open asap.

Maybe it would be nice if all 4 connections were created at the same time, so it should take only 15 secs.

djc commented

So you can use build_unchecked()?

If I use build_unchecked(), I'm guessing the pool creation will not block at all and if I have to serve a request (with a short timeout) right away, the request would time out before the connection is established.

I'm guessing that I would want something like:

  • launch app
  • create pool with 4 min connections concurrently. block about 15 secs
  • serve readiness probe for k8s

So I guess my use-case would be to minimize the launch time, while having 4 ready connections when the readiness probe is ready.

djc commented

Okay -- want to submit a PR for something that does the initial pool setup in parallel?

Yep

bb8 is already creating the connections concurrently.

I just have to not block in my impl ManageConnection connect().

Did you know? 😆