MySQL Vs MongoDB - Percona

Transcription

MySQL vs MongoDBChoosing right technology for your applicationPeter ZaitsevCEO,PerconaSCALE 15x3 March 2017, Pasadena,CA1 2017 Percona

MySQL vs MongoDBVS2 2017 Percona

Bigger QuestionWhat Open SourceDatabase Technologies Ishould be using for MyApplication ?3 2017 Percona

Even Bigger QuestionWhat DatabaseTechnologies I should beusing for My Application4 2017 Percona

Open SourceIncreasing number of Open Source First CompaniesOnly use Proprietary Software when there are no otherchoicesCost, Reduced Vendor Lock In are the main factors5 2017 Percona

Open Source vs Proprietary trends6 2017 Percona

New Generation Technologies – Open Source7 2017 Percona

Polyglot PersistenceChoose MultipleDatabasesystems8Use Their StrongSides 2017 Percona

Architecture ExamplesMain Operation Store Auxiliary ServicesMicro Services with their own storesData Bus/Data Flow9 2017 Percona

For ExampleMySQL as main data storeUse Memcache or Redis for cachingElasticSearch for SearchKafka to transfer data to ElasticSearch, Hadoop10 2017 Percona

Choosing the Data StoreSQL(Relational)11NoSQL (NonRelational) 2017 Percona

Many NoSQL Data ModelsKey Value(Memcache)Wide Column(Cassandra)Graph(Neo4J)12 2017 PerconaDocument(MongoDB)

Why MySQL vs MongoDB ?13 2017 Percona

My MySQL vs MongoDBMost Popular Open Source Relational and Non RelationalstorageBoth Technologies started with Focus on Exceptional Easeof UseThese are 2 Technologies we focus at Percona14 2017 Percona

Percona Software for MySQL and MongoDBMySQLMongoDB Percona Server for MySQL Percona XtraDB Cluster Perona Xtrabackup Percona Toolkit Percona Monitoring andManagement TokuDB Storage Engine15 Percona Server for MySQL MongoRocksDB Storage Engine(RocksDB Based) Percona Memory Engine forMongoDB Percona Toolkit Percona Monitoring andManagement 2017 Percona

Full DisclosureI Personally know MySQLmuch better thanMongoDB16 2017 Percona

NoSQL on MySQLStarting MySQL 5.7 MySQL Supports NoSQL InterfaceMongoDB Like CRUD accessWith Transaction SupportWithout Good Sharding SolutionNot yet commonly adopted17 2017 Percona

Top Things to ConsiderTeam Preferencesand ExperienceDevelopmentProcess andApplicationLifecycleData ModelTransactions Legal18 2017 Percona

Team Preferences and ExperienceAbsolutely Key Question!Unloved Technology – Recipe for DisasterProblems may have more than one solutionConsider Original Development and Full Lifecycle19 2017 Percona

Team Experience MySQL vs MongoDBMySQLMongoDB Very Mature Technology SQL Standard Easier to move to other relationaldatabases Transactions A lot of Choices20 Modern and Dynamic Do not need to learn nasty SQL Dynamic Schema Complex Queries are recipe forcomplex problems Easier Scalability Native Integration Javascript, JSON 2017 Percona

Development Process and LifeCycleFaster Development pace or more control ?Data Always Have SchemaIs Data Belong to Application or used by Multiple ApplicationsApplication Life TimeApplication Active development time21 2017 Percona

Development in MySQL and MongoDBMySQLMongoDB Relational Database requiresmore planning and control Easy to use data from manyapplications Many applications 15 Years Can use SQL and NoSQLInterface22 Development Pace No Need to SynchronizeSchema between Applicationand Database Clear Path to Scalability 2017 Percona

Data ModelOptimal Data Model dependson the Application and TeamExperince23 2017 Percona

Data Model in MySQL vs MongoDBMySQLMongoDB Relational Data Model Easy to reflect relationships betweenobjects Change data in one place Query Result - Table Document Oriented Data Model Documents can embed otherdocuments Easy to represent JSON datacommon in Web Applications Complex JOINs can often be avoided Query Result – List of Documents(different structure)24 2017 Percona

Model Design ExamplePeople and their PassportsPeople may have more than on passportNot Everyone Has a Passport25 2017 Percona

Relational Schema Design26 2017 Percona

Easy To Answer Various Questions Number of People SELECT count(*) FROM people Validity Date of Persons passport SELECT valid until from passports ps join people pl ON ps.people id pl.id WHERE name 'Stephane‘ Who Does not have A Passport ? SELECT name FROM people pl LEFT JOIN passports ps ON ps.people id pl.id WHERE ps.id IS NULL27 2017 Percona

MongoDB Design Example28 2017 Percona

MongoDB and MySQL TermsMySQLMongoDB Database/Schema Table Row Column Primary Key Join29 Database Collection Document Field Primary Key Embedded Document orLinking 2017 Percona

