reqwest-drive
Work in Progress
High-performance caching, throttling, and backoff middleware for reqwest, powered by SIMD-accelerated single-file storage.
Overview
reqwest-drive is a middleware for reqwest-middleware that provides:
- High-speed request caching using SIMD R Drive, a SIMD-optimized, single-file-container data store.
- Adaptive request throttling with support for dynamic concurrency limits.
- Configurable backoff strategies for handling rate-limiting and transient failures.
Note: This is not WASM compatible.
Features
- Efficient single-file caching
- Uses SIMD acceleration for fast reads/writes.
- Supports header-based TTLs or custom expiration policies.
- Customizable throttling & backoff
- Control request concurrency.
- Define exponential backoff & jitter for retries.
- Seamless integration with
reqwest- Works as a
reqwest-middlewarelayer. - Easy to configure and extend.
- Works as a
Install
Usage
Basic example with caching:
use ;
use ClientBuilder;
use Path;
use Duration;
async
Throttling & Backoff
To enable request throttling and exponential backoff:
use ;
use ClientBuilder;
use Path;
use Duration;
async
Overriding Throttle Policy (Per Request)
To override the throttle policy for a single request:
use ;
use ClientBuilder;
use Path;
use Duration;
async
Configuration
The middleware can be fine-tuned using the following options:
Cache Policy
use Path;
use ClientBuilder;
use ;
use Duration;
let cache_policy = CachePolicy ;
let cache = init_cache;
// Configure `reqwest` client with `SIMD R Drive`-powered cache
let client = new
.with_arc
.build;
Throttle Policy
use Path;
use ClientBuilder;
use ;
let throttle_policy = ThrottlePolicy ;
// Creates two middleware agents
let = init_cache_with_throttle;
// Configure `reqwest` client with `SIMD R Drive`-powered cache and throttle/backoff support
let client = new
// Integrate `cache` middleware
.with_arc
// Integrate `throttle` middleware
.with_arc
.build;
Why reqwest-drive?
✅ Faster than traditional disk-based caches (memory-mapped, single-file storage container with SIMD acceleration for queries).
✅ More efficient than in-memory caches (persists data across runs without RAM overhead).
✅ Backoff-aware throttling prevents API bans.
License
reqwest-drive is licensed under Apache License, Version 2.0 LICENSE.