What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona...

31
MongoDB 3.4: What's New?! For Community Server and Percona Server for MongoDB

Transcript of What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona...

Page 1: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

MongoDB 3.4:What's New?!

For Community Server and Percona Server for MongoDB

Page 2: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

2

Agenda

● Who am I● What are the types of MongoDB softwares in the ecosystem● What did we get up to 3.2?● Things new or improved in 3.4● Understanding MongoDB Enterprise Server vs. Percona Server for

MongoDB● Questions

Page 3: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

Who is David Murphy

Page 4: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

4

MongoDB Practice Manager @ Percona

Past key roles

● Electronic Arts NoSQL / MySQl Architect● ObjectRocket / Rackspace MongoDB Lead / Architect

MySQL since 3.22 (yes that was a very long time ago)

Mongo Master Alumni and Contributor

Using MongoDB since 1.6

Page 5: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

Software in the Ecosystem

Page 6: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

6

What server software exists?

• MongoDB Community Server

• MongoDB Enterprise Advanced Server

• Percona Server for MongoDB

• TokuMX ( End of Lifed)

Page 7: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

7

What server software exists?

• MongoDB Community Server

• MongoDB Enterprise Advanced Server

• Percona Server for MongoDB

• TokuMX ( End of Lifed)

Page 8: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

8

What server software exists?

• MongoDB Community Server

• MongoDB Enterprise Advanced Server

• Percona Server for MongoDB

• TokuMX ( End of Lifed)

Page 9: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

9

What server software exists?

• MongoDB Community Server

• MongoDB Enterprise Advanced Server

• Percona Server for MongoDB

• TokuMX ( End of Lifed)

Page 10: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

What Features We Built up to 3.2?Recap on what was in MongoDB’s ecosystem prior to 3.4’s release

Page 11: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

11

Replica Set elections

A history:

• Before 3.0

• New Protocol in 3.2

• Common Challenges

Page 12: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

12

Document validation

• Able to validate documents during updates and insertions

• Specify on per-collection basis using the validator option, which takes a document that specifies the validation rules or expressions

• Can use any expressions except

• $near, $nearSphere, $text and $where

Page 13: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

13

Sharding to this point

What sharding gives you:

• Parallel queries

• Easily scaling the number of nodes

• Automatic balancing for changes in load and data distribution*

• Zero single points of failure

• Automatic failover and recovery*

Page 14: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

14

Indexes on all data matching a filter

• Index can be much smaller

• Drives you to need more indexes which can hurt performance

• Allows very compact state type indexes that only incur index updates when those fields activate

• Size of object in index to scan are reduced

• Challenge - Can only have 1 index per query pattern

Partial indexes

Page 15: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

15

Joins in MongoDB?

• Arrays could always unwind, but needed to be stored in a single document

• Pipeline still has the 16MB limit, unless using $out

• Can join whole document together reducing main document size

Left outer Join ($lookup)

Page 16: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

16

Mixing storage engines in Replica Sets

Different Workloads and Different needs:

• Sometimes your need fast reads

• Other times you need a balance

• Maybe you also need just need storage but not persistence

• Any node of a replica-set can be any single engine

Page 17: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

New Things in 3.4Building on 3.2, what was added or improved?

Page 18: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

18

Improved initial sync

• Slow on large nodes with >200G of data

• Even worse with many or complex indexes

• Network issues would cause it to start over

• Applies indexes and then the data, and uses multiple streams to copy the data

Page 19: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

19

Collation - new feature!

Common reasons:

• Not all languages order characters the same way

• Sometimes with product sets, special ordering is wanted as well

• I want to spread my users out so big clients don’t share resources

• No specific need, but want to be future-ready

Page 20: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

20

Shard/ReplSet tagging is now Zones

Common Reasons:

• Tags worked both with replica set and sharding

• With a replica set you could set some nodes to be better hardware for a use case than others

• With sharding based on shard key ranges you could make data stay in the EU or US for example

• In 3.4, these have been renamed to the simpler name of zones (but it’s the same effect)

Page 21: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

21

Views - new feature!

● Views are the ability to store and run aggregations

• Appear as a collection

• Can apply security to the virtual collection vs raw data

• Not materialized, but still useful, use $out for materialized

Page 22: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

22

Aggregation - recursive $lookup

Logical extensions of $lookup ($graphLookup)

• Performs a recursive search on a collection with options for restricting the search by

- recursion depth

- query filter

• From (source) cannot be sharded

• 100MB limit, ignores allowDiskUse

• No specific need but want to be future ready

Page 23: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

23

Aggregation - faceted search

• Processes multiple aggregations inside the same stage

- Results stored 1 array per aggregation , with each stage being and element

- Practically, this means you could search by buckets of product ages colors, and other such things - with each characterization being a new subdocument in the result vs. multiple aggregations the application needs to pull together

• Restrictions include- $facet (nested)- $out- $geoNear- $indexStats- $collStats

Page 24: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

24

Decimal type added

Adds real decimal type for precision and maths, no more need be said hopefully.

Need new driver to use this in your apps

Page 25: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

25

General improvements

● Parallel balancing

● Read consistency

● Intra node communication compression

● Log redaction

Page 26: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

26

Replaces the need to use Facebook’s “Flashback” tool (written by Parse)

• Required root access to do tcpdumps of incoming traffic

- Means must be in front of ALL mongos nodes if sharded, but also that SSL is not allowed

• Very useful to:- try sharding with a new key- Using a new index- Check for performance issues with new version- Verifying bug fixes with a new version

MongoReplay - new tool

Page 27: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

MongoDB Enterprise Advanced vs. Percona Server for MongoDB

How do they differ, and are they compatible?

Page 28: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

28

MongoDB Enterprise Advanced Server

Features (not in Community Server or open source)

● LDAP, External Auth● Audit Trail● Encrypted WiredTiger Engine● In Memory Engine● Bi Connector● Compass● Ops Manager / Atlas

Page 29: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

29

Percona Server for MongoDB

Features (open source)

● LDAP, External Auth● Audit Trail● Hot binary backups for WiredTiger and MongoRocks● MongoRocks Engines (LSM)● In Memory Engine● Percona Monitoring and Management (more metric than Ops Manager)● Improved profiling● Percona Toolkit for MongoDB

○ pt-mongodb-summary○ pt-mongodb-query-digest

Page 30: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

30

Questions???

● Twitter - dmurphy_data● Email - [email protected]● Github - dbmurphy

Percona is looking for rockstars! Be sure to talk to Jennifer @ Percona’s booth

Do you have any areas or benchmarks you want Percona to talk about in our Performance Blog? Email me and let me know.

Page 31: What's New?! MongoDB 3.4 - Percona - 3... · Understanding MongoDB Enterprise Server vs. Percona Server for MongoDB ... • Common Challenges. 12 Document validation

31

Rate My Session