ibm power systems_solution_for_mongodb

23
IBM Power Systems solution for MongoDB A solution guide to implement MongoDB on IBM Power Systems running Linux featuring the new IBM POWER8 technology Hari Reddy, Maya Pandya, Mark Nellen IBM Systems and Technology Group ISV Enablement Luke Browning, Corentin Baron IBM Systems and Technology Group, Enterprise Systems and Technology Development Calvin Sze IBM Systems and Technology Group, Power Systems Performance July 2014 © Copyright IBM Corporation, 2014

Upload: juanrebes

Post on 11-Nov-2014

169 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

IBM Power Systems solution for MongoDB

A solution guide to implement MongoDB on IBM Power Systems running Linux

featuring the new IBM POWER8 technology

Hari Reddy, Maya Pandya, Mark Nellen IBM Systems and Technology Group ISV Enablement

Luke Browning, Corentin Baron

IBM Systems and Technology Group, Enterprise Systems and Technology Development

Calvin Sze

IBM Systems and Technology Group, Power Systems Performance

July 2014

© Copyright IBM Corporation, 2014

IBM Power Systems solution for MongoDB

Table of contents Abstract........................................................................................................................................1 Introduction .................................................................................................................................1 Prerequisites ...............................................................................................................................2 Introduction to MongoDB...........................................................................................................2 MongoDB architecture................................................................................................................3

MongoDB server ...................................................................................................................................... 4 MongoDB client drivers............................................................................................................................ 4 Increasing the throughput of MongoDB................................................................................................... 4

Replicas in MongoDB........................................................................................................ 4 Sharding in Mongo DB ...................................................................................................... 5

Implementation of MongoDB .....................................................................................................6 System configuration ...............................................................................................................................6

Hardware configuration ..................................................................................................... 6 Software configuration....................................................................................................... 7

Build and install MongoDB....................................................................................................................... 7 Prebuilt MongoDB package............................................................................................... 7 Build MongoDB from source ............................................................................................. 9

Starting MongoDB server ...................................................................................................................... 12 MongoDB clients.................................................................................................................................... 13

Power Systems built with POWER8 technology ....................................................................14 Memory management in Power Systems and MongoDB operation...................................................... 16 Hardware prefetch ................................................................................................................................. 17

Summary....................................................................................................................................18 Resources..................................................................................................................................19 About the authors .....................................................................................................................19 Trademarks and special notices..............................................................................................20

1

Abstract This white paper describes MongoDB (from humongous), which is an open source NoSQL style, document database with dynamic schema. The paper discusses the main features of the MongoDB solution, its architecture and implementation on IBM Power Systems running Linux. The target audience is users and system integrators who implement MongoDB on IBM Power Systems running Linux servers. No familiarity with MongoDB or IBM Power Systems running Linux is required; however, some familiarity with the basics of Linux commands is required.

Introduction Relational databases such as IBM® DB2®, MySQL, and Oracle are in widespread use in applications dealing with large amounts of data that fit well into a tabular structure and support a well-defined query

language to retrieve data. NoSQL type databases do not typically store the data into a well-defined table, but can be in any other format. MongoDB is one such open source NoSQL database. Examples of other NoSQL database management tools include Cassandra and Riak and they each have their own non-

standardized application programming interface (API) for accessing the data, and have other unique benefits.

IBM’s latest entry (at the time of this publication) into its IBM Power Systems™ portfolio is built for bigger

demands of data stored and manipulated in these next-generation databases such as MongoDB. These are systems built on the first generation of IBM POWER8™ innovative design for very demanding, data-intensive applications.

Built with the first processor designed for such data workloads, IBM Power Systems design combines the computing power, memory bandwidth, and I/O in ways that are easier to consume and manage, building on strong resiliency, availability and security, demonstrated by:

Computing power with 50% more cores and smart acceleration enabled by the Coherent Accelerator Processor Interface (CAPI).

Massive memory with over twice the bandwidth of prior generation servers to process data faster

and achieve greater speed and efficiency for transactional applications such as MongoDB.

Systems that are easy to deploy and manage with open source technologies such as OpenStack, KVM, simplified virtualization management, and flexible capabilities to drive rapid adoption and

dramatically simplify IT consumption.

Better cloud economics for scale out infrastructures, with price-performance advantages and security to confidently move data-centric applications to the cloud.

The subsequent sections provide an overview of MongoDB and the instructions to build, install, and run MongoDB on IBM Power Systems running Linux.

