Book Image

Ruby and MongoDB Web Development Beginner's Guide

By : Gautam Rege
Book Image

Ruby and MongoDB Web Development Beginner's Guide

By: Gautam Rege

Overview of this book

<p>MongoDB is a high-performance, open source, schema-free document-oriented database. Ruby is an object- oriented scripting language. Ruby and MongoDB are an ideal partnership for building scalable web applications.<br /><br /><em>Ruby and MongoDB Web Development Beginner's Guide</em> is a fast-paced, hands-on guide to get started with web application development using Ruby and MongoDB. The book follows a practical approach, using clear and step-by-step instructions and examples in Ruby to demonstrate application development using MongoDB. <br /><br />The book starts by introducing the concepts of MongoDB. The book teaches everything right from the installation to creating objects, MongoDB internals, queries and Ruby Data Mappers. <br /><br />You will learn how to use various Ruby data mappers like Mongoid and MongoMapper to map Ruby objects to MongoDB documents.<br /><br />You will learn MongoDB features and deal with geo-spatial indexing with MongoDB and Scaling MongoDB. <br /><br />With its coverage of concepts and practical examples, <em>Ruby and MongoDB Web Development Beginner's Guide</em> is the right choice for Ruby developers to get started with developing websites with MongoDB as the database.</p>
Table of Contents (18 chapters)
Ruby and MongoDB Web Development Beginner's Guide
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface

Implementing sharding


Sharding is the real horizontal scaling out. Replication is to ensure data safety, failover, and high availability. Both are configured in a similar way and work in conjunction, but are conceptually very different!

Sharding is where we distribute the data among various MongoDB instances, not replicate but distribute! So, in Sodibee, we can distribute the authors based on their names.

Note

In real-world scenarios, tweets of different people can be sharded and stored in different servers. Twitter uses MySQL sharding using Gizzard. Read more here (http://engineering.twitter.com/2010/04/introducing-gizzard-framework-for.html)

PostgreSQL provides partitioning which is the same as sharding in MongoDB. Read more about it at http://www.postgresql.org/docs/current/interactive/ddl-partitioning.html.

To give you an idea of how sharding would take place, take a look at the following diagram:

Basically, all names of authors would be stored in different MongoDB instances based on some...