12 Tips for Going into Production with MongoDB
August 14, 2014 | Updated: January 26, 2022
Are you going into production with MongoDB? Don’t flip the switch yet! Read these 12 tips from our expert support engineers to make your launch a success.
Develop It Right the First Time
1. Make Sure Your Schema Works For You Does your schema fit your queries? Are there holdovers from "relational world" that don’t belong in a document structure? MongoDB’s dynamic schema makes it easy to change structure as your needs evolve, but getting it right to start saves time.
2. Optimize Your Indexes MongoDB supports many different types of secondary indexes. What do you need? Are your indexes optimized for your most common queries?
3. Be Prepared for Sharding You don’t need to shard right away, but you should have a plan. Shard before you run out of capacity! MongoDB supports multiple sharding policies to match your query pattern. You have the flexibility to shard on any key, so think about which will best serve your use case. We can help you plan for sharding.
4. Set Your Write Concern MongoDB gives you a lot of flexibility in managing write guarantees. The default is Acknowledged, but you can set write concern to Unacknowledged for maximum speed, or dial it all the way up to require a write to all replicas across multiple data centers for maximum data resilience.
For Smooth-Running Ops
5. Choose the Right Hardware Does your working set fit in RAM? Are you relying on SSDs or HDDs? Are you prioritizing faster CPUs or more cores? Is your storage local or remote? Are you virtualizing or running on bare metal? The right hardware will optimize performance, while the wrong hardware can lead to problems down the line.
6. Enable High Availability & Disaster Recovery MongoDB maintains multiple copies of data in self-healing replica sets. What level of failure do you need to be able to tolerate? One server giving up? A whole rack catching on fire? A whole data center losing power in a hurricane?
7. Back Up Your Data Replication takes care of the problem if a node fails. But what if your application starts writing over data? What if someone fat-fingers it and drops a collection? Have a backup strategy in place, take consistent backups, and make sure you practice restoring from backup! MongoDB Management Service (MMS) provides automated backup and point-in-time recovery.
8. Monitor Your Deployment MMS also makes it easy to watch over how MongoDB is running. Catch potential problems before they get serious! MMS makes it easy to check performance statistics, deploy new clusters, and take care of other operations tasks.
9. Keep Your Data Secure Are you handling sensitive, classified, or personally identifiable information? Do you need to comply with regulations or internal policies for security? MongoDB Enterprise offers advanced security options, including access controls, encryption and auditing.
10. Tune Up Your Performance Many factors can affect performance with MongoDB, including everything listed here! Tweaking some of your settings can give you serious performance returns. Conversely, having the wrong setup can cause bottlenecks that could be hard to diagnose. Our consultants can help you optimize performance.
11. Be Ready for Upgrades Automation, an upcoming feature of MMS, makes it easy to upgrade your whole deployment with a single click. Hot upgrades with no application downtime, without the time and effort of doing it manually!
12. Get Support If your application is mission-critical (and what applications aren’t?), rely on the peace of mind that comes with Production Support. Our SLAs ensure that expert engineers will respond quickly to your issues and work with you to resolve them. MongoDB Enterprise comes with support or you can sign up for standalone Production Support.
For more information, download our Ops Best Practices Guide. For answers to your questions and to ensure that production goes smoothly, get in touch!