IBM Power Systems solution for MongoDB

2

Prerequisites No prior knowledge of MongoDB is assumed. Basic familiarity with commands and tools used in Linux® and Power Systems running Linux will be very helpful.

Introduction to MongoDB MongoDB is an open source document database with the following features:

Dynamic schema JavaScript Object Notation (JSON)-style documents with dynamic schemas offer simplicity

and power. Full-index support

Index on any attribute, just like relational databases

Replication and high availability Mirror across local area networks (LANs) and wide area networks (WANs) for scale and peace of mind.

Auto-sharding Scale horizontally without compromising functionality.

Querying

Rich, document-based queries.

The relational database concepts can be mapped to MongoDB (refer to Table 1).

Relational DB MongoDB

Database Database

Table Collection

Row Document or binary JSON (BSON) document

Column Field

Index Index

Table joins Embedded documents and linking

Primary key Primary key

Table 1.Mapping relations database components to MondgoDB.

However, the similarity ends there. Because each document in MongoDB is stored in the BSON format,

this gives the flexibility of a dynamic schema that makes it easier to evolve your data model than with a system with enforced schemas such as a relational database. In simple terms, the schema definition can vary between documents and can change over time within a document (refer to Table 2).

IBM Power Systems solution for MongoDB

3

Time Stamp Record ID Operation Attributes

1 1 Create {‘”Name”: “Henry”}

2 2 Create {“Name”: “Peter” }

3 1 Update {“Name” : “Henry”, Education: “MS”}

4 2 Update {“Name”: “Peter”, “Hobby” : “Archery” }

5 1 Update {Name : “Henry”, Education: “MD’, “Experience”: 10}

Table 2: Examples of a dynamic schema

MongoDB architecture MongoDB is based on the client/server architecture and it consists of the following components (refer to

Figure 1):

MongoDB server MongoDB client drivers

Optional - MongoDB replica servers - MongoDB Shard Servers

Figure 1. Client/Server architecture in MongoDB

IBM Power Systems solution for MongoDB

4

MongoDB server

MongoDB server is written in American National Standards Institute (ANSI) for the C++ programming language. The mongod is the database process that runs on an individual server. It handles data requests,

manages data format, and performs background management operations. There are several command-line options for the mongod command and also it is common to enter them into a single text file and enter the file as a single parameter to the mongod command. After started, the mongod process will be listening

on 27017 by default. For more details about the mongod process, refer to

http://docs.MongoDB.org/manual/reference/program/mongod/.

MongoDB client drivers

An application communicates with MongoDB by way of a client library, called a driver, that handles all

