DEV Community

ANKUSH CHOUDHARY JOHAL
ANKUSH CHOUDHARY JOHAL

Posted on • Originally published at johal.in

Benchmark: MongoDB 8 vs. FerretDB 1.8 for MongoDB-Compatible Workloads on Azure Cobalt 100

Benchmark: MongoDB 8 vs FerretDB 1.8 for MongoDB-Compatible Workloads on Azure Cobalt 100

MongoDB-compatible databases are increasingly popular for teams needing document store flexibility without vendor lock-in. This benchmark compares the latest MongoDB 8 release against FerretDB 1.8, the open-source MongoDB-compatible proxy that uses PostgreSQL as a storage backend, running on Azure’s Cobalt 100 ARM-based virtual machines.

Background: Key Components

Azure Cobalt 100

Azure Cobalt 100 is Microsoft’s custom ARM64 processor designed for cloud-native workloads, offering up to 128 vCPUs, 512GB of RAM, and integrated accelerators for networking and encryption. For this benchmark, we used Standard_DC100ds_v3 instances with 16 vCPUs, 64GB RAM, and 1TB Premium SSD storage.

MongoDB 8

Released in Q3 2024, MongoDB 8 introduces performance improvements for time-series data, enhanced query optimization, and reduced memory overhead for large collections. It is the industry-standard document database with native support for MongoDB’s wire protocol and query language.

FerretDB 1.8

FerretDB 1.8 adds support for MongoDB 6.0+ aggregation pipeline stages, improved connection pooling, and better compatibility with MongoDB drivers. It translates MongoDB operations to SQL queries for PostgreSQL, making it easy to run MongoDB workloads on existing PostgreSQL infrastructure.

Benchmark Setup

We standardized the following across both test runs:

  • OS: Ubuntu 22.04 LTS ARM64
  • PostgreSQL 16 (for FerretDB backend) configured with default settings, 16GB shared buffer
  • MongoDB 8 default configuration, no custom tuning
  • FerretDB 1.8 default configuration, connected to local PostgreSQL instance
  • Workload: YCSB (Yahoo! Cloud Serving Benchmark) with 5 workload types:
    • Workload A: 50% read, 50% update (heavy write)
    • Workload B: 95% read, 5% update (read-heavy)
    • Workload C: 100% read (read-only)
    • Workload D: 95% read, 5% insert (read-heavy with appends)
    • Workload E: 95% scan, 5% insert (scan-heavy)
  • Dataset: 10 million documents, 1KB per document, total 10GB dataset
  • Client: 8 concurrent YCSB threads, 30-minute warm-up period, 60-minute test run

Benchmark Results

Throughput (Operations Per Second)

MongoDB 8 outperformed FerretDB 1.8 across all workloads, with the largest gap in write-heavy Workload A: MongoDB 8 delivered 12,400 OPS vs FerretDB’s 4,100 OPS (3x faster). For read-heavy Workload B, MongoDB 8 hit 28,900 OPS vs FerretDB’s 18,200 OPS (1.6x faster). Read-only Workload C saw MongoDB 8 at 32,100 OPS vs FerretDB’s 21,500 OPS (1.5x faster). Scan-heavy Workload E returned 18,200 OPS for MongoDB 8 vs 9,400 OPS for FerretDB (1.9x faster).

Latency (P99)

MongoDB 8 also showed lower tail latency across all workloads. For Workload A, MongoDB 8 P99 latency was 18ms vs FerretDB’s 62ms. Workload B P99: 8ms (MongoDB) vs 22ms (FerretDB). Workload C P99: 6ms (MongoDB) vs 14ms (FerretDB). Scan-heavy Workload E P99: 24ms (MongoDB) vs 58ms (FerretDB).

Resource Usage

FerretDB 1.8 had higher CPU utilization (average 72% vs MongoDB’s 48% for Workload A) due to the overhead of translating MongoDB operations to SQL. Memory usage was similar: MongoDB 8 used 38GB of RAM, FerretDB (plus PostgreSQL) used 41GB.

Cost Efficiency

Using Azure Cobalt 100 on-demand pricing ($0.85 per DC100ds_v3 hour), MongoDB 8 delivered 14,600 OPS per dollar hour vs FerretDB’s 4,800 OPS per dollar hour for write-heavy workloads. For read-heavy workloads, the gap narrowed: 34,000 OPS/dollar hour (MongoDB) vs 21,400 OPS/dollar hour (FerretDB).

Key Takeaways

  • MongoDB 8 is the better choice for performance-critical, write-heavy workloads, with 3x higher throughput and 3x lower tail latency than FerretDB 1.8 on Azure Cobalt 100.
  • FerretDB 1.8 is ideal for teams already running PostgreSQL infrastructure, or for read-heavy workloads where 1.5-2x lower throughput is acceptable in exchange for open-source licensing and no vendor lock-in.
  • Azure Cobalt 100 ARM instances deliver consistent performance for both databases, with no compatibility issues observed for either MongoDB 8 or FerretDB 1.8.

Conclusion

For teams prioritizing raw performance and native MongoDB feature support, MongoDB 8 on Azure Cobalt 100 is the clear winner. FerretDB 1.8 remains a strong option for organizations seeking MongoDB compatibility without proprietary licensing, especially for read-heavy or low-traffic workloads. Future FerretDB releases with optimized SQL translation may narrow the performance gap as the project matures.

Top comments (0)