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

MongoDB: Best choice of instance type on GCP

IzabellaRaulin
Employee
10 0 166K

Authored by: Michał Prostko (Intel) and Izabella Raulin (Intel)

 

What would be the best option to choose for a MongoDB instance on the Google Cloud Platform? Two key aspects need to be considered when talking about it. First is MongoDB performance which heavily relies on resources such as memory, cache, storage, and network. Also, MongoDB workload is characterized by load to the CPU if, for example, we aggregate data. The second is the ongoing cost associated with the running instance which is critical for maintaining business. Both factors can be expressed as performance-per-dollar to assess the value you get for your money.

In this post, we explore the performance of MongoDB across various instances from the general-purpose machine family available on the Google Cloud Platform. The benchmarks were conducted on t2a-standard, n2d-standard, c3d-standard, n2-standard, and c3-standard instances powered by Ampere Altra Arm, 3rd Gen AMD EPYC, 4th Gen AMD EPYC, 3rd Gen Intel Xeon Scalable, 4th Gen Intel Xeon Scalable processors, respectively.

We showed that the 4th Gen Intel Xeon Scalable processor-based c3-standard instance offers the highest performance and the most favorable performance-to-cost ratio among others tested.

 

cloud-circuit-board-performance-computing-rwd.jpg

 

MongoDB's popularity and adoption in cloud environments

MongoDB is a NoSQL database that has gained wide adoption across various organizations and industries. This fact is underscored by its position in the recent August 2023 ranking conducted by DB-engines.com. The assessment considered various metrics, including the number of mentions, frequency of technical discussions, desired job skills, search statistics, and social network relevance. MongoDB achieved a score solidifying its position within the top 5 database systems. Although data on the distribution of MongoDB installations between on-premises and off-premises setups is unavailable; however, it can be deduced that the quantity of off-prem installations is on the rise, aligning with the broader trend of transitioning services to cloud environments.

Figure 1. The ranking of most popular database technologies, as conducted by DB-Engines.comFigure 1. The ranking of most popular database technologies, as conducted by DB-Engines.com

 

Methodology

Benchmarking Software - YCSB

To test different cloud instances for the MongoDB workloads, we used the Yahoo! Cloud Serving Benchmark (YCSB). YCSB is an open-source benchmarking tool designed to evaluate the performance of different database systems and cloud data stores under various workloads. YCSB is widely used to test the MongoDB performance based on scenarios that are abstracted from the real world. The YCSB v0.17.0, which is the latest release package, was used.

Setup

Every run involved a single Load Generator Instance paired with the System Under Test (SUT) Instance wherein MongoDB version 6.0.4 was operational. Replication was turned off as a single MongoDB instance was being tested. The client machine employed an instance of the same type as SUT. All instances ran in the us-central1 region as on-demand instances, and prices from this region were taken to calculate performance-per-dollar.

Our analysis aims to identify the most suitable general-purpose instance type for MongoDB workloads, considering both performance and performance-per-dollar aspects. 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. Moreover, the tested MongoDB version (v.6.0.4) allows you to disable journaling, which was applied.

The benchmark of MongoDB was conducted using a workload comprising 90% read operations and 10% updates. To carry out a comprehensive measurement and ensure robust testing of system performance, we configured the YCSB utility to populate the MongoDB database with 20 million records and execute 20 million operations on the dataset. This was achieved by configuring the record count and operation count properties within YCSB. Furthermore, we set a baseline of 64 client threads to simulate concurrency. Other YCSB parameters, if not mentioned below, remained as default.

 

Figure 2. The following conditions were applied for running MongoDB on different cloud instances on the Google Cloud Platform. On the left side, the diagram presents the setup employed to execute the MongoDB workload. On the right side, the table describes the configuration used. Other settings have intentionally been left as default.Figure 2. The following conditions were applied for running MongoDB on different cloud instances on the Google Cloud Platform. On the left side, the diagram presents the setup employed to execute the MongoDB workload. On the right side, the table describes the configuration used. Other settings have intentionally been left as default.

