Giter VIP home page Giter VIP logo

Comments (3)

khuey avatar khuey commented on May 29, 2024

Hi,

I am running a small backend with Hyper, I was investigating this library to have an async threadpool.

I was wondering what's the difference between bb8 and bb8-postgres.

bb8 is the backend-agnostic parts of the library, and bb8-postgres contains the postgres specific parts. bb8 is not usable on its own.

Also, I join the others in asking a bit more documentation and examples (tokio itself is a bit hard to grasp for newbies). The example for Postgres looks like to rely on unreleased version of the library.

Anything in particular that's confusing to you?

tokio-postgres unfortunately has not done a real release on crates.io for almost 2 years so that part is somewhat unavoidable.

EDIT: also, do you have plans to push forward the development of the tokio-based branch of bb8 (now that async-std is out)?

I plan to continue depending on whatever the rust-postgres folks are depending on which I expect to remain tokio for the forseeable future.

from bb8.

apiraino avatar apiraino commented on May 29, 2024

Hi, thanks for the reply.

Anything in particular that's confusing to you?

Basically two things.

  1. As I mentioned, not being able to build bb8 without using a stable / released version of bb8 itself. The examples depend on a bb8 path that points to the master branch (0.3.2-pre) which is not released.
    Now, I could clone the repo, build locally bb8, build my backend against that, but I don't feel comfortable pushing to a production environment such a hacked build workflow (or perhaps I'm missing something). I would love to be able to try bb8 with a simple $ cargo add bb8 bb8-postgres. Should I stick to 0.3.1 for the moment? A bare README file mentioning gotchas would be surely appreciated.

  2. The hyper example looks (to my newbie eyes) a bit barebone in that there is no decoupling of server setup and the DB pool code. In a more real-life example, I would start Hyper passing it a Service that could manage a single request or act as a router for multiple endpoints. In this scenario, would you suggest passing to service_fn() the whole DB pool or just a connection? Again, here's an example of what I mean.

tokio-postgres unfortunately has not done a real release on crates.io for almost 2 years so that part is somewhat unavoidable.

I see. I also see there's a 0.4.0rc in the works recently, perhaps we're not far from a new release.

In the end, for the time being, I took a slightly different approach. I'm using the sync r2d2 threadpool and passing it on to any Future that needs a DB connection: some notes about that here.

As I'm trying to figure out the whole async perf advantages scenario and whatnot, I'm not sure whether using bb8 (or any async threadpool, for the matter) would give me significant advantages. I'd need some bench or real life cases before.

from bb8.

apiraino avatar apiraino commented on May 29, 2024

closing because there's nothing actionable here. Will try the new release

from bb8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.