Access LanguageSQLCRUD Structured Query Language30 Create Read Update Delete 2017 Percona

SQL vs CRUD - InsertSQL31CRUD 2017 Percona

SQL vs CRUD Update32 2017 Percona

SQL vs CRUD - Delete33 2017 Percona

SQL vs CRUD - Search34 2017 Percona

SQL vs CRUD - Count35 2017 Percona

SQL vs CRUD - Aggregation36 2017 Percona

Transactions and Consistency 37AtomicityConsistencyIsolationDurability 2017 Percona

Transactions in MySQL vs MongoDBMySQLMongoDB ACIDTransactions ofarbitrary size38 ACID on thedocument level 2017 Percona

MongoDB Reads are Dirty ReadsReading a Large Result will ReturnDocuments from different point in timeSame Document Can (rarely) beReturned More than Once39 2017 Percona

PerformanceVery Hard to Compare DirectlyDepends a lot on the Application ArchitectureMany Benchmarks compare different Durability or SettingsMongoDB Scales Better so single node performance less of a focus40 2017 Percona

MySQL vs MongoDB PerformanceTest by Mark Callaghan: http://bit.ly/2epDJqD41 2017 Percona

ScalabliltyWhat do I needto do to scalemy Applicationfrom 100 to100.000.000users ?42 Scalability within single system Scalability for multiple systems Scaling reads, writes, data size 2017 Percona

Scalability MySQL and MongoDBMySQLMongoDB Scales well with single systemsize Can be scaled to Facebook Scale Easy to scale for medium sizeapplications Scaling Reads with Replication Sharding is Painful43 Scalability was focused uponfrom the early versions Built in Sharding Sharding for Scalability,Replication is for HA 2017 Percona

Database OperationsWhat Developers do not like thinking aboutAutomationBackupsVersion UpdatesMonitoringDisaster RecoveryPerformance Management44 2017 Percona

Operations MySQL and MongoDBMySQLMongoDB Flexibility Many ways to solve problems Many Open Source Toolsavailable Out of the box ManualFailover in Replication45 Simplicity Virtually Zero Administration Fewer Open SourceOperation Tools Strong Connection toMongoDB Ops Manager 2017 Percona

LicenseMySQLMongoDB GPL orProprietary46 AGPL orProprietary 2017 Percona

Solved MongoDB ProblemsPoor concurrent write performance with MMAPv1 Poor disk space usage with MMAPv1 Fixed by WiredTiger and MongoRocksNo way to validate documents Document Validation since MongoDB 3.2No JOIN 47Fixed by WiredTiger and MongoRocksLimited support in aggregation framework starting MongoDB 3.2 2017 Percona

Typical MySQL ExampleOnlineEcommerce48 Full Feature Transactions are important Relational Model is a good fit Data size is typically not requiring sharding Long Term Application development Same data used by many applicationsdirectly 2017 Percona

Typical MongoDB ExampleOnlineGameBackend49 Extreme scaling might be needed if gamebecomes popular Data is used by one application Data is complicated and does not fitrelational model well Document level consistency is often enough Low pace of development after “launch” 2017 Percona

Extra MaterialOther things worth sharing50 2017 Percona

Just Released!51 2017 Percona

Percona Server for MongoDB 3.4100% Free andOpen Source100% Compatiblewith MongoDB 3.4Auditing as inMongoDBEnterprise52AdditionalMemory Engineand MongoRocksAdvanced QueryPerformanceMonitoring 2017 PerconaPluggableAuthentication asin MongoDBEnterpriseHot Backups forWiredTiger

Percona Monitoring and ManagementComprehensive Database Focused Monitoring100% Open Source Roll-your-own solutionEasy to install and useSupports MySQL and MongoDBVersion 1.1 focuses on Trending and Query AnalysesManagement Features to Come 53 2017 Percona

What Queries are causing the load ?54 2017 Percona

Why are they causing this load ?55 2017 Percona

How to fix them56 2017 Percona

System Information57 2017 Percona

What happens on OS and Hardware Level58 2017 Percona

As well as Database Level59 2017 Percona

Detailed MongoDB Storage Engine Monitoring60 2017 Percona

Check out the Demohttp://pmmdemo.percona.com61 2017 Percona

62 2017 Percona

63 2017 Percona

Meet us at Booth #21964 2017 Percona

About PerconaSolutions for your success with MySQL and MongoDBSupport, Managed Services, SoftwareOur Software is 100% Open SourceSupport Broad Ecosystem – MySQL, MariaDB, Amazon RDSIn Business for more than 10 yearsMore than 3000 customers, including top Internet companies and enterprises65 2017 Percona

DATABASE PERFORMANCEDatabase Performance MattersMATTERS

Solutions for your success with MySQL and MongoDB Support, Managed Services, Software Our Software is 100% Open Source Support Broad Ecosystem – MySQL, MariaDB, Amazon RDS In Bu