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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

xlr8-0.1.3-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.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f7ca363bbb5ce942d68a7fb951458cfa26267c57e39b61366491fcc53baa5292
MD5 4428d055cff2510ad894c44eb7cb2036
BLAKE2b-256 6410e91a25c039aad860e2fa42b872c425c7a7fa251b2a5ded84ab226ab3702d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xlr8-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e38dfe9ebd74d6ccd8ed1060660ac57b9f3326aedb0ca513cff8016c2e30580
MD5 20da47add72410f0c13ecfeaa63b3796
BLAKE2b-256 9cf012e5ae1c9c2193a107d9c3934ac57667ddb70f07e4d04305595e358a5cd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xlr8-0.1.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fe743a9bb6f0ffcf1d6b28cf36e31b8bdd4a87c80d8bba89321b4bfd0536f5bc
MD5 e369d68da793d1ef014e2210a33f32a0
BLAKE2b-256 21cb0fee64590f1afa1307c8e10792a97318a18540b7e650c69c040c18fe87b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xlr8-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49c0a4590f468bfb574565285d361971cd4c37dfabdc3ab80eadd26428f4af34
MD5 f8099278eefe6a300d190616c53ec887
BLAKE2b-256 78d8646c49bf9d14fa93f7bbe951329ddcbb69beca657eba3e0f743b12ea9afb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xlr8-0.1.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dc0121488c8267c803ebe79cd09fde4e2878c6e5dd6c2e4ab1c7f9a6a243f93c
MD5 380dc0474dd7e6903fc0b7b3b845080e
BLAKE2b-256 66ad83911b1149a0723f610458e64cc1d6476de73d9e0f42a720546c1e9d67ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xlr8-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16afd7da3620aa246a7156fbc4205c38752cef63eca515aa57ff0fd1334fc0bd
MD5 9d634b0a93b03412807806ad4df9fd5f
BLAKE2b-256 940082bbbcc362e08690f8f5fcf2fc65daf3af5a0ca9d893af4322df692d4fd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xlr8-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 836994769fd332bfb4e1a872ff3599ecaa274332b294846a3b7f1c5fc40c945f
MD5 f7d0b5053a3db7e6e1a42bc0903c605f
BLAKE2b-256 6d92caf381eb694efbf75fe1f3106d1976fba0538a74ab5148c85cbbbd07a5cd

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