When operating at scale, even a highly optimized MongoDB deployment can face pressures during peak traffic. In this controlled exercise, we set out to systematically evaluate how different network compression algorithms impact CPU utilization, throughput, and bandwidth consumption under realistic production workloads.
By recreating ingest-heavy, read-dominant, and mixed traffic patterns on MongoDB Atlas and benchmarking seven compression configurations, we uncovered tradeoffs between compute overhead and network efficiency. The findings not only quantify the impact of each compression algorithm but also identify a compression strategy that delivers consistent throughput, resource utilization, and the scalability needed to sustain demanding production workloads.
Compression testing framework
This section describes the framework used to evaluate the impact of different MongoDB network compression algorithms on CPU utilization and network efficiency. It outlines the workload generation methodology, test scenarios, and compression configurations used throughout the performance study.
Workload simulation and compression testing
The test workload generated significant database activity during defined execution windows, characterized by high ingest and query volumes. To simulate production-like behavior, controlled performance tests were conducted using the Java POC Driver, mimicking real workload activity patterns.
During the workload simulation, performance testing leveraged generated data with an average document size of ~51 KB, chosen to reflect realistic operational records. This size strikes an ideal balance between practical production data and optimal database performance, avoiding excessive resource consumption or latency often associated with larger document sizes.
The simulation revealed that three distinct workload patterns were designed to analyze the behavior of the MongoDB Atlas cluster under compression-focused scenarios:
100% ingests
100% reads
Mixed reads and writes (50:50)
Compression configurations assessed
Compression effects were studied across seven network configurations, each targeting different tradeoffs between network efficiency and CPU utilization:
None (baseline comparison)
Snappy
zstd
zlib-0
zlib-3
zlib-6
zlib-9
This simulation aimed to push the Atlas cluster to realistic operational limits to accurately quantify the impact of compression on CPU overhead, network throughput, and overall system behavior.
Environments
This POC engagement was executed on MongoDB Atlas to evaluate compression behavior under controlled workload simulations.
The EC2 environment was a Virtual Private Network-peered with the Atlas cluster, ensuring private connectivity, eliminating public internet variability, and enabling consistent throughput and latency measurements throughout testing.
The workload framework was driven using the internal tool. This tool was used to generate controlled ingest and read/write activity, configure document sizing, and execute repeatable compression benchmarks across multiple test scenarios to measure CPU and network tradeoffs.
Goals of this exercise
When we set out to perform this simulation, we identified various objectives to achieve. How would it perform? What factors would impact the outcome? The goals we set included:
Evaluate and benchmark seven network compression configurations under a synthetic workload.
Measure and compare the CPU overhead introduced by each compression method.
Quantify the network throughput reduction achieved through compression.
Identify the optimal compression strategy balancing compute utilization and data transfer efficiency.
Compression scenarios
Note
Each recommendation made in this blog should be tested first in a pre-production environment and, only after thorough testing, implemented in production.
4.1 Ingest-only workload
This test scenario simulated a pure ingestion workload to measure the impact of compression during sustained data insert operations. The workload was executed using 64 concurrent threads, performing insert-only activity (no query operations), with each test run lasting 240 seconds and a controlled 100-second gap between cycles to stabilize system metrics. Documents were generated with an average size of ~51 KB, structured across 10 fields with a large text payload of approximately 10,000 characters to replicate moderately large record structures. All operations were executed within the same namespace, with results logged for comparative compression analysis across CPU and network utilization.
Write-only assessment—Atlas metrics:
Observations:ingest-only workload (ranked)
The results of the test above showed various results across the six testing categories. The results revealed that:
Snappy is best suited for write-heavy, performance-focused workloads, delivering the highest ingest throughput with balanced network reduction.
Zstd provides maximum compression with the lowest network footprint while maintaining lower CPU utilization than zlib variants. This makes it suitable where bandwidth efficiency is important and heavier client CPU usage is acceptable.
Zlib (levels 3–9) delivers strong compression and improved ingest density, but introduces sustained high CPU utilization, which can create compute bottlenecks during large ingestion cycles.
Zlib-0 offers minimal compression benefit with near-baseline network consumption and limited operational advantage. Using no compression, however, results in the highest network utilization and reduced scaling efficiency for large ingest workloads.
Read-only workload
Query-only workload (100% | ~51 KB Document Size)
This scenario evaluated compression behavior under a dedicated query workload, focusing on read throughput, decompression overhead, and response payload transfer. Test execution conditions remained consistent with the ingest-only workload.
As the production cluster is ~99% read-heavy, this scenario reflects real-world operating characteristics.
Read-only assessment—Atlas metrics read-only:
Observations: read-only workload (ranked)
The read-only workload simulation showed similar results to the ingest-only test. This revealed that:
Zstd delivers the lowest network usage while maintaining high query throughput, making it ideal for bandwidth-sensitive read workloads.
Snappy provides balanced read performance with low CPU overhead and moderate network reduction.
Zlib (levels 3–9) offers strong compression and high read throughput, but introduces sustained CPU overhead due to decompression costs.
Zlib-0 achieves the highest query throughput with moderate CPU usage and strong network reduction. In contrast, using no compression results in the highest network usage and the lowest query throughput, making it inefficient for read-heavy workloads.
Mixed workload (50:50)s
The mixed workload (50% reads, 50% writes) represents a common production scenario where both throughput and network efficiency are important. The following observations summarize how each compression algorithm performed based on CPU utilization, throughput, and network usage.
Hybrid operational workload ( ~51 KB Document Size)
This scenario evaluated compression performance under a balanced operational workload combining ingestion and query activity. Enabling analysis of how compression impacts systems handling concurrent data inserts and retrieval operations.
Test execution conditions remained consistent with the other workloads.
Mix-load assessment:
Observations: mixed workload (ranked)
The mixed workload (50% reads and 50% writes) represents a common production scenario where both throughput and network efficiency are important. Among the compression algorithms evaluated, zstd emerged as the preferred choice when minimizing data transfer costs is the primary objective, delivering the lowest inbound and outbound network usage while maintaining acceptable read and write throughput. Snappy provided the best balance between performance and network efficiency, offering strong throughput with meaningful, though less aggressive, network reduction, making it well-suited for general-purpose production workloads. Higher zlib compression levels (3–9) achieved significant network savings but at the cost of increased CPU utilization, making them suitable when bandwidth reduction outweighs processing overhead. In contrast, zlib-0 offered only limited compression benefits while maintaining relatively high outbound network usage, providing little advantage over the other compression algorithms. Finally, running without compression resulted in the highest network usage and data transfer costs and should generally be avoided for mixed workloads where bandwidth efficiency is a priority.
Key takeaways and recommendations
Compression algorithm analysis based on M50
The production cluster is highly read-dominant (~99% reads based on one-year insert trends, peak ~400 inserts/sec). Compression impact is therefore driven mainly by outbound data transfer and query response traffic, with minimal impact on writes.
The comparison below reflects this read-heavy behavior in our tests:
Given that our test cluster operated under a highly read-dominated workload, the benefits of network compression were primarily realized through response data transfer. Based on our findings, we recommend the following:
zstd delivers the greatest cost savings by achieving approximately 99% network reduction while incurring only moderate CPU overhead (~40%). It is the preferred choice for bandwidth-sensitive workloads where minimizing data transfer costs is the primary objective.
Snappy provides high throughput, approximately 95% network reduction, and minimal CPU overhead, making it well-suited for performance-oriented applications that still require meaningful bandwidth savings.
Higher zlib compression levels (3, 6, and 9) significantly increase CPU utilization (60–78%) without delivering proportional improvements over zstd, making them less suitable for most production workloads.
Proactive monitoring during peak workload periods is recommended to ensure system stability and validate resource utilization following any compression configuration changes.
This version is a bit more concise, follows a consistent style, and reads more like technical documentation while preserving your findings.
Note: Using Zstd compression provides significant gains by reducing data size and network traffic, but it shifts the load to client-side CPU utilization, especially at higher compression levels. When the client infrastructure can accommodate the increased CPU load, this optimization remains highly favorable as the cost is effectively moved from the cluster or network to the client. Zstd’s compression allows balancing between speed and compression ratio, where higher compression ratios require more processing power but retain consistent decompression performance across all levels.
Next Steps
Learn more about MongoDB network compression and performance optimization by exploring the official documentation and best practices for production deployments.