Skip to Content
MongoDB: The Definitive Guide, 3rd Edition
book

MongoDB: The Definitive Guide, 3rd Edition

by Shannon Bradshaw, Eoin Brazil, Kristina Chodorow
December 2019
Intermediate to advanced
511 pages
12h 50m
English
O'Reilly Media, Inc.
Book available
Content preview from MongoDB: The Definitive Guide, 3rd Edition

Chapter 24. Deploying MongoDB

This chapter gives recommendations for setting up a server to go into production. In particular, it covers:

  • Choosing what hardware to buy and how to set it up

  • Using virtualized environments

  • Important kernel and disk I/O settings

  • Network setup: who needs to connect to whom

Designing the System

You generally want to optimize for data safety and the quickest access you can afford. This section discusses the best way to accomplish these goals when choosing disks, RAID configuration, CPUs, and other hardware and low-level software components.

Choosing a Storage Medium

In order of preference, we would like to store and retrieve data from:

  1. RAM

  2. SSD

  3. Spinning disk

Unfortunately, most people have limited budgets or enough data that storing everything in RAM is impractical and SSDs are too expensive. Thus, the typical deployment is a small amount of RAM (relative to total data size) and a lot of space on a spinning disk. If you are in this camp, the important thing is that your working set is smaller than RAM, and you should be ready to scale out if the working set gets bigger.

If you are able to spend what you like on hardware, buy a lot of RAM and/or SSDs.

Reading data from RAM takes a few nanoseconds (say, 100). Conversely, reading from disk takes a few milliseconds (say, 10). It can be hard to picture the difference between these two numbers, so let’s scale them up to more relatable numbers: if accessing RAM took 1 second, accessing the disk would take over a day!

100 nanoseconds ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MongoDB - The Complete Developer's Guide

MongoDB - The Complete Developer's Guide

Maximilian Schwarzmüller
The Complete Node.js Developer Course (3rd Edition)

The Complete Node.js Developer Course (3rd Edition)

Andrew Mead, Codestars By Rob Percival

Publisher Resources

ISBN: 9781491954454Errata Page