Upload
manuel-cazares
View
218
Download
0
Embed Size (px)
Citation preview
8/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
1/9
DZone, Inc.
+ 5,977
Seguir +1
CONNECT WITH DZONE
RECOMMENDED LINKS
9.1kLike
HOM E REFCARDZ M ICROZONES ZONES RESEARCH SNIPPET S T UT ORIALS
http://www.dzone.com/tutorials/http://dzone.com/snippets/http://dzone.com/researchhttp://java.dzone.com/domainhttp://www.dzone.com/mzhttp://refcardz.dzone.com/http://www.dzone.com/https://plus.google.com/+dzone?prsrc=58/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
2/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 2/9
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:
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 fit. 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 finding relevant data from specific locations is fast and
accurate.
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 singletable). As MongoDB is schema-less, adding a new field, does not effect old rows (or documents) and
Why NoSQL?: Three trends disrupting thedatabase status quo
Couchbase hands-on training for missioncritical NoSQL
Faster Big Data -- Announcing Big DataCentral from Couchbase
Why are Enterprises leveraging NoSQL
FREE O'Reilly Book on Graph DBs
Google and the Time-
Traveling Killer Robots of
the Future
Write An Excellent
Programming Blog
What's wrong in Java 8,
part V: Tuples
http://ft850227.api.open%28%27http//adclick.g.doubleclick.net/aclk?sa=L&ai=BzCL_mXrSU9SNGeyxwAHw2oCIBZbLgKcFAAAAEAEg4tPyBjgAWK6n6t-oAWDlg_aElBayAQ5qYXZhLmR6b25lLmNvbboBCWdmcF9pbWFnZcgBCdoBPGh0dHA6Ly9qYXZhLmR6b25lLmNvbS9hcnRpY2xlcy93aGVuLXVzZS1tb25nb2RiLXJhdGhlci1teXNxbMACAuACAOoCJi8yOTE2MDcwL3pvbmVzX3NpZGViYXJfMzM2eDI4MF9kZWZhdWx0-AL-0R6AAwGQA6QDmAPgA6gDAeAEAaAGFg&num=0&sig=AOD64_0S0OPZr3S39eq6TzP2CPtER5FGLg&client=ca-pub-3945085396033279&adurl=http://servedby.flashtalking.com/click/4/34643;850227;772540;210;0/?g=2397EEF073E974&random=810025603&ft_width=300&ft_height=250&url=http://info.couchbase.com/2014-Benchmark-Showdown-Results-LP.html%27);http://txt.couchware.com/medias/jump?hid=3101&cid=503&mid=1209http://txt.couchware.com/medias/jump?hid=3205&cid=527&mid=1311http://txt.couchware.com/medias/jump?hid=3213&cid=527&mid=1319http://txt.couchware.com/medias/jump?hid=3207&cid=527&mid=1313http://library.dzone.com/assets/request/whitepaper/167281?oid=rel163295http://java.dzone.com/click/170479/1http://java.dzone.com/click/170479/1http://java.dzone.com/click/171663/1http://java.dzone.com/click/171663/1http://java.dzone.com/click/171457/1http://java.dzone.com/click/171457/18/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
3/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 3/9
will be instant. Other plus is that you do not need a DBA to modify your schema when application
changes.
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 followsome best practices to avoid pitfalls.
1 /35
BillRun - Billing on top of MongoDB | MUG IL, Feb 2014from oc666
Real World Case Study: Billing
In the last ILMUG, Ofer Cohenpresented 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:
Dev of the Week: Pierre-
Hugues Charbonneau
POPULAR AT DZONE
See more popular at DZone
Subscribe to the RSS feed
How to Reuse Tiles Definitions UsingWildcard
java.net.BindException How to handleBindException
Lightning brings Red Hat JBoss BPMSuite ECM telco CMIS integration demo
Android RadioGroup Example
Web service tutorial in java
Spring Framework 4.1 - handling staticweb resources
Vaadin community survey 2014 results
http://www.dzone.com/links/vaadin_community_survey_2014_results.htmlhttp://www.dzone.com/links/spring_framework_41_handling_static_web_resources.htmlhttp://www.dzone.com/links/web_service_tutorial_in_java_2.htmlhttp://www.dzone.com/links/android_radiogroup_example.htmlhttp://www.dzone.com/links/lightning_brings_red_hat_jboss_bpm_suite_ecm_telc.htmlhttp://www.dzone.com/links/javanetbindexception_how_to_handle_bindexception.htmlhttp://www.dzone.com/links/how_to_reuse_tiles_definitions_using_wildcard.htmlhttp://feeds.dzone.com/dzone/frontpagehttp://www.dzone.com/http://java.dzone.com/click/173217/1http://java.dzone.com/click/173217/1http://www.billrun.org/http://il.linkedin.com/pub/ofer-cohen/2/208/906http://www.slideshare.net/oc666https://www.slideshare.net/oc666/mongodb-user-group-billrun8/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
4/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 4/9
1. Schema-less designenables rapid introduction of new CDR types to the system. It let BillRun
keep the data store generic.
2. ScaleBillRun production site already manages several TB in a single table, w/o being limited by
adding new fields or being limited by growth
3. Rapid replicaSetenables meeting regulation with easy to setup multi data center DRP and HA
solution.
4. Shardingenables 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 findAndModify (which is slower) and two-
phase commit (application wise).
6. Developer oriented queries, enable developers write a elegant queries.
7. Location basedis 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 fine example for that.
Keep Performing,
Moshe Kaplan
Published at DZone with permission of Moshe Kaplan, author and DZone MVB. (source)
(Note: Opinions express ed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)
Tags: MongoDB MySQL Tips and Tricks NoSQL Architecture Tools &
Methods
The NoSQL Zone is produced in partnership with Neo4jand Couchbase
Comments
http://servedby.flashtalking.com/click/4/32716;805429;369307;211;0/?ft_width=1&ft_height=1&url=5087818http://adclick.g.doubleclick.net/aclk?sa=L&ai=BmMyHmXrSU9KNGeyxwAHw2oCIBcbGpPIDAAAAEAEg4tPyBjgAWK7cifQ8YOWD9oSUFrIBDmphdmEuZHpvbmUuY29tugEJZ2ZwX2ltYWdlyAEJ2gE8aHR0cDovL2phdmEuZHpvbmUuY29tL2FydGljbGVzL3doZW4tdXNlLW1vbmdvZGItcmF0aGVyLW15c3FswAIC4AIA6gIiLzI5MTYwNzAvem9uZXNfYm90dG9tYmx1cmJfNjUweDEyMvgC_tEegAMBkAOkA5gD4AOoAwHgBAGgBhY&num=0&sig=AOD64_3e14FQx6J2visaowEyEo-lIhzbhw&client=ca-pub-3945085396033279&adurl=http://txt.couchware.com/medias/jump?hid=3099&cid=503&mid=1207http://java.dzone.com/category/dzone-taxonomy/tools-methodshttp://java.dzone.com/category/dzone-taxonomy/architecturehttp://java.dzone.com/category/dzone-taxonomy/architecture/nosqlhttp://java.dzone.com/category/content-form/tips-and-trickshttp://java.dzone.com/category/tags/mysqlhttp://java.dzone.com/category/tags/mongodbhttp://top-performance.blogspot.com/2014/02/when-should-i-use-mongodb-rather-than.htmlhttp://java.dzone.com/users/moshekaplanhttp://www.linkedin.com/in/moshekaplan8/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
5/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 5/9
First Last replied on Mon, 2014/03/03 - 8:26am
> You Don't have a DBA
srlsly?
Loginor registerto 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 andretrieve JSON very easily almost negating the need for a traditional server. What do
you think of that?
Loginor registerto 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
Loginor registerto post comments
http://java.dzone.com/user/register?destination=node%2F163295%23comment-formhttp://java.dzone.com/user/login?destination=node%2F163295%23comment-formhttp://nodejsmongodb.com/post/mysql-vs.-mongodb-relational-and-non-relational-databases/http://java.dzone.com/user/register?destination=node%2F163295%23comment-formhttp://java.dzone.com/user/login?destination=node%2F163295%23comment-formhttp://java.dzone.com/user/register?destination=node%2F163295%23comment-formhttp://java.dzone.com/user/login?destination=node%2F163295%23comment-form8/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
6/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 6/9
Comment viewing options
Flat list expanded Date oldest first 30 comments per page Save settings
Moshe Kaplan replied on Tue, 2014/06/10 - 5:08pm
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
Loginor registerto post comments
in response to: Alex Staveley
Moshe Kaplan replied on Tue, 2014/06/10 - 5:09pm
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
Loginor registerto post comments
in response to: Sumendra Maharjan
http://-/?-http://java.dzone.com/user/register?destination=node%2F163295%23comment-formhttp://java.dzone.com/user/login?destination=node%2F163295%23comment-formhttp://-/?-http://java.dzone.com/user/register?destination=node%2F163295%23comment-formhttp://java.dzone.com/user/login?destination=node%2F163295%23comment-form8/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
7/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 7/9
Not Even Apple Knows Swift Yet
An Introduction to Fabric8 and Why It's So Important for Integration
Trust instead of Threats
Docker using private registry
DZone's 200th Refcard Released: Java Performance Optimization
DZone Research Cloud News Update (July 21)
Spring MVC 3 View Controller Example
Dev of the Week: Pierre-Hugues Charbonneau
Quick Tip: AngularJS Controller Destructor
Designing a Data Architecture to Support both Fast and Big Data
Why is the Fundamental Theorem of Software Engineering Fundamental?
Open Compute, Open Switch API and Open Network Install Environment
The Best of the Week (July 11): NoSQL Zone
Sharing Programming
There's a Bot on Twitter That Sells OpenStack Instances for Bitcoin
YOU MIGHT ALSO LIKE
AROUND THE DZONE NETWORK
ARCHITECTS
Top Posts of 2013: BigData BeyondMapReduce: Goog...
JAVALOBBY
Top Posts of 2013: ThePrinciples of Java
Applicat...
ARCHITECTS
5 Things a JavaDeveloper ShouldConsider This Yea...
JAVALOBBY
Top Posts of 2013:There Are Only 2Roles of Code
JAVALOBBY
Singleton DesignPattern AnIntrospection w/ B...
SERVER
Best Best PracticesEver
Select your preferred way to display the comments and click "Save settings" to activate your
changes.
http://server.dzone.com/articles/best-best-practices-everhttp://server.dzone.com/http://java.dzone.com/articles/singleton-design-pattern-%E2%80%93http://java.dzone.com/http://java.dzone.com/articles/there-are-only-2-roles-codehttp://java.dzone.com/http://architects.dzone.com/articles/5-things-java-developer-shouldhttp://architects.dzone.com/http://java.dzone.com/articles/principles-java-applicationhttp://java.dzone.com/http://architects.dzone.com/articles/big-data-beyond-mapreducehttp://architects.dzone.com/http://server.dzone.com/articles/theres-bot-twitter-sellshttp://server.dzone.com/articles/sharing-programminghttp://server.dzone.com/articles/best-week-july-11-nosql-zonehttp://server.dzone.com/articles/open-compute-open-switch-apihttp://server.dzone.com/articles/why-fundamental-theoremhttp://server.dzone.com/articles/designing-data-architecture-0http://server.dzone.com/articles/quick-tip-angularjs-controllerhttp://server.dzone.com/articles/dev-week-pierre-hugueshttp://server.dzone.com/articles/spring-mvc-3-view-controllerhttp://server.dzone.com/articles/dzone-research-cloud-news-2http://server.dzone.com/articles/dzones-200th-refcard-releasedhttp://server.dzone.com/articles/docker-using-private-registryhttp://server.dzone.com/articles/trust-instead-threatshttp://server.dzone.com/articles/introduction-fabric8-and-whyhttp://server.dzone.com/articles/not-even-apple-knows-swift-yet8/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
8/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 8/9
Search
POPULAR ON JAVALOBBY
Spring Batch - Hello World
Is Hibernate the best choice?
How to Create Visual Applicationsin Java?
9 Programming Languages ToWatch In 2011
Introduction to Oracle's ADF FacesRich Client Framework
Lucene's FuzzyQuery is 100 timesfaster in 4.0
Interview: John De Goes Introducesa Newly Free Source Code Editor
Time Slider: OpenSolaris 2008.11Killer Feature
LATEST ARTICLES
Do doctors know what patientsknow?
Talk to investors, raise funds, andresearch the market in a singlesecure space
Using the crowd to improve GPS
Delighted to announce.
Identifying JVM - Trickier ThanExpected
Compressed Backlog Refinement
Getting Started with Home
Automation (Part I) Test Attribute #5 Differentiation
SPOTLIGHT
RESOURCES
Camel
Essential
Components
DZone's 170thRefcard is anessential reference
to Camel, an open-source, lightweight,integration library.This Refcard isauthored by...
Essential
Couchbase
APIs: Open
Source NoSQL
Data Access
from Java,
Ruby, and
.NET
Practical DNS:
Managing
Domains for
Safety,
Reliability,
and Speed
http://refcardz.dzone.com/refcardz/dnshttp://refcardz.dzone.com/refcardz/couchbase-apishttp://refcardz.dzone.com/refcardz/essential-camel-componentshttp://java.dzone.com/articles/test-attribute-5http://java.dzone.com/articles/getting-started-homehttp://java.dzone.com/articles/compressed-backlog-refinementhttp://java.dzone.com/articles/identifying-jvm-trickierhttp://java.dzone.com/articles/delighted-announce%E2%80%A6http://java.dzone.com/articles/using-crowd-improve-gpshttp://java.dzone.com/articles/talk-investors-raise-funds-andhttp://java.dzone.com/articles/do-doctors-know-what-patientshttp://java.dzone.com/news/killer-feature-opensolaris-200http://java.dzone.com/news/interview-john-de-goes-free-unhttp://java.dzone.com/news/lucenes-fuzzyquery-100-timeshttp://java.dzone.com/news/introduction-oracles-adf-faceshttp://java.dzone.com/news/9-programming-languages-watchhttp://java.dzone.com/news/how-create-visual-applicationshttp://java.dzone.com/news/hibernate-best-choicehttp://java.dzone.com/news/spring-batch-hello-world-18/9/2019 When to Use MongoDB Rather Than MySQL (or Other RDBMS)_ the Billing Example _ Javalobby
9/9
25/7/2014 When to Use MongoDB Rather than MySQL (or Other RDBMS): The Billing Example | Javalobby
http://java.dzone.com/articles/when-use-mongodb-rather-mysql 9/9
Ref cardz Book Revi ews
Tech L ibra ry IT Que stio ns
Snippets My Profile
Abo ut D Zo ne Advertise
Tools & Buttons Send Feedback
DZone
HTML5 Windows Phone
Cloud Mobile
.NET Java
PHP Eclipse
P erf orm anc e B ig D at a
Agile DevOps
Topics
Google +
Follow Us
-Pithy Advice for Programmers
"Starting from scratch" isseductive but disease ridden
Advertising - Terms of Service - Privacy - 1997-2014, DZone, Inc.
http://java.dzone.com/page/privacyhttp://java.dzone.com/page/toshttp://java.dzone.com/page/advertisehttps://twitter.com/#!/Dzonehttp://www.linkedin.com/groups/DZone-696877http://www.facebook.com/pages/DZone/259639764711https://plus.google.com/+dzone/postshttp://dzone.com/mz/html5http://dzone.com/mz/devopshttp://agile.dzone.com/http://www.dzone.com/mz/big-datahttp://dzone.com/mz/performancehttp://eclipse.dzone.com/http://php.dzone.com/http://java.dzone.com/http://dzone.com/mz/dotnethttp://mobile.dzone.com/http://cloud.dzone.com/http://dzone.com/mz/windowsphone7http://dzone.com/mz/html5http://dzone.com/http://ask.dzone.com/index.htmlhttp://www.dzone.com/links/buttons.jsphttp://www.dzone.com/corporate/advertisehttp://www.dzone.com/links/about.jsphttp://dzone.com/userhttp://snippets.dzone.com/http://itquestions.com/index.htmlhttp://library.dzone.com/http://books.dzone.com/http://refcardz.dzone.com/