Hello Realm Enthusiasts,
Let’s go back to basics this week
Choosing a cluster tier, cloud provider, region, and deployment environment is very important for the performance of your Realm Application
Atlas Cluster Tier
A Cluster Tier can be shared or dedicated. It depends a lot on your use-case, which tier will give better throughput and performance.
M0/M2/M5 - Shared Tiers should only be chosen for development and testing environments
M10/M20 - Dedicated Tiers for development environments and low traffic applications
M30 and above - Dedicated Tiers for high-traffic applications and large datasets
Check Shared-Tier limitations to learn more.
Please Note - If you move from shared tier to dedicated tier, you will be required to terminate and re-enable sync.
Updating NVMe clusters will also require termination/re-enablement.
Cloud Provider and Region
MongoDB offers multiple regions across AWS, Azure and GCP and Realm currently supports 7 AWS regions for local deployment (more details) but is planning to add regions in Azure and GCP later this year.
It is recommended that you choose the Realm region closest to your Atlas cluster’s location. . Having the same Cloud Provider for both Cluster and Realm App is more advantageous for better throughput, performance, and cost – though not required.
Please Note: Sharded Clusters do not support Realm Sync
Deployment Model for Realm App
It is recommended that you choose a local deployment model when you create your Realm Application compared to global. Local Deployment means that all requests to your application are processed in a single region. This also leads to low latency and better performance between Realm ⇐=>Cluster traffic. In Global deployments, Realm will process end-user requests in the closest region to that user.
There will be different metrics displayed for shared and dedicated cluster tiers as shown in the diagram below:
The Shared tiers will show only basic information around CPU, Memory, and Network usage while more granular details will be shown with dedicated tiers.
The dedicated tiers will be more detailed than the shared tiers. Some of the important metrics for better application performance are:
Oplog - Oplog is a capped collection that keeps records of all transactions done on MongoDB. Sync uses the oplog to ensure changes are passed between database and application. It is important that your Atlas cluster has a sufficient oplog to be resilient to changes in workload and it is recommended to have a minimum oplog of 72 hours. Check Changing Oplog Size to learn more.
Errors like “Cannot Resume as resume token fall off the oplog ‘’ can be prevented if Oplog is configured properly and this will minimize cases where a termination/re-enablement is required.
Disk IOPS - Corresponding with your application workload, Realm Sync will use Disk IOPS to construct the Sync metadata and merge changes across applications into Atlas. If you see that Disk IOPS are exceeding the limits of your cluster, increasing the cluster tier or provisioning additional IOPS may significantly increase performance.
Query Metrics - The graph depicts the performance if you are running queries on data in MongoDB Atlas. You can also use Performance Adviser and Profiler capabilities in conjunction with query metrics to understand query outputs. Any other queries/workload run on the Atlas cluster with Sync will use the same resources, some of these operations may include:
- Driver Requests
- Charts, Compass, and Data Explorer operations
Check the Important Metrics section to learn more.
If you are new to MongoDB, the recommendation is to use the free tier and try different operations in your development environment to understand the workflow. However, it is not recommended to ship your production application while using the free tier.
I hope the provided information is helpful.
Please feel free to add any questions or ideas you may have based on your experience working with MongoDB and Realm.
Happy Learning and I will see you next week…