Cloud
Examine critical components of Cloud computing with Intel® software experts
122 Discussions

Which memory-optimized AWS EC2 instance type is best for MongoDB?

AdamDołasiński
Employee
0 0 442

Authored by: Adam Dołasiński (Intel) and Michał Krakowiak (Intel) and Izabella Raulin (Intel)

 

This is the next article in the series conducting a comparative study on self-managed MongoDB, focusing on aspects of performance and performance-per-dollar. Out of the major Cloud Service Providers, GCP[1] and Azure[2] have already been evaluated. Now, it's time to check this on Amazon Web Services (AWS)!

What would be the best option for a MongoDB instance on AWS? To address this question, we explore MongoDB performance on various AWS EC2 memory-optimized instances as they are recommended for database usage. Benchmarks were conducted on seven different R-Based instance types: R7g powered by AWS Graviton3 processors, R7i and R7iz powered by 4th Intel® Xeon® Scalable Processors, R7a powered by 4th generation AMD EPYC™ processors and their previous-generation counterparts: R6g, R6i, R6a powered by AWS Graviton2 processors, 3rd Intel® Xeon® Scalable Processors, and 3rd generation AMD EPYC™ processors, respectively.

Our study showed that the R7i and R7iz instances, based on 4th Gen Intel Xeon Scalable processors, offer the highest performance for MongoDB workloads. Moreover, the R7i provides the most favorable performance-to-cost ratio among all the instances tested. This leadership is consistent across all tested instance sizes: xlarge, 2xlarge, 4xlarge, 8xlarge, and 16xlarge.  

 

Keywords: Cloud, AWS, MongoDB, Performance, Performance-per-dollar, Xeon

line-photo-3.png

 

Methodology

A similar methodology was followed as in our prior studies conducted on the GCP and Azure [1, 2]. This recap summarizes the benchmarking procedures and provides the necessary tooling information for reproducing the tests:

 

Software Used:

  • Yahoo! Cloud Serving Benchmark (YCSB) version 0.17.0
  • MongoDB in version 6.0.4

 

Configuration:

  • Workload Mix: 90% read operations and 10% updates
  • Database Population: 20 million records
  • Operations Executed: 20 million operations on the dataset
  • Concurrency Simulation: 64 client threads used
  • Other parameters: Default settings used unless specified otherwise

 

Scenarios:

Seven representative instances from the AWS EC2 Memory-Optimized family were used, showcasing different processor types:

  • R7g with AWS Graviton3 processors,
  • R7i and R7iz with 4th Gen Intel® Xeon® Scalable Processors,
  • R7a with 4th Gen AMD EPYC™ processors,
  • previous-series counterparts: R6g, R6i, and R6a powered by AWS Graviton2 processors, 3rd Gen Intel® Xeon® Scalable Processors, 3rd Gen AMD EPYC™ processors, respectively.

Instance sizes ranged from 4 to 64 virtual CPUs, encompassing xlarge, 2xlarge, 4xlarge, 8xlarge, and 16xlarge sizes.

Note: The R7 series represents the latest instance types generally available to use in production environments as of the date of writing this article (June 2024), with the upcoming R8g instance type currently remaining in the preview phase.

 

Setup:

Each test involved a pair of EC2 instances: one serves as the System Under Test (SUT) running MongoDB (v6.0.4) with journaling disabled, and the second acts as the Load Generator using YCSB, using the same instance type as the SUT. Replication was turned off as a single MongoDB instance was being tested. The influence of storage and networking is beyond the scope of our test and in those respects the conditions are the same in all cases. 

The tests were performed in the us-east-1b zone, where instances were launched as on-demand Linux VMs (Ubuntu 22.04.2 LTS with kernel 6.2.0), and the prices from this US East (N. Virginia) region were used to calculate performance-per-dollar indicators. Each test was done at least three times, with an extra run if outcomes varied by more than 3% to remove outliers. The reported performance value is based on the median result.

 

Results

