Matrix IT work Copyright 2013. Do not remove source or Attribution from any graphic or portion of graphic
DBAמרכז התמחות
2015דצמבר 3 : תאריך
ארכיטקט מרכז ההתמחות, רז הורוביץ: מציג soft.co.il-Raziel.Horovitz@tangram
NoSQL and MongoDB
Agenda
The World is Changing…
NoSQL (Or not only SQL)
The Data Model
Who uses MongoDB and why ?
Enterprise features
The World is Changing…
Big Users Not long ago 1000 daily users of an application was a lot 10,000 was an extreme case.
– A newly launched app can go viral, growing from zero to a million users overnight.
– Some users active frequently, while others use an app a few times, never to return.
– Seasonal swings like Christmas or Valentine’s Day create spikes for short periods.
– New Product release or promotions can spawn dramatically higher application usage.
The large numbers of users
combined with the dynamic
nature of usage patterns is
are driving the adoption of
NoSQL technology.
The Internet of things
– By 2020, 32 billion things will be connected to the Internet.
– By 2020, 10% of data will be generated by embedded systems.
– By 2020, 20% of target rich data will be generated by embedded systems.
Big Data – 90% of the world’s data was created in the last two years.
– 80% of enterprise data is unstructured. – Unstructured data growing 2x faster than structured.
– Data is becoming easier to capture and access through third parties such as Facebook, twitter etc.
– The demand for analytic processing is increasing.
The Cloud – Not long ago, most data-intensive, multi-user business applications used a two-tier architecture.
– In the three-tier architecture, applications are accessed through a web browser or mobile app that is connected to the Internet.
– In the cloud, a load balancer directs the incoming traffic and scale out tier of web/application servers that process the logic of the application.
The Database is the last technology in the
stack yet to be modernized
Not anymore…
DB-Engines.com
Magic Quadrant for Operational Databases
NoSQL (Or not only SQL)
NoSQL Definition
– NoSQL is a broad class of database that differs from the classic RDBMS in some significant ways, most important - they do not use SQL as their primary query language.
– NOSQL means Not Only SQL, as in: in the future, our backend will consist of Not Only SQL databases but also: key-value stores, Document Based, graph databases and more…
NoSQL is real and it’s here to stay !
– Better application development - through a more flexible data model.
– Greater ability to scale dynamically to support more users and data.
– Improved performance.
And..
– Become preferred choice for new development.
– Co-exist with RDBMS.
NoSQL Systems characteristics
The Data Model
Relational Data Model
Relational MongoDB
{
first_name: ‘Paul’,
surname: ‘Miller’,
city: ‘London’,
location: [45.123,47.232],
cars: [
{ model: ‘Bentley’,
year: 1973,
value: 100000, … },
{ model: ‘Rolls Royce’,
year: 1965,
value: 330000, … }
]
}
Document Data Model
Documents are easier…
Documents are reach data structure {
first_name: ‘Paul’,
surname: ‘Miller’,
cell: ‘+447557505611’
city: ‘London’,
location: [45.123,47.232],
Profession: [banking, finance, trader],
cars: [
{ model: ‘Bentley’,
year: 1973,
value: 100000, … },
{ model: ‘Rolls Royce’,
year: 1965,
value: 330000, … }
]
}
Fields can contain an array of sub-
documents
Fields
Typed field values
Fields can contain
arrays
Document Model Benefits
Agility and flexibility
Data model supports business change
Rapidly iterate to meet new requirements
Intuitive, natural data representation
Eliminates ORM layer
Developers are more productive
Reduces the need for joins, disk seeks
Programming is more simple
Performance delivered at scale
{
_id : ObjectId("4c4ba5e5e8aabf3"),
employee_name: "Dunham, Justin",
department : "Marketing",
title : "Product Manager, Web",
report_up: "Neray, Graham",
pay_band: “C",
benefits : [
{ type : "Health",
plan : "PPO Plus" },
{ type : "Dental",
plan : "Standard" }
]
}
No Schema, No Declaration, No Foreign Keys, No Relations Maximum flexibility
MongoDB
{
first_name: ‘Paul’,
surname: ‘Miller’,
city: ‘London’,
location: [45.123,47.232],
cars: [
{ model: ‘Bentley’,
year: 1973,
value: 100000, … },
{ model: ‘Rolls Royce’,
year: 1965,
value: 330000, … }
}
}
Rich Queries
Find Paul’s cars
Find everybody in London with a car
built between 1970 and 1980
Geospatial Find all of the car owners within 5km
of Trafalgar Sq.
Text Search Find all the cars described as having
leather seats
Aggregation Calculate the average value of Paul’s
car collection
Map Reduce What is the ownership pattern of
colors by geography over time?
(is purple trending up in China?)
Do more with your Data !
NoSQL & Data Modeling What’s the difference ?
Class
Sub - Class
Document
Sub Document
Database = Database
Table = Collection
Row = Document
Relational vs Document Blog example
Single & Replica Sets Replica Set – 2 to 50 copies
Self-healing shard
Data Center Aware
Availability considerations:
High Availability
Disaster Recovery
Maintenance
Automatic Sharding
Three types of Sharding:
hash-based, range-based, location-aware
Increase or decrease capacity as you go
Automatic balancing
Who Uses MongoDB ?
9,000,000+ MongoDB Downloads
250,000+ Online Education Registrants
35,000+ MongoDB Management Service (MMS) Users
30,000+ MongoDB User Group Members
2000+ MongoDB Customers across all industries
The largest Ecosystem
25
מבחר לקוחות בישראל
26
• Authorized Distributer in Israel (since 2014)
• Local Support center of MongoDB in Israel
• Commercial version
– MongoDB OPS manager
– Advanced security
– On Demand training
– SLA 1 Hour (24*365)
Matrix & MongoDB Partnership
27
MongoDB and Red Hat relations:
Can be deployed as a Docker pod inside Openshift.
Can be used as Openstack DB and Ceilometer DB backend.
Can be integrated with JBOSS Data Virtualization.
MongoDB, Inc.
400+ employees 2,000+ customers
Over $311 million in funding 13 offices around the world
4 Support Engineers in Tel Aviv
Why MongoDB ?
Why MongoDB ?
Why ? What ?
End to End JSON
None: no downtime due to schema changes No schema
10K Inserts/sec on virtual machine Write
Even faster and from couple of instances Read
10 min to setup a cluster HA
Out of the Box Sharding
Very useful and easy to implement GeoData
Just save them as documents Classes
Support for the most popular languages and frameworks
Drivers & Shell
Shell Command-line shell for interacting directly with database
Drivers Drivers for most popular programming languages and frameworks
> db.collection.insert({product:“MongoDB”,
type:“Document Database”})
>
> db.collection.findOne()
{
“_id” : ObjectId(“5106c1c2fc629bfe52792e86”),
“product” : “MongoDB”
“type” : “Document Database”
}
Java
Python
Perl
Ruby
Haskell
JavaScript
32
Developer/Ops Savings • Ease of Use
• Agile development
• Less maintenance
Hardware Savings
• Commodity servers
• Internal storage (no SAN)
• Scale out, not up
Software/Support Savings
• No upfront license
• Cost visibility for usage growth
Lower Total Cost of Ownership
DB Alternative
*Included with MongoDB Enterprise Advanced
BUSINESS NEEDS SECURITY FEATURES
Authentication SCRAM, LDAP*, Kerberos*, x.509 Certificates
Authorization Built-in Roles, User-Defined Roles, Field-Level Redaction
Auditing* Admin, DML, DDL, Role-based
Encryption Network: SSL (with FIPS 140-2), Disk: Partner Solutions
Security
MongoDB-Tools
Thank you !