interaction with the database in a language appropriate to the application (refer to Figure 1). A large number of client libraries written in a variety of languages (C++, Java, PHP, Ruby, and so on) are available (refer to http://docs.MongoDB.org/manual/applications/drivers/). The MongoDB installation package includes mongo,a shell-based on JavaScript language. mongo can be used to connect to the server to

perform database administrative operations and try out all database operations (for example, insert, update, and so on) supported in MongoDB.

If both client and server reside on the same system, they can communicate using either TCP/IP or UNIX® domain socket protocols. UNIX domain sockets offer faster communication and hence higher transaction rates between the client and the MongoDB server. Using the UNIX domain socket is the default method of

communication between the server and the client when they reside on the same system.

Increasing the throughput of MongoDB

When the query demand exceeds the capacity of a single MongoDB server, the following are the two approaches to increase the query-processing capability.

Replicating the database on multiple servers (replication) Partitioning and allocating the partitions to multiple servers (sharding)

Replicas in MongoDB

The MongoDB replicas served by secondary servers are used to provide additional capacity to handle high customer demands (refer to Figure 2). In addition, replicas can be used in disaster recovery. The replicas can be effective when write operations are significantly less than read operations.

IBM Power Systems solution for MongoDB

5

Figure 2. Data replication in MongoDB

Sharding in Mongo DB

Sharding in MongoDB is partitioning a database into non-overlapping shards or chunks and distributing them on multiple servers. Each chunk is managed by an independent MongoDB process, mongod, running on a separate server. Collectively, this increases the query-processing capability

almost linearly with a number of servers (refer to Figure 3 ).

The MongoDB routing process, mongos, tracks what data is on which shard by caching the metadata

from the configuration servers. The mongos uses the metadata to route operations from applications and clients to the mongod instances. The mongos returns the results, received form mongod instances, to the clients. The mongos provides the only interface to a sharded cluster from the

perspective of applications. Applications never connect or communicate directly with the shards. For detailed treatment of sharding in MongoDB, refer to http://docs.mongodb.org/manual/sharding/.

.

.

IBM Power Systems solution for MongoDB

6

Figure 3.Data sharding in MongoDB

Implementation of MongoDB In this section, a sequence of steps to build, install, and run MongoDB on Power Systems running Linux is

described.

System configuration

The configuration that was used to install and run MongoDB is described in this section:

Hardware configuration

IBM Power Systems:

Model: IBM Power® S824 Processor: Two IBM POWER8 4.15 GHz 8 core

Number of cores: 16 Memory: 128 GB

IBM Power Systems solution for MongoDB

7

Software configuration

OS: Red Hat Enterprise Linux 6.5

MongoDB: 2.4.9 (ppc64 version) MongoDB configuration:

- Both mongod and mongo shell instances ran on the same server

- UNIX domain sockets was used as the communication method (also the default)

Build and install MongoDB

There are two ways in which users can install MongoDB on Power Systems running Linux:

Install from prebuilt MongoDB binary files available from IBM.

Build and install MongoDB binary files from the MongoDB source.

Prebuilt MongoDB package

MongoDB and the mongo shell use V8 for all JavaScript execution. V8 is Google's open source

JavaScript engine. Prebuilt binary files for MongoDB and Google V8 for Power Systems running Linux are available from IBM (refer to Listing 1).

IBM Power Systems solution for MongoDB

8

# cd /data/bench/paper # yum install wget # yum install boost-devel # wget ftp://ftp.software.ibm.com/linux/rpms/redhat/6.5/v8-3.14.5.10-2.el6.ppc64.rpm # rpm –ivh v8-3.14.5.10-2.el6.ppc64.rpm # wget ftp://ftp.software.ibm.com/linux/rpms/redhat/6.5/libmongodb-2.4.9-1.el6.ppc64.rpm # rpm –ivh libmongodb-2.4.9-1.el6.ppc64.rpm # wget ftp://ftp.software.ibm.com/linux/rpms/redhat/6.5/mongodb-server-2.4.9-1.el6.ppc64.rpm # rpm –ivh mongodb-server-2.4.9-1.el6.ppc64.rpm # wget ftp://ftp.software.ibm.com/linux/rpms/redhat/6.5/mongodb-2.4.9-1.el6.ppc64.rpm # rpm –ivh mongodb-2.4.9-1.el6.ppc64.rpm # which mongod /usr/bin/mongod # which mongo /usr/bin/mongo # ls /usr/bin/*mongo* /usr/bin/mongo /usr/bin/mongodump /usr/bin/mongofiles /usr/bin/mongooplog /usr/bin/mongorestore /usr/bin/mongosniff /usr/bin/mongotop /usr/bin/mongod /usr/bin/mongoexport /usr/bin/mongoimport /usr/bin/mongoperf /usr/bin/mongos /usr/bin/mongostat # ls /usr/lib64/*v8* /usr/lib64/libv8.so /usr/lib64/libv8.so.3 /usr/lib64/libv8.so.3.14 /usr/lib64/libv8.so.3.14.5 # ls /usr/lib64/*mongo* /usr/lib64/libmongoclient.so

User input is black System response is in orange

Listing 1. Installing Google V8 JavaScript Engine and MongoDB form prebuilt packages available form IBM

IBM Power Systems solution for MongoDB

9

Several MongoDB binary files are installed and two of these binary files are:

mongod – MongoDB server daemon

mongo – MongoDB client shell built using JavaScript

The “Starting MongoDB server” section and the “MongoDB clients” section explain how to start the MongoDB server and MongoDB client.

Build MongoDB from source

The MongoDB source, ported to Power Systems running Linux, is available in the r2.4.9-ppc branch at https://github.com/ibmsoe/mongo/archive/r2.4.9-ppc.zip. This is currently maintained in a private

branch in the github repository. Work is in progress to integrate the changes to the main branch of the MongoDB source tree, and at that time, the source can be downloaded from the official repository of MongoDB on github.com or MongoDB.org.

The following prerequisites are needed to build MongoDB from source:

v8-devel – v8 is Google's open source JavaScript engine python-devel - Python is a general-purpose, high-level programming language

scons - a build system (build tool) written in Python openssl-devel – a open source toolkit implementing the secure sockets layer (SSL) boost-devel – a portable C++ source libraries

readline-devel – a GNU library to edit command lines snappy-devel - a compression/decompression library

You can download MondoDB source for Power Systems running Linux in one of the following two

ways:

wget (refer to Listing 2) git clone (refer to Listing 3 )

IBM Power Systems solution for MongoDB

10

cd /data/bench/paper yum install wget wget https://github.com/ibmsoe/mongo/archive/r2.4.9-ppc.zip ls r2.4.9-ppc unzip r2.4.9-ppc.zip ls mongo-r2.4.9-ppc r2.4.9-ppc cd mongo-r2.4.9-ppc ls APACHE-2.0.txt buildscripts CONTRIBUTING.rst debian Distsrc docs doxygenConfig GNU-AGPL-3.0.txt Jstests mongo_astyle README rpm SConscript.buildinfo SConscript.smoke SConstruct site_scons src valgrind.suppressions win2008plus.props yum install python-devel scons openssl-devel boost-devel readline-devel snappy-devel wget ftp://ftp.software.ibm.com/linux/rpms/redhat/6.5/v8-devel-3.14.5.10-2.el6.ppc64.rpm rpm –ivh v8-devel-3.14.5.10-2.el6.ppc64.rpm scons all -j2 --use-system-tcmalloc --use-system-pcre --use-system-snappy --prefix=${HOME}/usr --extrapath=usr --usev8 --nostrip --ssl --full scons install -j2 --use-system-tcmalloc --use-system-pcre --use-system-snappy --prefix=${HOME}/usr --usev8 --nostrip --ssl --full

Install Prereqs

Download source

Download and install v8-devel – Google Java Script Engine

Compile mongoDB - -j can be used to use more cores to compile e.g., -j16 - -prefix is used as placeholder to point to placement of mongoDB executables during

the install step, the executables are held at the local working dir at the end of this step.

Compile mongoDB - -j can be used to use more cores to compile e.g., -j16 - -prefix is used to instruct the system where the executables, created during the

compile step, are installed. A copy of the executables is placed in the current working directory as well.

Listing 2. Building and installing MongoDB using the source downloaded with wget

IBM Power Systems solution for MongoDB

11

cd /data/bench/paper yum install git git clone [email protected]:ibmsoe/mongo.git cd mongo ls APACHE-2.0.txt buildscripts CONTRIBUTING.rst debian Distsrc docs doxygenConfig GNU-AGPL-3.0.txt Jstests mongo_astyle README rpm SConscript.buildinfo SConscript.smoke SConstruct site_scons src valgrind.suppressions win2008plus.props yum install python-devel scons openssl-devel boost-devel readline-devel snappy-devel wget ftp://ftp.software.ibm.com/linux/rpms/redhat/6.5/v8-devel-3.14.5.10-2.el6.ppc64.rpm rpm –ivh v8-devel-3.14.5.10-2.el6.ppc64.rpm scons all -j2 --use-system-tcmalloc --use-system-snappy --prefix=${HOME}/usr --usev8 --nostrip –ssl --full scons install -j2 --use-system-tcmalloc --use-system-snappy --prefix=${HOME}/usr --usev8 --nostrip --ssl --full

Install Prereqs

Download source using github account Prereqs: 1) create an account on github.com 2) Follow https://help.github.com/articles/generating-ssh-keys to create and upload public keys