The benchmarks were conducted in December 2023. In Appendix A, you will find detailed results. Performance and performance-per-dollar values are normalized to those obtained for the R7i instances of specific sizes to clearly illustrate differences between instance types, as depicted in the charts below.

 
Figure 1. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 xlarge instances running MongoDB workload.Figure 1. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 xlarge instances running MongoDB workload.

 

Figure 2. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 2xlarge instances running MongoDB workload.Figure 2. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 2xlarge instances running MongoDB workload.

 

Figure 3. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 4xlarge instances running MongoDB workload.Figure 3. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 4xlarge instances running MongoDB workload.

 

Figure 4. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 8xlarge instances running MongoDB workload.Figure 4. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 8xlarge instances running MongoDB workload.

 

Figure 5. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 16xlarge instances running MongoDB workload.Figure 5. The normalized performance and performance-per-dollar for selected memory-optimized AWS EC2 16xlarge instances running MongoDB workload.

 

Observations:

  • Instances powered by 4th Generation Intel Xeon Scalable processors, specifically R7i and R7iz machine series, deliver the highest performance among all tested cases.
  • R7i offers the most favorable performance-to-cost ratio with results confirming its leadership across all tested sizes ranging from 4 to 64 vCPUs.
  • R7iz series offers higher performance compared to the R7i, meeting the demands of specific use cases that require high CPU performance. However, it comes with higher costs, resulting in a less favorable performance-per-cost ratio.
  • Worth highlighting are the numbers obtained with 2xlarge (8 vCPUs) instances (see Figure 2.):
    • R6i.2xlarge performed 26% worse in terms of cost efficiency than its successor R7i.2xlarge.
    • Comparing R7g.2xlarge to R7i.2xlarge shows a 16% difference in performance-per-dollar results in favor of Intel’s 4th Generation Xeon Scalable processors.
    • R7i.2xlarge instance excels in terms of Total Cost of Ownership (TCO) and leaves competitive R7a.2xlarge instance behind with a 28% lower performance-per-dollar ratio.

 

Conclusion

This present benchmark analysis covers MongoDB performance and performance-per-dollar across various instance sizes (xlarge, 2xlarge, 4xlarge, 8xlarge, and 16xlarge) memory-optimized AWS instances represented by R7g, R7i, R7iz, R7a, R6g, R6i, R6a instance types to help customers and cloud solutions architects to arrive at the best-suited instance type to deliver the greatest performance for the costs incurred on the Amazon Web Services.

The results show that placing MongoDB workload (90% reads, 10% updates) on R7iz and R7i memory-optimized instances featuring 4th Gen Intel Xeon Scalable processor delivers superior performance and in the case of R7i the most advantageous performance-per-dollar ratio compared to the other memory-optimized AWS EC2 instance types subjected to testing. This makes them a strong choice for organizations that need high and cost-efficient performance.

 

Appendix AAppendixA.png

 

References:

  1. Blogpost "MongoDB: Best choice of instance type on GCP”, https://community.intel.com/t5/Blogs/Tech-Innovation/Cloud/MongoDB-Best-choice-of-instance-type-on-GCP/post/1556443
  2. Blogpost “Best Virtual Machine Size for Self-Managed MongoDB on Microsoft Azure”, https://community.intel.com/t5/Blogs/Tech-Innovation/Cloud/Best-Virtual-Machine-Size-for-Self-Managed-MongoDB-on-Microsoft/post/1606921
  3. Specifications for Amazon EC2 memory optimized instances, https://docs.aws.amazon.com/ec2/latest/instancetypes/mo.html
  4. Amazon EC2 On-Demand Pricing, https://aws.amazon.com/ec2/pricing/on-demand/

 

Disclosure Text:

Remember that MongoDB's performance can be highly dependent on factors like data structure, query patterns, indexes, and more. It's a good practice to test your application with different instance types and configurations to find the optimal setup that balances performance and cost for your specific use case.

 

Notices & Disclaimers:

Performance varies by use, configuration, and other factors. Learn more on the Performance Index site.
Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available updates. See backup for configuration details. No product or component can be absolutely secure.


Your costs and results may vary. For further information please refer to Legal Notices and Disclaimers.
Intel technologies may require enabled hardware, software, or service activation.


© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.