deadpool

Dead simple async connection and object pool for Rust

Library
Cargo
v0.13.1
1,330 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
77 /100 Good
Development Activity 88
Maintenance 44
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 80
Code Quality 82
Innovation 72
Learning Curve 68

Deadpool is a generic async object and connection pool for Rust, offering both a managed pool (deadpool::managed::Pool) that creates and recycles objects on demand, and an unmanaged pool (deadpool::unmanaged::Pool) for pooling pre-created objects. It’s runtime-agnostic by default and adds optional Tokio, async-std, or smol support only when timeout functionality is needed.

The deadpool-rs org builds on this core crate with ready-made backends for popular services — deadpool-postgres, deadpool-redis, deadpool-sqlite, deadpool-diesel, deadpool-lapin, and others — each implementing the Manager trait to recycle connections for that specific client library. This makes deadpool the shared foundation most Rust database/service connection pools in the ecosystem are built on top of.

What You Get

  • A managed Pool<M: Manager> that creates and recycles objects via a user-implemented Manager trait
  • An unmanaged Pool for holding pre-created objects with no creation/recycling logic
  • Pluggable async runtime support (Tokio, async-std, smol) enabled only via opt-in rt_* features
  • Pre/post hooks for custom checkout/recycle behavior, plus timeout and queue-mode configuration
  • Serde support for deserializing pool configuration from config files or environment variables

Common Use Cases

  • Pooling database connections for Postgres, SQLite, or MySQL via the deadpool-postgres/deadpool-sqlite/deadpool-diesel backend crates
  • Pooling Redis connections via deadpool-redis for caching and pub/sub workloads
  • Pooling AMQP/RabbitMQ channels via deadpool-lapin for message-queue producers/consumers
  • Building a custom pool for any expensive-to-create resource (HTTP clients, gRPC channels) by implementing the Manager trait directly

Under The Hood

Architecture - The core crate (crates/deadpool/src/) splits into managed/ and unmanaged/ modules behind separate feature flags. The managed pool (managed/pool.rs) wraps an Arc<PoolInner<M>> guarded by a tokio::sync::Semaphore for checkout concurrency control, with Object<M> (managed/object.rs) wrapping the pooled value plus metadata and a DropGuard (managed/dropguard.rs) that returns objects to the pool automatically on drop. Manager (managed/manager.rs) is the trait downstream crates (deadpool-postgres, deadpool-redis, etc.) implement to define how their specific connection type is created and recycled, making deadpool a policy layer over a caller-supplied resource lifecycle.

Tech Stack - Pure Rust (93% of the repo by bytes), edition 2024, minimum Rust 1.85, with #![forbid(unsafe_code)] declared in the README badge. Depends non-optionally on tokio::sync::Semaphore for the checkout primitive, but keeps full Tokio runtime features, async-std, and smol behind separate opt-in rt_* feature flags so non-Tokio users aren’t forced to pull in the full runtime. The repo is a Cargo workspace (crates/) housing the core crate alongside ten sibling backend crates.

Code Quality - The deadpool crate has 11 files under tests/ covering managed/unmanaged pool behavior, plus Criterion benchmarks (benches/managed.rs, benches/unmanaged.rs) for performance regression tracking. CI is defined via a shared Jsonnet template (ci.jsonnet) generating per-crate GitHub Actions workflows, and a check-reexports.sh script guards against accidental API drift across the workspace’s many crates.

API Design - The Manager trait’s two required methods (create, recycle) are the only things a new backend needs to implement to gain a fully-featured async pool, which is why the ecosystem has ten-plus deadpool-* backend crates built on this core. The managed/unmanaged split, opt-in runtime features, and hook system (pre/post-checkout) add real configurability but also mean new users must pick the right feature combination up front — the README’s feature table exists precisely to guide that choice.

Used by 6 apps in this directory

TypeScript
64%
Apache 2.0

Laminar

AI Development · Monitoring

3,285

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 64%
Rust 34%
Updated 5 days ago
Rust
78%
AGPL 3.0

Lemmy

Community · Social Media

14,614

Federated, self-hosted Reddit alternative with full community ownership and no corporate control.

View details
89
Repo Health
74
Technical
62
Dependency
Built with
Rust 78%
PLpgSQL 14%
Updated 1 weeks ago
Rust
98%

Stalwart

Collaboration

14,848

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 5 days ago
Rust
98%

Stalwart

Collaboration

14,848

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 5 days ago
Rust
47%
MIT

Svix

Automation · Developer Tools

3,423

Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.

View details
90
Repo Health
77
Technical
67
Dependency
Built with
Rust 47%
C# 15%
Updated 1 weeks ago
TypeScript
67%
Apache 2.0

tabularis

Databases · Developer Tools

5,076

Open-source desktop SQL workspace with built-in PostgreSQL, MySQL, and SQLite drivers, SQL notebooks, a visual query builder, and a built-in MCP server for AI agents like Claude and Cursor.

View details
83
Repo Health
89
Technical
70
Dependency
Built with
TypeScript 67%
Rust 32%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers