Skip to main content

High-performance database read acceleration layer for MongoDB. Auto-chunks and parallelizes queries across multiple-workers, streams results to parquet with intelligent caching and memory-bounded execution, option to stream data directly to any data lake. Same PyMongo API but dramatically faster results with RUST backend for CPU-heavy tasks.

Reason this release was yanked:

Build issue

Project description

XLR8 Logo

Accelerate MongoDB analytical queries with parallel execution and Parquet caching

Faster Queries → Less Memory → Real Savings

GitHub Python versions License

🦀 Rust-Backed · ⚡ Up to 4x Faster Queries · 📦 10-12x Compression · 📊 Configurable Memory Limits


Minimal Code Changes

# Before: PyMongo
df = pd.DataFrame(list(collection.find(query)))

# After: XLR8 - just wrap and go!
xlr8_collection = accelerate(collection, schema, mongodb_uri)
df = xlr8_collection.find(query).to_dataframe()

That's it. Same query syntax, same DataFrame output - just faster.


The Problem

When running analytical queries over large MongoDB collections, you encounter two fundamental bottlenecks:

I/O Bound: PyMongo uses a single cursor, fetching documents one batch at a time. Your CPU sits idle waiting for network round trips.

CPU/GIL Bound: Even with the data in hand, Python's Global Interpreter Lock (GIL) means BSON decoding and DataFrame construction happen on a single core.

These aren't PyMongo limitations - they're inherent to Python's design. XLR8 provides a solution.


How XLR8 Solves It

XLR8 releases Python's GIL and hands execution to a Rust backend powered by Tokio's async runtime:

  1. Query Planning → Splits your query into time-based chunks
  2. Parallel Workers → Multiple workers fetch from MongoDB simultaneously
  3. BSON → Arrow → Direct conversion without Python overhead
  4. Parquet Caching → Results cached for instant reuse
  5. DataFrame Assembly → Final merge via DuckDB (GIL-free)

The result? Your analytical queries run significantly faster, especially for large result sets.


Installation

pip install xlr8

XLR8 requires Python 3.11+ and includes pre-compiled Rust extensions for Linux, macOS, and Windows.


Quick Start

from pymongo import MongoClient
from xlr8 import accelerate, Schema, Types
from datetime import datetime, timezone, timedelta

# Connect to MongoDB
client = MongoClient("mongodb://localhost:27017")
collection = client["iot"]["sensor_readings"]

# Define your schema
schema = Schema(
    time_field="timestamp",
    fields={
        "timestamp": Types.Timestamp("ms", tz="UTC"),
        "device_id": Types.ObjectId(),
        "reading": Types.Any(),  # Handles int, float, string dynamically
    },
    avg_doc_size_bytes=200,
)

# Wrap collection with XLR8
xlr8_col = accelerate(collection, schema=schema, mongo_uri="mongodb://localhost:27017")

# Query like normal PyMongo
cursor = xlr8_col.find({
    "timestamp": {"$gte": datetime(2024, 1, 1, tzinfo=timezone.utc)}
}).sort("timestamp", 1)

# Get DataFrame - parallel fetch, cached for reuse
df = cursor.to_dataframe(
    chunking_granularity=timedelta(days=7),
    max_workers=8,
)

Key Features

Feature Description
🦀 GIL-Free Rust Backend Python's GIL is released. Rust's Tokio runtime handles async I/O across all cores.
Parallel MongoDB Fetching Queries split into time chunks. Each worker has its own MongoDB connection.
💾 Smart Query Cache Results cached by query hash. Filter cached data by date range.
🔀 DuckDB K-Way Merge GIL-free sorting across shards - O(N log K) complexity.
🐻‍❄️ Pandas & Polars to_dataframe() for pandas, to_polars() for Polars.
📊 Memory Control Set flush_ram_limit_mb to prevent OOM errors on large datasets.
📤 Stream to Data Lakes stream_to_callback() for S3/GCS ingestion pipelines.

Performance

Metric Improvement
Query Speed Up to 4x faster on large result sets
Compression 10-12x storage reduction with Parquet
Memory Configurable limits prevent OOM
Repeat Queries Instant from cache

Documentation

📖 Full documentation with architecture diagrams: GitHub Repository


License

Apache 2.0 - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlr8-0.1.4.tar.gz (138.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xlr8-0.1.4-cp313-cp313-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.13Windows x86-64

xlr8-0.1.4-cp313-cp313-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

xlr8-0.1.4-cp312-cp312-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.12Windows x86-64

xlr8-0.1.4-cp312-cp312-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

xlr8-0.1.4-cp311-cp311-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.11Windows x86-64

xlr8-0.1.4-cp311-cp311-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

xlr8-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file xlr8-0.1.4.tar.gz.

File metadata

  • Download URL: xlr8-0.1.4.tar.gz
  • Upload date:
  • Size: 138.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.4.tar.gz
Algorithm Hash digest
SHA256 767e14b3c98162c8855380a67b7abebc3323440980604faca38d549c6df2e01f
MD5 d960d9ec0027e1e6d4068a59688faf44
BLAKE2b-256 aa020a8439dfaa5e6f137aaf97ca4bbe61a32b97c2500ae48741ce24e26c1a5d

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 67e1ac4475c4ca901d82fc019128d6d93cb37a44af5352656abf1dde28af6f01
MD5 f885b629e7da00d8ecba11e359e03e52
BLAKE2b-256 55a8e8e9dd815517898e4a345a1bdcbdbe3ed60cebc84dfe531897a67d0a9eb2

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49953303912b91fad2b83aefe33bc9a4edb21cd3924c0c02dd0d440c5748e253
MD5 1754943e523b1fdf81c066d513e7a64d
BLAKE2b-256 e6436fa08b3f39ea119eb49699c3f95ca23468c4c7978ab9424320d6fddfe02d

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 653ec3747968143fa7c27f2bca36c52f41c01e738480fde84a5970087473d6e6
MD5 d2070fc685d8a2134b830893a0fcc690
BLAKE2b-256 5803d0e737e997594e8166220880b58f10889b0c9aa45b295333a3574bdcfd90

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 883f12f7b948467c394a7c2ce5b549ed008a590eb78c44aa74181660a3e5bce8
MD5 2e6f0b6640395295f26a2d37ee80db31
BLAKE2b-256 2506db76b075be7a8e0f2875952a4103d823f41a2f4b4690efaaab4f89b44dd2

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 52c40377ba92cd95f2f6f1359de2e8969656830d6274acd7a22743dc0a5d4e0d
MD5 f1f6bd95e4d7931b8418dc13cbf4d1bc
BLAKE2b-256 ceb006b4e3e51efa55827ba434e0d97c2a503fe9827783cdd8a7d0f764e2773c

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c9dd1f42635d7e27c375d711a09768af2019a105e515996994ffa77efdd77b5
MD5 59e6b17536291738c88a78ab14255faf
BLAKE2b-256 33ac5f339a2d0dddfa50bf4dcabbe7516581d142c345e0c6caf62559608c401a

See more details on using hashes here.

File details

Details for the file xlr8-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a431992b32e3443964f724a0770f816ca08a5c7e5836baca43393cc37996d0d8
MD5 b1487e5aede760240ec0bb59f7d3d403
BLAKE2b-256 756262f6042cd4d6377a6fe5a13ef4c2fda03266cb840ef4afd9e8e1dcdd995d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page