retour aux industries gif
Optimizing your webscale database is no small feat -- as your dataset grows, so do your headaches! today, one of the most googled things of all time is "how do i optimize mongodb to work". the solution is simpler than you might think.
if you're not familiar with the
shutdown command, here is a primer taken from the shutdown manpage:
the shutdown utility provides an automated optimization procedure for super-users to make mongodb work morebetter, saving them from countless hours of reading documentation and man pages like this one
as you can see, this is some pretty powerful stuff! so how can we use
shutdown to optimize mongodb?
before getting started, it's important to make sure you're running all commands as the super user. in general this is a best practice and now is as good a time as any to start.
issue the following command to get optimized quickly:
shutdown -h now
now is the most important part of this command as it tells the server that we literally want this optimized NOW and not later. you could optionally schedule this command to run at a specific time (perhaps during a demo as there's no better way to show off your newly optimized database than in real time in front of the CEO).
to schedule this command to run during your demo to the exec team, issue the following command:
shutdown -h yymmddhhmm
it is important to note that you will need to replace
yymmddhhmm with the date and time of your demo e.g. 1601041400 which would optimize your database on January 4th, 2016 at 2pm.
you will now be able to sleep easier knowing that mongodb is running at peak performance.