<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SoftLayer Blog &#187; Harold Hannon</title>
	<atom:link href="http://blog.softlayer.com/author/hhannon/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.softlayer.com</link>
	<description>A Behind the Scenes Look at the Best Hosting Provider in the World</description>
	<lastBuildDate>Fri, 24 May 2013 18:19:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>MongoDB Performance Analysis: Bare Metal v. Virtual</title>
		<link>http://blog.softlayer.com/2012/mongodb-performance-analysis-bare-metal-v-virtual/</link>
		<comments>http://blog.softlayer.com/2012/mongodb-performance-analysis-bare-metal-v-virtual/#comments</comments>
		<pubDate>Thu, 20 Dec 2012 15:30:32 +0000</pubDate>
		<dc:creator>Harold Hannon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[10gen]]></category>
		<category><![CDATA[bare metal]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[engineered servers]]></category>
		<category><![CDATA[IOPS]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=10070</guid>
		<description><![CDATA[Developers can be cynical. When &#8220;the next great thing in technology&#8221; is announced, I usually wait to see how it performs before I get too excited about it &#8230; Show me how that &#8220;next great thing&#8221; compares apples-to-apples with the competition, and you&#8217;ll get my attention. With the launch of MongoDB at SoftLayer, I&#8217;d guess [...]]]></description>
			<content:encoded><![CDATA[<p>Developers can be cynical. When &#8220;the next great thing in technology&#8221; is announced, I usually wait to see how it performs before I get too excited about it &#8230; Show me how that &#8220;next great thing&#8221; compares apples-to-apples with the competition, and you&#8217;ll get my attention. With the launch of <a href="https://www.softlayer.com/solutions/big-data/mongodb">MongoDB</a> at SoftLayer, I&#8217;d guess a lot of developers outside of SoftLayer and 10gen have the same &#8220;wait and see&#8221; attitude about the new platform, so I put our new <a href="https://www.softlayer.com/solutions/big-data/mongodb/pricing">MongoDB engineered servers</a> to the test.</p>
<p>When I shared <a href="http://blog.softlayer.com/2012/mongodb-architectural-best-practices/">MongoDB architectural best practices</a>, I referenced a few of the significant optimizations our team worked with 10gen to incorporate into our engineered servers (<a href="http://knowledgelayer.softlayer.com/questions/585/Engineered+MongoDB+Installations">cheat sheet</a>). To illustrate the impact of these changes in MongoDB performance, we ran 10gen&#8217;s recommended <a href="http://www.mongodb.org/display/DOCS/JS+Benchmarking+Harness">benchmarking harness</a> (freely available for download and testing of your own environment) on our three tiers of engineered servers alongside equivalent shared virtual environments commonly deployed by the MongoDB community. We&#8217;ve made a pretty big deal about the performance impact of running MongoDB on optimized bare metal infrastructure, so it&#8217;s time to put our money where our mouth is.</p>
<h3>The Testing Environment</h3>
<p style="margin-top:5px; padding-top:0;">For each of the available SoftLayer MongoDB engineered servers, data sets of 512kb documents were preloaded onto single MongoDB instances. The data sets were created with varying size compared to available memory to allow for data sets that were both larger (2X) and smaller than available memory. Each test also ensured that the data set was altered during the test run frequently enough to prevent the queries from caching all of the data into memory.</p>
<p>Once the data sets were created, <a href="http://jmeter.apache.org/">JMeter</a> server instances with 4 cores and 16GB of RAM were used to drive &#8216;benchrun&#8217; from the 10gen benchmarking harness. This diagram illustrates how we set up the testing environment (click for a better look):</p>
<p><a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/mongodbtestsetup.png"><img class="centered" src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/mongodbtestsetup_s.png" alt="MongoDB Performance Analysis Setup"/></a></p>
<p>These Jmeter servers function as the clients generating traffic on the MongoDB instances. Each client generated random query and update requests with a ratio of six queries per update (The update requests in the test were to ensure that data was not allowed to fully cache into memory and never exercise reads from disk). These tests were designed to create an extreme load on the servers from an exponentially increasing number of clients until the system resources became saturated, and we recorded the resulting performance of the MongoDB application.</p>
<p>At the Medium (MD) and Large (LG) engineered server tiers, performance metrics were run separately for servers using 15K SAS hard drive data mounts and servers using SSD hard drive data mounts. If you missed the post <a href="http://blog.softlayer.com/2012/big-data-at-softlayer-the-importance-of-iops/">comparing the IOPS statistics between different engineered server hard drive configurations</a>, be sure to check it out. For a better view of the results in a given graph, click the image included in the results below to see a larger version.</p>
<style type="text/css">
  .perfan {width:305px; float:left; padding:5px; margin:5px; size:6px; font-weight:bold; text-align:center; color:#972f2c;}
  .perfan img {margin-left:auto; margin-right:auto;}
  .comparison {float:left; margin-left:10px; margin-right:10px;}
  h3{font-size:16px;color:#972F2c;}
 </style>
<h3>Test Case 1: Small MongoDB Engineered Servers vs Shared Virtual Instance</h3>
<p style="margin-top:5px; padding-top:0; margin-bottom:0;padding-bottom:0;"><strong>Servers</strong></p>
<div class="comparison">Small (SM) MongoDB Engineered Server<br />
Single 4-core Intel 1270 CPU<br />
64-bit CentOS<br />
8GB RAM<br />
2 x 500GB SATAII &#8211; RAID1<br />
1Gb Network</div>
<div class="comparison">Virtual Provider Instance<br />
4 Virtual Compute Units<br />
64-bit CentOS<br />
7.5GB RAM<br />
2 x 500GB Network Storage &#8211; RAID1<br />
1Gb Network</div>
<div style="clear:both; height:1px; margin:0; padding:0;">&nbsp;</div>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Tests Performed</strong></p>
<div style="margin-left:10px;">Small Data Set (8GB of .5mb documents)<br />
200 iterations of 6:1 query-to-update operations<br />
Concurrent client connections exponentially increased from 1 to 32<br />
Test duration spanned 48 hours</div>
<div class="perfan">Average Read Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan1.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan1.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Read Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan2.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan2.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Average Write Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan3.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan3.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Write Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan4.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan4.jpg" alt="MongoDB Performance Analysis"/></a></div>
<p><span id="more-10070"></span></p>
<h3>Test Case 2: Medium MongoDB Engineered Servers vs Shared Virtual Instance</h3>
<p style="margin-top:5px; padding-top:0; margin-bottom:0;padding-bottom:0;"><strong>Servers (15K SAS Data Mount Comparison)</strong></p>
<div class="comparison">Medium (MD) MongoDB Engineered Server<br />
Dual 6-core Intel 5670 CPUs<br />
64-bit CentOS<br />
36GB RAM<br />
2 x 64GB SSD &#8211; RAID1 (Journal Mount)<br />
4 x <strong>300GB 15K SAS</strong> &#8211; RAID10 (Data Mount)<br />
1Gb Network &#8211; Bonded</div>
<div class="comparison">Virtual Provider Instance<br />
26 Virtual Compute Units<br />
64-bit CentOS<br />
30GB RAM<br />
2 x 64GB Network Storage &#8211; RAID1 (Journal Mount)<br />
4 x 300GB Network Storage &#8211; RAID10 (Data Mount)<br />
1Gb Network</div>
<div style="clear:both; height:1px; margin:0; padding:0;">&nbsp;</div>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Tests Performed</strong></p>
<div style="margin-left:10px;">Small Data Set (32GB of .5mb documents)<br />
200 iterations of 6:1 query-to-update operations<br />
Concurrent client connections exponentially increased from 1 to 128<br />
Test duration spanned 48 hours</div>
<div class="perfan">Average Read Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan5.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan5.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Read Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan6.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan6.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Average Write Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan7.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan7.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Write Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan8.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan8.jpg" alt="MongoDB Performance Analysis"/></a></div>
<p style="margin-top:5px; padding-top:0; margin-bottom:0;padding-bottom:0;"><strong>Servers (SSD Data Mount Comparison)</strong></p>
<div class="comparison">Medium (MD) MongoDB Engineered Server<br />
Dual 6-core Intel 5670 CPUs<br />
64-bit CentOS<br />
36GB RAM<br />
2 x 64GB SSD &#8211; RAID1 (Journal Mount)<br />
4 x <strong>400GB SSD</strong> &#8211; RAID10 (Data Mount)<br />
1Gb Network &#8211; Bonded</div>
<div class="comparison">Virtual Provider Instance<br />
26 Virtual Compute Units<br />
64-bit CentOS<br />
30GB RAM<br />
2 x 64GB Network Storage &#8211; RAID1 (Journal Mount)<br />
4 x 300GB Network Storage &#8211; RAID10 (Data Mount)<br />
1Gb Network</div>
<div style="clear:both; height:1px; margin:0; padding:0;">&nbsp;</div>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Tests Performed</strong></p>
<div style="margin-left:10px;">Small Data Set (32GB of .5mb documents)<br />
200 iterations of 6:1 query-to-update operations<br />
Concurrent client connections exponentially increased from 1 to 128<br />
Test duration spanned 48 hours</div>
<div class="perfan">Average Read Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan9.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan9.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Read Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan10.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan10.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Average Write Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan11.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan11.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Write Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan12.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan12.jpg" alt="MongoDB Performance Analysis"/></a></div>
<h3>Test Case 3: Large MongoDB Engineered Servers vs Shared Virtual Instance</h3>
<p style="margin-top:5px; padding-top:0; margin-bottom:0;padding-bottom:0;"><strong>Servers (15K SAS Data Mount Comparison)</strong></p>
<div class="comparison">Large (LG) MongoDB Engineered Server<br />
Dual 8-core Intel E5-2620 CPUs<br />
64-bit CentOS<br />
128GB RAM<br />
2 x 64GB SSD &#8211; RAID1 (Journal Mount)<br />
6 x <strong>600GB 15K SAS</strong> &#8211; RAID10 (Data Mount)<br />
1Gb Network &#8211; Bonded</div>
<div class="comparison">Virtual Provider Instance<br />
26 Virtual Compute Units<br />
64-bit CentOS<br />
64GB RAM (Maximum available on this provider)<br />
2 x 64GB Network Storage &#8211; RAID1 (Journal Mount)<br />
6 x 600GB Network Storage &#8211; RAID10 (Data Mount)<br />
1Gb Network</div>
<div style="clear:both; height:1px; margin:0; padding:0;">&nbsp;</div>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Tests Performed</strong></p>
<div style="margin-left:10px;">Small Data Set (64GB of .5mb documents)<br />
200 iterations of 6:1 query-to-update operations<br />
Concurrent client connections exponentially increased from 1 to 128<br />
Test duration spanned 48 hours</div>
<div class="perfan">Average Read Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan13.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan13.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Read Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan14.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan14.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Average Write Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan15.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan15.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Write Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan16.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan16.jpg" alt="MongoDB Performance Analysis"/></a></div>
<p style="margin-top:5px; padding-top:0; margin-bottom:0;padding-bottom:0;"><strong>Servers (SSD Data Mount Comparison)</strong></p>
<div class="comparison">Large (LG) MongoDB Engineered Server<br />
Dual 8-core Intel E5-2620 CPUs<br />
64-bit CentOS<br />
128GB RAM<br />
2 x 64GB SSD &#8211; RAID1 (Journal Mount)<br />
6 x <strong>400GB SSD</strong> &#8211; RAID10 (Data Mount)<br />
1Gb Network &#8211; Bonded</div>
<div class="comparison">Virtual Provider Instance<br />
26 Virtual Compute Units<br />
64-bit CentOS<br />
64GB RAM (Maximum available on this provider)<br />
2 x 64GB Network Storage &#8211; RAID1 (Journal Mount)<br />
6 x 600GB Network Storage &#8211; RAID10 (Data Mount)<br />
1Gb Network</div>
<div style="clear:both; height:1px; margin:0; padding:0;">&nbsp;</div>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Tests Performed</strong></p>
<div style="margin-left:10px;">Small Data Set (64GB of .5mb documents)<br />
200 iterations of 6:1 query-to-update operations<br />
Concurrent client connections exponentially increased from 1 to 128<br />
Test duration spanned over 48 hours</div>
<div class="perfan">Average Read Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan17.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan17.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Read Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan18.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan18.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Average Write Operations per Second<br />
by Concurrent Client<br />
<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan19.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan19.jpg" alt="MongoDB Performance Analysis"/></a></div>
<div class="perfan">Peak Write Operations per Second<br />
by Concurrent Client<a href="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan20.png"><img src="http://cdn.softlayer.com/innerlayer/mongodbperformanceanalysis/perfan20.jpg" alt="MongoDB Performance Analysis"/></a></div>
<h3>Impressions from Performance Testing</h3>
<p style="margin-top:5px; padding-top:0;">The results speak for themselves. Running a Mongo DB <a href="https://www.softlayer.com/bigdata">big data</a> solution on a shared virtual environment has significant drawbacks when compared to running MongoDB on a single-tenant bare metal offering.  Disk I/O is by far the most limiting resource for MongoDB, and relying on shared network-attached storage (with much lower disk I/O) makes this limitation very apparent. Beyond the average and peak statistics above, performance varied much more significantly in the virtual instance environment, so it&#8217;s not as consistent and predictable as a bare metal.</p>
<p style="margin-bottom:0; padding-bottom:0;"><strong>Highlights:</strong></p>
<ul style="margin-top:5px; padding-top:0;">
<li>When a working data set is smaller than available memory, query performance increases.</li>
<li>The number of clients performing queries has an impact on query performance because more data is being actively cached at a rapid rate.
<li>The addition of a separate Journal Mount volume significantly improves performance. Because the Small (SM) engineered server does not include a secondary mount for Journals, whenever MongoDB began to journal, the disk I/O associated with journalling was disruptive to the query and update operations performed on the Data Mount.</li>
<li>The best deployments in terms of operations per second, stability and control were the configurations with a RAID10 SSD Data Mount and a RAID1 SSD Journal Mount. These configurations are available in both our Medium and Large offerings, and I&#8217;d highly recommend them.</li>
</ul>
<p>-Harold</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/mongodb-performance-analysis-bare-metal-v-virtual/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MongoDB: Architectural Best Practices</title>
		<link>http://blog.softlayer.com/2012/mongodb-architectural-best-practices/</link>
		<comments>http://blog.softlayer.com/2012/mongodb-architectural-best-practices/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 21:45:35 +0000</pubDate>
		<dc:creator>Harold Hannon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[10gen]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[clusters]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[engineered servers]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[IOPS]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[strategy]]></category>
		<category><![CDATA[tweaks]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=10036</guid>
		<description><![CDATA[With the launch of our MongoDB solutions, developers can provision powerful, optimized, horizontally scaling NoSQL database clusters in real-time on bare metal infrastructure in SoftLayer data centers around the world. We worked tirelessly with our friends at 10gen &#8212; the creators of MongoDB &#8212; to build and tweak hardware and software configurations that enable peak [...]]]></description>
			<content:encoded><![CDATA[<p>With the launch of our <a href="https://www.softlayer.com/solutions/big-data/mongodb">MongoDB solutions</a>, developers can provision powerful, optimized, horizontally scaling NoSQL database clusters in real-time on bare metal infrastructure in SoftLayer data centers around the world. We worked tirelessly with our friends at 10gen &mdash; the creators of <a href="http://www.mongodb.org/">MongoDB</a> &mdash; to build and tweak hardware and software configurations that enable peak MongoDB performance, and the resulting platform is pretty amazing. As Duke mentioned in his <a href="http://blog.softlayer.com/2012/big-data-at-softlayer-mongodb/">blog post</a>, those efforts followed 10Gen&#8217;s MongoDB best practices, but what he didn&#8217;t mention was that we created some architectural best practices of our own for MongoDB in deployments on our platform.</p>
<p>The <a href="http://www.softlayer.com/solutions/big-data/mongodb/pricing">MongoDB engineered servers</a> that you order from SoftLayer already implement several of the recommendations you&#8217;ll see below, and I&#8217;ll note which have been incorporated as we go through them. Given the scope of the topic, it&#8217;s probably easiest to break down this guide into a few sections to make it a little more digestible. Let&#8217;s take a look at the architectural best practices of running MongoDB through the phases of the roll-out process: Selecting a deployment strategy to prepare for your MongoDB installation, the installation itself, and the operational considerations of running it in production.</p>
<h3>Deployment Strategy</h3>
<p style="padding-top:0; margin-top:5px;">When planning your MongoDB deployment, you should follow Sun Tzu&#8217;s (modified) advice: &#8220;If you know the [friend] and know yourself, you need not fear the result of a hundred battles.&#8221; &#8220;Friend&#8221; was substituted for the &#8220;enemy&#8221; in this advice because the other party is MongoDB. If you aren&#8217;t familiar with MongoDB, the top of your to-do list should be to read <a href="http://www.mongodb.org/display/DOCS/Home">MongoDB&#8217;s official documentation</a>. That information will give you the background you&#8217;ll need as you build and use your database. When you feel comfortable with what MongoDB is all about, it&#8217;s time to &#8220;know yourself.&#8221;</p>
<p>Your most important consideration will be the current and anticipated sizes of your data set. Understanding the volume of data you&#8217;ll need to accommodate will be the primary driver for your choice of individual physical nodes as well as your sharding plans. Once you&#8217;ve established an expected size of your data set, you need to consider the importance of your data and how tolerant you are of the possibility of lost or lagging data (especially in replicated scenarios). With this information in hand, you can plan and start testing your deployment strategy. </p>
<p>It sounds a little strange to hear that you should test a deployment strategy, but when it comes to big data, you want to make sure your databases start with a strong foundation. You should perform load testing scenarios on a potential deployment strategy to confirm that a given architecture will meet your needs, and there are a few specific areas that you should consider:</p>
<div style="margin-left:10px;"><strong>Memory Sizing</strong><br />
MongoDB (like many data-oriented applications) works best when the data set can reside in memory. Nothing performs better than a MongoDB instance that does not require disk I/O. Whenever possible, select a platform that has more available RAM than your working data set size. If your data set exceeds the available RAM for a single node, then consider using <a href="http://docs.mongodb.org/manual/core/sharding/">sharding</a> to increase the amount of available RAM in a cluster to accommodate the larger data set. This will maximize the overall performance of your deployment. If you notice page faults when you put your database under production load, they may indicate that you are exceeding the available RAM in your deployment.</p>
<p><strong>Disk Type</strong><br />
If speed is not your primary concern or if you have a data set that is far larger than any available in memory strategy can support, selecting the proper disk type for your deployment is important. <a href="http://en.wikipedia.org/wiki/IOPS">IOPS</a> will be key in selecting your disk type and obviously the higher the IOPS the better the performance of MongoDB. Local disks should be used whenever possible (as network storage can cause high latency and poor performance for your deployment). It&#8217;s also advised that you use RAID 10 when creating disk arrays. </p>
<p>To give you an idea of what kind of IOPS to expect from a given type of drive, these are the approximate ranges of IOPS per drive in SoftLayer MongoDB engineered servers:</p>
<div style="margin-left:10px;">SATA II – 100-200 IOPS<br />
15K SAS – 300-400 IOPS<br />
SSD – 7,000-8,000 IOPS (read) 19,000-20,000 IOPS (write)</div>
<p><strong>CPU</strong><br />
Clock speed and the amount of available processors becomes a consideration if you anticipate using <a href="http://en.wikipedia.org/wiki/MapReduce">MapReduce</a>. It has also been noted that when running a MongoDB instance with the majority of the data in memory, clock speed can have a major impact on overall performance. If you are planning to use MapReduce or you&#8217;re able to operate with a majority of your data in memory, consider a deployment strategy that includes a CPU with a high clock/bus speed to maximize your operations per second.</p>
<p><strong>Replication</strong><br />
Replication provides high availability of your data if a node fails in your cluster. It should be standard to replicate with at least three nodes in any MongoDB deployment. The most common configuration for replication with three nodes is a 2&#215;1 deployment &mdash; having two primary nodes in a single data center with a backup server in a secondary data center:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/mongodbreplication.png" alt="MongoDB Replication"/> </p>
<p><strong>Sharding</strong><br />
If you anticipate a large, active data set, you should deploy a sharded MongoDB deployment. Sharding allows you to partition a single data set across multiple nodes. You can allow MongoDB to automatically distribute the data across nodes in the cluster or you may elect to define a shard key and create range-based sharding for that key. </p>
<p>Sharding may also help write performance, so you can also elect to shard even if your data set is small but requires a high amount of updates or inserts. It&#8217;s important to note that when you deploy a sharded set, MongoDB will require three (and only three) config server instances which are specialized Mongo runtimes to track the current shard configuration. Loss of one of these nodes will cause the cluster to go into a read-only mode (for the configuration only) and will require that all nodes be brought back online before any configuration changes can be made.</p>
<p><strong>Write Safety Mode</strong><br />
There are several write safety modes that govern how MongoDB will handle the persistence of the data to disk. It is important to consider which mode best fits your needs for both data integrity and performance. The following write safety modes are available:</p>
<div style="margin-left:10px;">None – This mode provides a deferred writing strategy that is non-blocking. This will allow for high performance, however there is a small opportunity in the case of a node failing that data can be lost. There is also the possibility that data written to one node in a cluster will not be immediately available on all nodes in that cluster for read consistency. The &#8216;None&#8217; strategy will also not provide any sort of protection in the case of network failures. That lack of protection makes this mode highly unreliable and should only be used when performance is a priority and data integrity is not a concern.</p>
<p>Normal – This is the default for MongoDB if you do not select any other mode. It provides a deferred writing strategy that is non-blocking. This will allow for high performance, however there is a small opportunity in the case of a node failing that data can be lost. There is also the possibility that data written to one node in a cluster will not be immediately available on all nodes in that cluster for read consistency.</p>
<p>Safe – This mode will block until MongoDB has acknowledged that it has received the write request but will not block until the write is actually performed. This provides a better level of data integrity and will ensure that read consistency is achieved within a cluster.</p>
<p>Journal Safe – Journals provide a recovery option for MongoDB. Using this mode will ensure that the data has been acknowledged and a Journal update has been performed before returning.</p>
<p>Fsync &#8211; This mode provides the highest level of data integrity and blocks until a physical write of the data has occurred. This comes with a degradation in performance and should be used only if data integrity is the primary concern for your application.</p></div>
<p><strong>Testing the Deployment</strong><br />
Once you&#8217;ve determined your deployment strategy, test it with a data set similar to your production data. 10gen has several tools to help you with load testing your deployment, and the console has a tool named &#8216;benchrun&#8217; which can execute operations from within a <a href="http://www.mongodb.org/display/DOCS/JS+Benchmarking+Harness">JavaScript test harness</a>. These tools will return operation information as well as latency numbers for each of those operations. If you require more detailed information about the MongoDB instance, consider using the <a href="http://docs.mongodb.org/manual/reference/mongostat/">mongostat</a> command or MongoDB Monitoring Service (MMS) to monitor your deployment during the testing.</div>
<h3>Installation</h3>
<p style="padding-top:0; margin-top:5px;">When performing the installation of MongoDB, a few considerations can help create both a stable and performance-oriented solution. 10gen recommends the use CentOS (64-bit) as the base operating system if at all possible. If you try installing MongoDB on a 32-bit operating system, you might run into file size limits that cause issues, and if you feel the urge to install it on Windows, you&#8217;ll see performance issues if virtual memory begins to be utilized by the OS to make up for a lack of RAM in your deployment. As a result, 32-bit operating systems and Windows operating systems should be avoided on MongoDB servers. SoftLayer provisions CentOS 6.X 64-bit operating systems by default on all of our MongoDB engineered server deployments.</p>
<p>When you&#8217;ve got CentOS 64-bit installed, you should also make the following changes to maximize your performance (all of which are included <a href="http://knowledgelayer.softlayer.com/articles/engineered-mongodb-installations">by default</a> on all SoftLayer engineered servers):</p>
<div style="margin-left:10px;">Set SSD Read Ahead Defaults to 16 Blocks &#8211; SSD drives have excellent seek times allowing for shrinking the Read Ahead to 16 blocks. Spinning disks might require slight buffering so these have been set to 32 blocks.</p>
<p>noatime &#8211; Adding the noatime option eliminates the need for the system to make writes to the file system for files which are simply being read &mdash; or in other words: Faster file access and less disk wear.</p>
<p>Turn NUMA Off in BIOS &#8211; Linux, NUMA and MongoDB tend not to work well together. If you are running MongoDB on NUMA hardware, we recommend turning it off (running with an interleave memory policy). If you don&#8217;t, problems will manifest in strange ways like massive slow downs for periods of time or high system CPU time.</p>
<p>Set ulimit &#8211; We have set the ulimit to 64000 for open files and 32000 for user processes to prevent failures due to a loss of available file handles or user processes.</p>
<p>Use ext4 &#8211; We have selected ext4 over ext3.  We found ext3 to be very slow in allocating files (or removing them). Additionally, access within large files is poor with ext3.</p></div>
<p>One last tip on installation: Make the Journal and Data volumes be distinct physical volumes. If the Journal and Data directories reside on a single physical volume, flushes to the Journal will interrupt the access of data and provide spikes of high latency within your MongoDB deployment.</p>
<h3>Operations</h3>
<p style="padding-top:0; margin-top:5px;">Once a MongoDB deployment has been promoted to production, there are a few recommendations for monitoring and optimizing performance. You should always have the MMS agent running on all MongoDB instances to help monitor the health and performance of your deployment. Additionally, this tool is also very useful if you have 10gen MongoDB Cloud Subscriptions because it provides useful debugging data for the 10gen team during support interactions. In addition to MMS, you can use the mongostat command (mentioned in the deployment section) to see runtime information about the performance of a MongoDB node. If either of these tools flags performance issues, sharding or indexing are first-line options to resolve them:</p>
<div style="margin-left:10px;">Indexes &#8211; Indexes should be created for a MongoDB deployment if monitoring tools indicate that field based queries are performing poorly. Always use indexes when you are querying data based on distinct fields to help boost performance.</p>
<p>Sharding &#8211; Sharding can be leveraged when the overall performance of the node is suffering because of a large operating data set. Be sure to shard before you get in the red; the system only splits chunks for sharding on insert or update so if you wait too long to shard you may have some uneven distribution for a period of time or forever depending on your data set and sharding key strategy.</p></div>
<p>I know it seems like we&#8217;ve covered a lot over the course of this blog post, but this list of best practices is far from exhaustive. If you want to learn more, the <a href="https://groups.google.com/forum/?fromgroups#!forum/mongodb-user">MongoDB forums</a> are a great resource to connect with the rest of the MongoDB community and learn from their experiences, and the documentation on MongoDB&#8217;s site is another phenomenal resource. The best people to talk to when it comes to questions about MongoDB are the folks at 10gen, so I also highly recommend taking advantage of MongoDB Cloud Subscriptions to get their direct support for your one-off questions and issues.</p>
<p>-Harold</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/mongodb-architectural-best-practices/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