Download and install v8-devel – Google Java Script Engine

Compile mongoDB - -j can be used to use more cores to compile e.g., -j16 - -prefix is used as placeholder to point to placement of mongoDB executables during

the install step, the executables are held at the local working dir at the end of this step.

Compile and install mongoDB - -j can be used to use more cores to compile e.g., -j16 - -prefix is used to instruct the system where the executables created during the

compile step are installed. A copy of the executables is placed in the current working directory as well.

Listing 3. Building and installing MongoDB using the source downloaded with the github account

IBM Power Systems solution for MongoDB

12

Starting MongoDB server

MongoDB server communicates with MongoDB clients through a socket interface. If both: MongoDB client and MongoDB server reside on the same server, there is a choice of using either the UNIX domain or the

TCP/IP socket interface. UNIX domain sockets are more efficient and are recommended. The default communication method between the server and the clients is thorough UNIX domain sockets. This can be overridden by setting the --nounixsocket parameter to mongod. Operation of the MongoDB server is

controlled by the several operational parameters that are specified either as parameters to the mongod

command or in a configuration file. A default configuration file, mongod.conf, is supplied with the installation. Create a working directory and copy the mongod.conf file form the installation directory to the

working directory, as shown in Listing 4.

IBM Power Systems solution for MongoDB

