All Projects → djc → Bb8

djc / Bb8

Licence: mit
Full-featured async (tokio-based) postgres connection pool (like r2d2)

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Bb8

Rumqttd
rust mqtt broker
Stars: ✭ 77 (-73.17%)
Mutual labels:  asynchronous, tokio
Tk Listen
A library that allows to listen network sockets with proper resource limits and error handling
Stars: ✭ 27 (-90.59%)
Mutual labels:  asynchronous, tokio
Tokio Tungstenite
Tokio binding for Tungstenite, the Lightweight stream-based WebSocket implementation
Stars: ✭ 392 (+36.59%)
Mutual labels:  asynchronous, tokio
tsukuyomi
Asynchronous Web framework for Rust
Stars: ✭ 81 (-71.78%)
Mutual labels:  asynchronous, tokio
Tornado Sqlalchemy
SQLAlchemy support for Tornado
Stars: ✭ 112 (-60.98%)
Mutual labels:  asynchronous, database
Rdbc
Asynchronous database access for Scala and Java
Stars: ✭ 78 (-72.82%)
Mutual labels:  asynchronous, database
Reactivemongo
🍃 Non-blocking, Reactive MongoDB Driver for Scala
Stars: ✭ 825 (+187.46%)
Mutual labels:  asynchronous, database
Datastore
🐹 Bloat free and flexible interface for data store and database access.
Stars: ✭ 99 (-65.51%)
Mutual labels:  asynchronous, database
Coerce Rs
Coerce - an asynchronous (async/await) Actor runtime and cluster framework for Rust
Stars: ✭ 231 (-19.51%)
Mutual labels:  asynchronous, tokio
memsocket
An asynchronous in-memory socket-like interface for Rust
Stars: ✭ 34 (-88.15%)
Mutual labels:  asynchronous, tokio
React Native Mmkv Storage
An Efficient(0.0002s read/write), small & encrypted mobile key-value storage framework for React Native
Stars: ✭ 273 (-4.88%)
Mutual labels:  database
Django Querycount
Middleware that Prints the number of DB queries to the runserver console.
Stars: ✭ 280 (-2.44%)
Mutual labels:  database
Odbc
Connect to ODBC databases (using the DBI interface)
Stars: ✭ 285 (-0.7%)
Mutual labels:  database
Clearly
Clearly see and debug your celery cluster in real time!
Stars: ✭ 287 (+0%)
Mutual labels:  asynchronous
Liburkel
Authenticated key-value store (i.e. an urkel tree)
Stars: ✭ 280 (-2.44%)
Mutual labels:  database
Nodejs Restful Api
How to create a RESTful CRUD API using Nodejs?
Stars: ✭ 285 (-0.7%)
Mutual labels:  database
Trino
Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
Stars: ✭ 4,581 (+1496.17%)
Mutual labels:  database
Graphik
Graphik is a Backend as a Service implemented as an identity-aware document & graph database with support for gRPC and graphQL
Stars: ✭ 277 (-3.48%)
Mutual labels:  database
Awesome Distributed Deep Learning
A curated list of awesome Distributed Deep Learning resources.
Stars: ✭ 277 (-3.48%)
Mutual labels:  asynchronous
Technical Books
😆 国内外互联网技术大牛们都写了哪些书籍:计算机基础、网络、前端、后端、数据库、架构、大数据、深度学习...
Stars: ✭ 3,957 (+1278.75%)
Mutual labels:  database

bb8

Documentation Crates.io Build status codecov License: MIT

A full-featured connection pool, designed for asynchronous connections (using tokio). Originally based on r2d2.

Opening a new database connection every time one is needed is both inefficient and can lead to resource exhaustion under high traffic conditions. A connection pool maintains a set of open connections to a database, handing them out for repeated use.

bb8 is agnostic to the connection type it is managing. Implementors of the ManageConnection trait provide the database-specific logic to create and check the health of connections.

A (possibly not exhaustive) list of adapters for different backends:

Backend Adapter Crate
tokio-postgres bb8-postgres (in-tree)
redis bb8-redis (in-tree)
rsmq rsmq_async
bolt-client bb8-bolt
diesel bb8-diesel
tiberius bb8-tiberius
nebula-client bb8-nebula
memcache-async bb8-memcached
lapin bb8-lapin

Example

Using an imaginary "foodb" database.

fn main() {
    let manager = bb8_foodb::FooConnectionManager::new("localhost:1234");
    let pool = bb8::Pool::builder()
        .max_size(15)
        .build(manager)
        .unwrap();

    for _ in 0..20 {
        let pool = pool.clone();
        tokio::spawn(move || {
            let conn = pool.get().await.unwrap();
            // use the connection
            // it will be returned to the pool when it falls out of scope.
        })
    }
}

License

Licensed under the MIT license (LICENSE).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].