You are on page 1of 9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

LOG IN OR JOIN

NOSQL ZONE

HOM E

REF CARDZ

M ICROZ ONES

Z ONES

RESEARCH

SNIP P ET S

T UT ORIAL S

Search

Load Testing Made Easy: Test Your Website & Mobile app in Under 10 Minutes. Create a Free Account

NoSQL Zone is brought to you in partnership with:

CONNECT WITH DZONE

Moshe Kaplan
Bio

Website

@moshekaplan

PublishanArticle

When to Use MongoDB


Rather than MySQL (or Other
RDBMS): The Billing Example

DZone, Inc.
Seguir

31938 views

Like

54

Tweet

80

26

Share

+1

+ 5,977
Like

03.03.2014

ShareaTip

82

9.1k

Follow

28K followers

The NoSQL Zone is produced in partnership with Neo4j and Couchbase


RECOMMENDED LINKS
http://java.dzone.com/articles/when-use-mongodb-rather-mysql

1/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

NoSQL is a hot buzz in the air for a pretty long time (well, it's not only a buzz anymore).
However, when should we really use it?
Best Practices for MongoDB
NoSQL products (and among them MongoDB) should be used to meet challenges. If you have one of
the following challenges, you should consider MongoDB:

Why NoSQL?: Three trends disrupting the


database status quo
Couchbase hands-on training for mission
critical NoSQL
Faster Big Data -- Announcing Big Data
Central from Couchbase
Why are Enterprises leveraging NoSQL
FREE O'Reilly Book on Graph DBs

You Expect a High Write Load


MongoDB by default prefers high insert rate over transaction safety. If you need to load tons of data
lines with a low business value for each one, MongoDB should t. Don't do that with $1M transactions
recording or at least in these cases do it with an extra safety.
You need High Availability in an Unreliable Environment (Cloud and Real Life)
Setting replicaSet (set of servers that act as Master-Slaves) is easy and fast. Moreover, recovery
from a node (or a data center) failure is instant, safe and automatic
You need to Grow Big (and Shard Your Data)
Databases scaling is hard (a single MySQL table performance will degrade when crossing the 5-10GB
per table). If you need to partition and shard your database, MongoDB has a built in easy solution for
that.
Your Data is Location Based
MongoDB has built in spacial functions, so nding relevant data from specic locations is fast and
accurate.

Spotlight Features
Google and the TimeTraveling Killer Robots of
the Future
Write An Excellent
Programming Blog

Your Data Set is Going to be Big (starting from 1GB) and Schema is Not Stable
Adding new columns to RDBMS can lock the entire database in some database, or create a major
load and performance degradation in other. Usually it happens when table size is larger than 1GB (and
can be major pain for a system like BillRun that is described bellow and has several TB in a single
table). As MongoDB is schema-less, adding a new eld, does not effect old rows (or documents) and
http://java.dzone.com/articles/when-use-mongodb-rather-mysql

What's wrong in Java 8,


part V: Tuples

2/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

will be instant. Other plus is that you do not need a DBA to modify your schema when application
changes.

Dev of the Week: PierreHugues Charbonneau

You Don't have a DBA


If you don't have a DBA, and you don't want to normalize your data and do joins, you should consider
MongoDB. MongoDB is great for class persistence, as classes can be serialized to JSON and stored
AS IS in MongoDB. Note: If you are expecting to go big, please notice that you will need to follow
some best practices to avoid pitfalls.

POPULAR AT DZONE

How to Reuse Tiles Definitions Using


Wildcard
java.net.BindException How to handle
BindException
Lightning brings Red Hat JBoss BPM
Suite ECM telco CMIS integration demo
Android RadioGroup Example
Web service tutorial in java
Spring Framework 4.1 - handling static
web resources
Vaadin community survey 2014 results
SeemorepopularatDZone
SubscribetotheRSSfeed

/35

BillRun - Billing on top of MongoDB | MUG IL, Feb 2014 from oc666
Real World Case Study: Billing
In the last ILMUG, Ofer Cohen presented BillRun, a next generation Open Source billing solution that
utilizes MongoDB as its data store. This billing system runs in production in the fastest growing cellular
operator in Israel, where it processes over 500M CDRs (call data records) each month. In his
presentation Ofer presented how this system utilizes MongoDB advantages:

http://java.dzone.com/articles/when-use-mongodb-rather-mysql

3/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

1. Schema-less design enables rapid introduction of new CDR types to the system. It let BillRun
keep the data store generic.
2. Scale BillRun production site already manages several TB in a single table, w/o being limited by
adding new elds or being limited by growth
3. Rapid replicaSet enables meeting regulation with easy to setup multi data center DRP and HA
solution.
4. Sharding enables linear and scale out growth w/o running out of budget.
5. With over 2,000/s CDR inserts, MongoDB architecture is great for a system that must support high
insert load. Yet you can guarantee transactions with ndAndModify (which is slower) and twophase commit (application wise).
6. Developer oriented queries, enable developers write a elegant queries.
7. Location based is being utilized to analyze users usage and determining where to invest in cellular
infrastructure.
Bottom Line
MongoDB is great tool, that should be used in the right scenarios to gain unfair advantage in your
market. BillRun is a ne example for that.
Keep Performing,
Moshe Kaplan
Published at DZone with permission of Moshe Kaplan, author and DZone MVB. (source)
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: MongoDB
Methods

MySQL

Tips and Tricks

NoSQL

Architecture

Tools &

The NoSQL Zone is produced in partnership with Neo4j and Couchbase

Comments
http://java.dzone.com/articles/when-use-mongodb-rather-mysql

4/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

First Last replied on Mon, 2014/03/03 - 8:26am


> You Don't have a DBA
srlsly?

Login or register to post comments

Alex Staveley replied on Wed, 2014/03/05 - 10:12am


Nice article. I have heard Web developers makes the point that since Mongo is
more JSON friendly that is another argument to use it. So when AJAX requests are
sending and receiving if you use MongoDB, you get the option to persist and
retrieve JSON very easily almost negating the need for a traditional server. What do
you think of that?

Login or register to post comments

Sumendra Maharjan replied on Mon, 2014/06/09 - 11:48am


true, mysql and mongodb has their own territory, mongodb is new in the world of
database and is rapidly adopted by complex web application in conjunction with
nodejs. But in performancewise, mongodb wins as it is BSON based and no need of
JOIN operator to query multiple tables. Mongodb is popular and easy to used
because of it's simplicity and javascript friendly. Read Comparison Between MySQL
and MongoDB

Login or register to post comments

http://java.dzone.com/articles/when-use-mongodb-rather-mysql

5/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

Moshe Kaplan replied on Tue, 2014/06/10 - 5:08pmin response to: Alex Staveley
Hi Alex,
You are absolutly right!
The End to End JSON support is one of the best features of the MEAN platform
(that includes MongoDB as its initial),
Keep Performing,
Moshe Kaplan

Login or register to post comments

Moshe Kaplan replied on Tue, 2014/06/10 - 5:09pm


in response to: Sumendra Maharjan
Hi Sumendra,
This is a good analysis. Please notice that you need to be careful in MongoDB data
design to gain best performance,
Keep Performing,
Moshe Kaplan

Login or register to post comments

Comment viewing options


Flat list expanded

Date oldest first

http://java.dzone.com/articles/when-use-mongodb-rather-mysql

30 comments per page

Save settings

6/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

Select your preferred way to display the comments and click "Save settings" to activate your
changes.
AROUND THE DZONE NETWORK
ARCHITECTS

JAVALOBBY

ARCHITECTS

JAVALOBBY

JAVALOBBY

SERVER

TopPostsof2013:Big
DataBeyond
MapReduce:Goog...

TopPostsof2013:The
PrinciplesofJava
Applicat...

5ThingsaJava
DeveloperShould
ConsiderThisYea...

TopPostsof2013:
ThereAreOnly2
RolesofCode

SingletonDesign
PatternAn
Introspectionw/B...

BestBestPractices
Ever

YOU MIGHT ALSO LIKE


NotEvenAppleKnowsSwiftYet
AnIntroductiontoFabric8andWhyIt'sSoImportantforIntegration
TrustinsteadofThreats
Dockerusingprivateregistry
DZone's200thRefcardReleased:JavaPerformanceOptimization
DZoneResearchCloudNewsUpdate(July21)
SpringMVC3ViewControllerExample
DevoftheWeek:PierreHuguesCharbonneau
QuickTip:AngularJSControllerDestructor
DesigningaDataArchitecturetoSupportbothFastandBigData
WhyistheFundamentalTheoremofSoftwareEngineeringFundamental?
OpenCompute,OpenSwitchAPIandOpenNetworkInstallEnvironment
TheBestoftheWeek(July11):NoSQLZone
SharingProgramming
There'saBotonTwitterThatSellsOpenStackInstancesforBitcoin

http://java.dzone.com/articles/when-use-mongodb-rather-mysql

7/9

25/7/2014

POPULAR ON JAVALOBBY

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

SPOTLIGHT
RESOURCES

SpringBatchHelloWorld
IsHibernatethebestchoice?
HowtoCreateVisualApplications
inJava?
9ProgrammingLanguagesTo
WatchIn2011
IntroductiontoOracle'sADFFaces
RichClientFramework
Lucene'sFuzzyQueryis100times
fasterin4.0

Camel
Essential
Components
DZone's170th
Refcardisan
essentialreference
toCamel,anopen
source,lightweight,
integrationlibrary.
ThisRefcardis
authoredby...

Interview:JohnDeGoesIntroduces
aNewlyFreeSourceCodeEditor
TimeSlider:OpenSolaris2008.11
KillerFeature

LATEST ARTICLES
Dodoctorsknowwhatpatients
know?
Talktoinvestors,raisefunds,and
researchthemarketinasingle
securespace
UsingthecrowdtoimproveGPS
Delightedtoannounce.
IdentifyingJVMTrickierThan
Expected
CompressedBacklogRefinement
GettingStartedwithHome
Automation(PartI)

Essential
Couchbase
APIs: Open
Source NoSQL
Data Access
from Java,
Ruby, and
.NET

Practical DNS:
Managing
Domains for
Safety,
Reliability,
and Speed

TestAttribute#5Differentiation

Search

http://java.dzone.com/articles/when-use-mongodb-rather-mysql

8/9

25/7/2014

When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby

DZ o n e
Refcardz
TechLibrary
Snippets
AboutDZone
Tools&Buttons

T o p i cs
BookReviews
ITQuestions
MyProfile
Advertise
SendFeedback

HTML5
Cloud
.NET
PHP
Performance
Agile

F o llo w Us
WindowsPhone
Mobile
Java
Eclipse
BigData
DevOps

Google+
Facebook
LinkedIn

"Startingfromscratch"is
seductivebutdiseaseridden

PithyAdviceforProgrammers

Twitter

Advertising - Terms of Service - Privacy - 1997-2014, DZone, Inc.

http://java.dzone.com/articles/when-use-mongodb-rather-mysql

9/9

You might also like