13

# cd /data/bench/paper # mkdir mogodb # cd mongodb # cp /etc/mongod.conf . # which mongod /usr/bin/mongod # mongod –dbpath /data/bench/paper/mongodb --conf mongod.conf Sat Apr 12 16:24:23.510 [initandlisten] MongoDB starting : pid=50941 port=27017 dbpath=/data/bench/paper/mongodb 64-bit host=p231n135.pbm.ihost.com Sat Apr 12 16:24:23.511 [initandlisten] Sat Apr 12 16:24:23.511 [initandlisten] ** WARNING: You are running on a NUMA machine. Sat Apr 12 16:24:23.511 [initandlisten] ** We suggest launching mongod like this to avoid performance problems: Sat Apr 12 16:24:23.511 [initandlisten] ** numactl --interleave=all mongod [other options] Sat Apr 12 16:24:23.511 [initandlisten] Sat Apr 12 16:24:23.511 [initandlisten] ** WARNING: /proc/sys/vm/zone_reclaim_mode is 1 Sat Apr 12 16:24:23.511 [initandlisten] ** We suggest setting it to 0…. Sat Apr 12 16:24:23.608 [websvr] admin web console waiting for connections on port 28017 Sat Apr 12 16:24:23.608 [initandlisten] waiting for connections on port 27017 Sat Apr 12 17:16:09.529 [initandlisten] connection accepted from 127.0.0.1:35534 #3 (1 connection now open) Sat Apr 12 17:16:27.961 [conn3] end connection 127.0.0.1:35534 (0 connections now open) Sat Apr 12 17:17:37.269 [initandlisten] connection accepted from 127.0.0.1:35535 #4 (1 connection now open) Sat Apr 12 17:17:53.781 [conn4] end connection 127.0.0.1:35535 (0 connections now open)

The warning message about starting mongod with numactl can be ignored for now. It will be be discussed later in the section: Memory management in MongoDB.

At this time, the MongodDB server is waiting for connections from clients. See the section on MongoDB clients on how to start a client using mongo, MongoDB shell based on JavaScript. As noted below, as connections add and drop the log will reflect the changes.

Listing 4. MongoDB server

MongoDB clients

MongoDB installation supplies a JavaScript based shell, mongo, to start a client to connect to the