Scenarios

The general-purpose machine family on the Google Cloud Platform was chosen to perform the benchmark. To compare performance and performance-per-dollar across different processors, we opted for the following 5 instances that offer a substantively representative cross-section of the prevailing choices in the general-purpose machine spectrum: t2a-standard (Ampere Altra Arm), n2d-standard (3rd Gen AMD EPYC), c3d-standard (4th Gen AMD EPYC), n2-standard (3rd Gen Intel Xeon Scalable Processor) and c3-standard (4th Gen Intel Xeon Scalable). These machine types were equipped with either 4 or 8 virtual Central Processing Units (vCPUs). The instance details used for testing are shown in Appendix A.
For every scenario, a minimum of three runs were executed. If the outcomes exhibited variations exceeding 3%, an additional measurement was taken to eliminate outlier cases. This approach ensures the accuracy of the final value, which is derived from the median of these three recorded values.

 

Results

The tests were conducted in October 2023. All results are shown in Appendix A. To present the differences between the individual types of instances more clearly, normalized values were computed in relation to the outcome of the n2-standard instance.

Figure 3. The normalized performance (on the left) and performance-per-dollar (on the right) across selected general-purpose GCP instances with 4 vCPUs for MongoDB workload.Figure 3. The normalized performance (on the left) and performance-per-dollar (on the right) across selected general-purpose GCP instances with 4 vCPUs for MongoDB workload.

Figure 4. The normalized performance (on the left) and performance-per-dollar (on the right) across selected general-purpose GCP instances with 8 vCPUs for MongoDB workload.Figure 4. The normalized performance (on the left) and performance-per-dollar (on the right) across selected general-purpose GCP instances with 8 vCPUs for MongoDB workload.

Observations:

  • C3-standard machine series powered by 4th Gen Intel Xeon Scalable processor offers the highest performance and the most favorable performance-to-cost ratio among the others for performed MongoDB workload.
  • The instance c3‑standard‑4, powered by 4th Gen Intel Xeon Scalable, exhibits a 40% performance increase compared to n2‑standard‑4, which runs on the previous generation of the Intel Xeon Scalable processor. Furthermore, c3‑standard‑4 demonstrates an impressive 2.2-fold performance enhancement over t2a‑standard‑4 and outperforms n2d‑standard‑4 by over 2x. 
  • In terms of performance per dollar, c3‑standard‑4 gives you a 30% higher value you get for your money than n2‑standard‑4, despite being $0.0147/hour more expensive.  When contrasting the outcomes of c3‑standard‑4 to the instance with the lowest operating cost in the statement, which is t2a-standard-4, there is a $0,2345/h disparity in cost. Nonetheless, c3‑standard‑4 maintains an 84% performance-per-dollar advantage over t2a‑standard‑4, which makes c3‑standard‑4 a more economically viable option from this perspective.
  • The results obtained for instances with 8 vCPUs consistently position the c3‑standard machine series as the leader in both measured throughput for the MongoDB workload and calculated performance-per-dollar metrics.

 

Conclusion

This present benchmark analysis covers MongoDB performance and performance-per-dollar across 4vCPUs and 8vCPUs general-purpose GCP instances represented by t2a-standard, n2d-standard, c3d-standard, n2-standard, and c3-standard machine families 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 Google Cloud Platform.

The results show that placing MongoDB workload (90% reads, 10% updates) on C3-standard instances featuring 4th Gen Intel Xeon Scalable processor delivers superior performance and the most advantageous performance-per-dollar ratio compared to the other general-purpose machine types subjected to testing. This makes them a strong choice for organizations that need high and cost-efficient performance to support more customers and grow their business.

 

Appendix A

AppendixAv4.png

References:
  1. https://cloud.google.com/compute/docs/general-purpose-machines (accessed 12/12/2023)
  2. https://cloud.google.com/compute/docs/cpu-platforms (accessed 12/12/2023)
  3. https://cloud.google.com/compute/vm-instance-pricing (accessed 12/12/2023)

 

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.