MongoDB server. External clients using a variety of language bindings are available in the open source community (refer to http://docs.mongodb.org/manual/applications/drivers/).

IBM Power Systems solution for MongoDB

14

.

which mongo /usr/bin/mongo # mongo > db.version() 2.4.9-rc0 db.help() db.stats() > db.users.insert ({Name: 'Henry'}) > db.users.find() { "_id" : ObjectId("5349b0e1c724324fc8ce55d3"), "Name" : "Henry" } > db.users.insert ({Name: 'Peter'}) > db.users.find() { "_id" : ObjectId("5349b0e1c724324fc8ce55d3"), "Name" : "Henry" } { "_id" : ObjectId("5349b111c724324fc8ce55d4"), "Name" : "Peter" } > db.users.update ( { Name: 'Henry'}, {$set: {Education: 'MS'}}) > db.users.update ( { Name: 'Peter'}, {$set: {Hobby: 'Archery'}}) > db.users.find() { "_id" : ObjectId("5349b0e1c724324fc8ce55d3"), "Name" : "Henry", "Education" : "MS" } { "Hobby" : "Archery", "Name" : "Peter", "_id" : ObjectId("5349b111c724324fc8ce55d4") } > db.users.update ( { Name: 'Henry'}, {$set: {Education: 'MD', Experience: 10}}) > db.users.find() { "Hobby" : "Archery", "Name" : "Peter", "_id" : ObjectId("5349b111c724324fc8ce55d4") } { "Education" : "MD", "Experience" : 10, "Name" : "Henry", "_id" : ObjectId("5349b0e1c724324fc8ce55d3") } > db.users.find({Experience: 10}) { "Education" : "MD", "Experience" : 10, "Name" : "Henry", "_id" : ObjectId("5349b0e1c724324fc8ce55d3") } db.shutdownServer({timeoutSecs: 1}); Sat Apr 12 18:03:03.831 DBClientCursor::init call() failed server should be down...

Listing 5. MongoDB client

You can try some of the examples provided in Listing 5 . For more details about MongoDB commands,

refer to http://docs.mongodb.org/manual/tutorial/getting-started-with-the-mongo-shell/. An interactive online tutorial is available at http://try.mongodb.org/.

Power Systems built with POWER8 technology IBM POWER8 is a multicore, multichip (node), and multisocket system. The number of chips and sockets

available vary with the model purchased. A representative layout of the POWER8 processor is given in Figure 4.

IBM Power Systems solution for MongoDB

15

Figure 4. POWER8 processor

The following commands are used to get and set important system configuration parameters:

numactl

ppc64_cpu

numactl can be used to query core and memory configuration (refer to Listing 6). This information taken

in conjunction with the output from the ppc65_cpu command helps to identify how many sockets and

cores are available in the system and their identities. Depending on the operational requirements, this information can be useful to specify allocation of memory across the processor nodes.

IBM Power Systems solution for MongoDB

16

# numactl –hardware numactl --hardware available: 4 nodes (0-3) node 0 cpus: 0 4 8 12 16 20 node 0 size: 63488 MB node 0 free: 43968 MB node 1 cpus: 24 28 32 36 40 44 node 1 size: 63488 MB node 1 free: 38798 MB node 2 cpus: 48 52 56 60 64 68 node 2 size: 64256 MB node 2 free: 59046 MB node 3 cpus: 72 76 80 84 88 92 node 3 size: 62208 MB node 3 free: 31554 MB

This configuration has:

Two sockets Each Socket has two chips (nodes) Each chip has

Six cores and 64GB memory

Listing 6. numactl output

Some of the system features that might have some effect on the operation of MongoDB are:

Memory management in Power Systems Hardware prefetch

Memory management in Power Systems and MongoDB operation

Each processor chip in a POWER8 processor-based server is independent of its own caches and memory

controllers. In building a large database, which is file-based for persistency, the amount of memory a multithreaded process such as mongod requires can far exceed what is locally available in a single

processor node (chip). Such applications can benefit from uniformly distributing (or interleaving) the

memory requests across all nodes in the system.

In addition, if the local memory module on the chip local to a process is oversubscribed and the system is configured to reclaim local memory where the memory allocation is requested, then the system swaps the

memory on the local chip to a disk although free memory is available on a remote chip in the system. Swapping the memory to a disk is much more expensive than allocating memory to a remote chip.

The system can be instructed not to reclaim local memory by setting the following system flag (root

permission is required). These two concepts, interleaving of memory requests and stopping the system from reclaiming node memory, are illustrated in Listing 7. For more information about the memory management in MongoDB, refer to http://docs.mongodb.org/manual/administration/production-notes/.

IBM Power Systems solution for MongoDB

17

# cd /data/bench/paper/mongodb # which mongod mongo # numactl numactl --interleave=all mongod --dbpath /data/bench/paper/mongodb Next, disable zone reclaim in the proc settings using the following steps:

1. View the status of the zone reclaim setting by typing the following command:

cat /proc/sys/vm/zone_reclaim_mode If the value of zone_reclaim_mode is 0, zone reclaim is disabled. If the value of zone_reclaim_mode is any other value, zone reclaim is enabled. For Red Hat Enterprise Linux version 6 and later, values other than 0 and 1 are allowed

2. Disable zone reclaim by modifying the system in one of the following ways:

o Disable zone reclaim for one instance (not persistent) by typing the following command:

echo 0 > /proc/sys/vm/zone_reclaim_mode o To permanently disable zone reclaim, complete the following

steps: a. Edit the /etc/sysctl.conf file by adding the following

information: vm.zone_reclaim_mode=0 Every time you reboot the system, the system automatically uses the settings in the sysctl.conf file.

b. Optional: To disable zone reclaim without rebooting, run the following command after you exit the sysctl.conf file:

sysctl -p

Listing 7. Interleaving memory uniformly across all nodes and disabling zone reclaim

Hardware prefetch

When the data access patterns are predictable, such information can be used by the processor to prefetch the data from memory in order to hide the latency delay in getting the data to faster processors. In the case of MongoDB, the memory accesses are very random and therefore, might not result in any

improvement in performance and might even hinder performance. It is recommended to turn off hardware prefetch, as indicated in Listing 8.

# ppc64_cpu --dscr dscr is 0 # ppc64_cpu –dscr=1

dscr=0 means HW prefetch is ON ddsc=1 means HW prefetch is OFF

Listing 8.Hardware prefetch flag

IBM Power Systems solution for MongoDB

18

Summary Popular relational databases that are available in the industry today use predefined schema to manipulate data. MongoDB belongs to a new class of databases where a predefined schema does not exist. Thus,

MongoDB is very flexible and adaptive to rapidly changing requirements. In this solution guide, the concepts behind MongoDB and how to install MongoDB and run some sample MongoDB commands on IBM Power Systems running Linux were introduced. Then, an overview of IBM POWER8 technology was

given. POWER8 is IBM’s latest offering (at the time of this publication) to its Power Systems family to tackle the ever-increasing, data-intensive applications. Finally, a few recommendations to run MongoDB applications efficiently on IBM Power Systems running Linux built with POWER8 technology were given.

IBM Power Systems solution for MongoDB

19

Resources The following websites provide useful references to supplement the information contained in this paper:

IBM Systems on PartnerWorld

ibm.com/partnerworld/systems

IBM Power Systems

ibm.com/systems/in/power/?lnk=mhpr IBM Power Systems Hardware Documentation

http://pic.dhe.ibm.com/infocenter/powersys/v3r1m5/index.jsp

IBM Power Systems running Linux – resources

ibm.com/systems/power/software/linux/resources.html

MonfoDB official website

http://mongodb.org

Interactive MongoDB tutorial

http://try.mongodb.org

IBM Publications Center

www.elink.ibmlink.ibm.com/public/applications/publications/cgibin/pbi.cgi?CTY=US

About the authors Hari Reddy is a consultant in IBM Systems and Technology Group, ISV Enablement organization. You can reach Hari at [email protected].

Corentin Baron is a Technical Consultant in IBM Systems and Technology Group, Enterprise Systems and Technology Development organization. You can reach Corentin at [email protected].

Calvin Sze is a Performance Analyst in IBM Systems and Technology Group, Power Systems

Performance organization. You can reach Calvin at [email protected].

Luke Browning is a Senior Technical Staff member in IBM Systems and Technology Group, Enterprise Systems and Technology Development organization. You can reach Luke at [email protected].

Maya Pandya is a Technology Manager in IBM Systems and Technology Group, ISV Enablement organization. You can reach Maya at [email protected].

Mark Nellen is a Program Manager in IBM Systems and Technology Group, ISV Enablement organization.

You can reach Mark at [email protected].

IBM Power Systems solution for MongoDB

20

Trademarks and special notices © Copyright IBM Corporation 2014.

References in this document to IBM products or services do not imply that IBM intends to make them

available in every country.

IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked

terms are marked on their first occurrence in this information with a trademark symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A

current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Linux is a trademark of Linus Torvalds in the United States, other countries, or both.

Other company, product, or service names may be trademarks or service marks of others.

Information is provided "AS IS" without warranty of any kind.

All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer.

Information concerning non-IBM products was obtained from a supplier of these products, published announcement material, or other publicly available sources and does not constitute an endorsement of such products by IBM. Sources for non-IBM list prices and performance numbers are taken from publicly

available information, including vendor announcements and vendor worldwide homepages. IBM has not tested these products and cannot confirm the accuracy of performance, capability, or any other claims related to non-IBM products. Questions on the capability of non-IBM products should be addressed to the

supplier of those products.

All statements regarding IBM future direction and intent are subject to change or withdrawal without notice, and represent goals and objectives only. Contact your local IBM office or IBM authorized reseller for the

full text of the specific Statement of Direction.

Some information addresses anticipated future capabilities. Such information is not intended as a definitive statement of a commitment to specific levels of performance, function or delivery schedules with respect to

any future products. Such commitments are only made in IBM product announcements. The information is presented here to communicate IBM's current investment and development activities as a good faith effort to help with our customers' future planning.

Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the

storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve throughput or performance improvements equivalent to the ratios stated here.

IBM Power Systems solution for MongoDB

IBM Power Systems solution for MongoDB

21

Photographs shown are of engineering prototypes. Changes may be incorporated in production models.

Any references in this information to non-IBM websites are provided for convenience only and do not in

any manner serve as an endorsement of those websites. The materials at those websites are not part of the materials for this IBM product and use of those websites is at your own risk.