NoSQL and MySQL
Upcoming SlideShare
Loading in...5
×
 

NoSQL and MySQL

on

  • 1,113 views

My MySQL and NoSQL presentation from the NoSQL Search event in Copenhagen: http://nosqlroadshow.com/nosql-cph-2013/speaker/Ted+Wennmark ...

My MySQL and NoSQL presentation from the NoSQL Search event in Copenhagen: http://nosqlroadshow.com/nosql-cph-2013/speaker/Ted+Wennmark

MySQL offers solutions to implement NoSQL concepts like auto-sharding, key-value access or asynchronous operations. This adds all known solutions from the SQL world to the NoSQL space.
The combined approach of SQL and NoSQL gives developers the choice to select whatever features from both worlds they need.

In this talk we take a deeper look at key-value access to MySQL and MySQL Cluster, auto-sharding and scalability of MySQL Cluster, mapping of schemaless key value access to a relational data model and the performance of NoSQL access to MySQL.

Statistics

Views

Total Views
1,113
Views on SlideShare
1,113
Embed Views
0

Actions

Likes
1
Downloads
24
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

NoSQL and MySQL NoSQL and MySQL Presentation Transcript

  • 1 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL & NoSQL: The Best of Both WorldsTed WennmarkPrincipal Sales Consultant MySQLted.wennmark@oracle.com
  • 2 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Safe Harbour StatementThe following is intended to outline our general productdirection. It is intended for information purposes only, andmay not be incorporated into any contract. It is not acommitment to deliver any material, code, or functionality,and should not be relied upon in making purchasingdecisions. The development, release, and timing of anyfeatures or functionality described for Oracle’s productsremains at the sole discretion of Oracle.
  • 3 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.History of MySQL I 2001 MySQL 3.23 GA – our first GA release ever! 2005 Oracle Corporation acquired Innobase OY 2008 Sun acquired MySQL AB for $1 billion 2010 Oracle acquired Sun on 27 January 2010 MySQL 5.5 first Oracle release, great feedback from community! 2012 MySQL 5.6 “Best release ever“
  • 4 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.History of MySQL II World’s Most Popular Open Source Database Over 12 million product installations 65,000 downloads/day The ”M” of the widely deployed LAMP stack MySQL Commercial Editions Available
  • 5 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Session Agenda• NoSQL – What are people looking for?• RDBMS – What advantages do they still have?• How MySQL Delivers the Best of Both Worlds– MySQLCluster• NoSQL attributes: Scale-out, performance, ease-of-use, schemaflexibility, on-line operations• NoSQL APIs– Key-Value store access to InnoDB (Memcached)• What is coming with future releases
  • 6 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.What NoSQL must deliver• Massive scalability– No application-level sharding• Performance• High Availability/Fault Tolerance• Ease of use– Simple operations/administration– Simple APIs– Quickly evolve application & schemaScalabilityPerformanceHAEase of use
  • 7 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Still a role for the RDBMS?NoSQLSimple access patternsCompromise on consistencyfor performanceAd-hoc data formatSimple operationRDBMSComplex queries with joinsACID transactionsWell defined schemasRich set of tools• No best single solution fits all• Mix and matchScalabilityPerformanceHAEase of useSQL/JoinsACID Transactions
  • 8 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster introduction
  • 9 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster ArchitectureDataNodesNode Group 1F1F3F3F1Node1Node2Node Group 2F2F4F4F2Node3Node4ApplicationNodesClusterMgrClusterMgrREST ScalabilityPerformanceHAEase of useSQL/Joins aACID Transactions a
  • 10 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Copyright 2013, Oracle and/or its affiliates. All rights reserved.MySQL Cluster: Extensive Choice of NoSQL APIsMix&Match
  • 11 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.C++ exampleNdbOperation *op = trx->getNdbOperation(myTable);op->insertTuple();op->equal("key", i);op->setValue("value", &value);trx->execute( NdbTransaction::Commit );
  • 12 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Copyright 2013, Oracle and/or its affiliates. All rights reserved.• NoSQL C++ API, flexaSynch benchmark• 30 x Intel E5-2600 Intel Servers, 2 socket, 64GB• ACID Transactions, with Synchronous Replication05101520252 4 6 8 10 12 14 16 18 20 22 24 26 28 30MillionsofUPDATEsperSecondMySQL Cluster Data Nodes1.2 Billion UPDATEs per Minute
  • 13 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster ArchitectureDataNodesNode Group 1F1F3F3F1Node1Node2Node Group 2F2F4F4F2Node3Node4ApplicationNodesClusterMgrClusterMgrREST ScalabilityPerformanceHA aEase of useSQL/Joins aACID Transactions ahttp://clusterdb.com/u/demo
  • 14 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2Data Node 3Data Node 4Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 15 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2F1Data Node 3Data Node 4Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 16 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2F1F1Data Node 3Data Node 4Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 17 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2F1F3 F1Data Node 3Data Node 4Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 18 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2F1 F3F3 F1Data Node 3Data Node 4Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 19 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2F1 F3F3 F1Data Node 3Data Node 4F2 F4F4 F2Node Group 1Node Group 2Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 20 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data Node 1Data Node 2F1 F3F3 F1Data Node 3Data Node 4F2 F4F4 F2Node Group 1Node Group 2Table T1P2P3P4P1Scale-Out: Auto-Partitioning
  • 21 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Table T1P2P3P4P1Scale-Out: Auto-PartitioningScalability aPerformanceHA aEase of useSQL/Joins aACID Transactions a
  • 22 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Scale-Out Reads & Writes on Commodity Hardware• 8 x Commodity Intel Servers– 2 x 6-core processors 2.93GHz– x5670 processors (24 threads)– 48GB RAM• Infiniband networking• flexAsynch benchmark (NDB API)02004006008001 0001 2002 4 8MillionsNumber of Data NodesSELECT Queries per Minute0204060801001204 8MillionsNumber of Data NodesUPDATE Queries per Minute
  • 23 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.On-line Schema changes• Scale the cluster (add & remove nodes on-line)• Repartition tables• Upgrade / patch servers & OS• Upgrade / patch MySQL Cluster• Back-Up• Evolve the schema on-line, in real-timeOn-Line Operations
  • 24 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Scalability aPerformance aHA aEase of use aSQL/Joins aACID Transactions a
  • 25 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.NoSQL Access to MySQL Cluster dataMix & Match!Same data accessedsimultaneously throughSQL & NoSQL interfaces
  • 26 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster 7.1: ClusterJ/JPA• New Domain Object Model Persistence API (ClusterJ) :– Java API– High performance,low latency– Feature rich• JPA interface built upon this new Java layer:– Java Persistence APIcompliant• Implemented as an OpenJPAplugin– Uses ClusterJ where possible,reverts to JDBC for someoperations– Higherperformancethan JDBC– More naturalfor most Java designers– EasierClusteradoption forweb applications
  • 27 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Java Access Performancehttp://www.mysql.com/why-mysql/white-papers/mysql_wp_cluster_connector_for_java.php
  • 28 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.NoSQL with Memcached (MySQL Cluster 7.2)• Memcached is a distributed memory based hash-key/value store with no persistence to disk• NoSQL, simple API, popular with developers• MySQL Cluster already provides scalable, in-memoryperformance with NoSQL (hashed) access as well aspersistence– Provide the Memcached API but map to NDB API calls• Writes-in-place, so no need to invalidate cache• Simplifies architecture as caching & database integratedinto 1 tier• Access data from existing relational tables
  • 29 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Traditional Memcached ArchitectureTwo levels of hashingMemcachehttpd memcachedmemcachedmemcachedmemcache keyPHP/Perlfriends:12389hash keyto find data
  • 30 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Cache hitMemcachehttpdmemcachedPHP/Perlfriends:12389hash keyto find dataVALUE friends:12389 0 31rn101, 11009, 11150, 55881, 77798 rn
  • 31 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Cache miss (1): fetch from DBMemcachehttpdmemcachePHP/Perlhash keyto find datamysqlMySQLSlavememcached
  • 32 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Cache miss (2): manage cacheMemcachehttpdPHP/Perlhash keyto find datamemcached
  • 33 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data change (1): Write to DBmysqlhttpdPHP/PerlMySQLMasterDELETE FROM user_friendsVALUES (12389, 999101);
  • 34 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Data change (2): manage cachemysqlhttpdPHP/PerlMySQLMastermemcached
  • 35 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.NoSQL with Memcached• Flexible:– Deployment options– Multiple Clusters– Simultaneous SQL Access– Can still cache in Memcached server– Flat key-value store or map to multipletables/columnsset maidenhead 0 0 3SL6STOREDget maidenheadVALUE maidenhead 0 3SL6END
  • 36 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Cluster & Memcached – Schema-Free<town:maidenhead,SL6>key value<town:maidenhead,SL6>key valueKey Valuetown:maidenhead SL6generic tableApplication viewSQL view
  • 37 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Cluster & Memcached - Configured Schema<town:maidenhead,SL6>prefix key value<town:maidenhead,SL6>key valuePrefix Table Key-col Val-col policytown: map.zip town code clusterpop: map.zip town popul clusterConfig tablestown ... code populmaidenhead ... SL6 ...map.zipApplication viewSQL view
  • 38 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Memcached with MySQL Clusterhttp://clusterdb.com/u/memcachedTry it out
  • 39 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Memcached NoSQL Access with InnoDB• Memcachedas a plugin of MySQLServer;same process space,with very low latencyaccessto data• Memcapable:supports both memcachedascii protocoland binary protocol• Supportmultiple columns:users can mapmultiple columns into “value”• Optionallocalcaching:“innodb-only”,“cache-only”,and “caching”• Batch operations forperformance• Availablefrom in MySQL5.6InnoDBStorageEngineHandlerAPIMySQL ServerInnoDB APImemcached pluginApplicationSQL Memcached protocolmysqldinnodb_memcache local cache(optional)
  • 40 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.PerformanceCopyright 2013, Oracle and/or its affiliates. All rights reserved.Up to 9x Higher “SET / INSERT” Throughput010000200003000040000500006000070000800008 32 128 512TPSClient ConnectionsMySQL 5.6: NoSQL BenchmarkingMemcached APISQL16 GB, Intel Xeon 2.0 GHz CPUX86_642 CPUs-4 Core Each,2 RAID DISKS
  • 41 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.InnoDB & Memcached - Configured Schema<town:maidenhead,SL6:12000>prefix key value<@@town:maidenhead,SL6:12000>key valuename schema table keycol valcols flagstown map city town code,populcountry world state code name,capitalConfig tablestown ... code populmaidenhead ... SL6 12000map.cityApplication viewSQL view
  • 42 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Which API to use?
  • 43 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Scalability aPerformance aHA aEase of use aSQL/Joins aACID Transactions a
  • 44 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster 7.3 DMR: Node.js NoSQL API• Native JavaScript access to MySQLCluster– End-to-End JavaScript: browser to the app anddatabase– Storing and retrieving JavaScript objects directlyin MySQL Cluster– Eliminate SQL transformation• Implemented as a module for node.js– Integrates full Cluster API library within the webapp• Couple high performance, distributed apps, withhigh performance distributed databaseV8 JavaScript EngineMySQL Cluster Node.js ModuleMySQL Cluster Data NodesClients
  • 45 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.What does an asynchronous API mean?do_stuff1(data,callback1)callback1(results) do_stuff2(data,callback2)callback2(results)Get on with other stuff Get on with other stuff
  • 46 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster NoSQL API for Node.js• Modular connector withvarious back-end adapters:• ndb: low-level nativeaccess to MySQL Cluster• mysql: access to anyMySQL server (translatesoperations to SQLstatements)var nosql = require(mysql-js);var annotations = newnosql.Annotations();annotations.mapClass(lib.Tweet,{table : tweet});var dbProperties =nosql.ConnectionProperties(ndb);nosql.openSession(dbProperties,annotations, onSession);
  • 47 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.MySQL Cluster NoSQL API for Node.jsvar onSession = function(err,session) {if (err) {…} else {var data = newlib.Tweet(user_args[0],user_args[1]);session.persist(data,onInsert, data);}};
  • 48 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.var onInsert = function(err,object) {console.log(onInsert.);if (err) {…} else {console.log(Inserted: +JSON.stringify(object));}};MySQL Cluster NoSQL API for Node.js
  • 49 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Try Node.js example for yourselfhttps://github.com/mysql/mysql-js/tree/master/samples
  • 50 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.CloudWeb & Enterprise OEM & ISVsIndustry Leaders Rely on MySQL
  • 51 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.SummaryToday’s web workloads demand more fromdatabasesPerformance, scale-out, simples accesspatterns & APIsMySQL meets these needs while stilldelivering benefits of an ACID RDBMS
  • 52 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Next Steps• Guide to MySQL and NoSQL - Delivering the Best ofBoth Worlds– http://mysql.com/why-mysql/white-papers/mysql-wp-guide-to-nosql.php• Evaluate MySQL Cluster 7.2– http://www.mysql.com/downloads/cluster/• Bootstrap a Cluster– https://edelivery.oracle.com/• Try Memcached API for InnoDB in 5.6• http://www.mysql.com/downloads/
  • 53 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Graphic Section Divider  Keynotes Conferences Sessions Birds-of-a-feather sessions Tutorials Hands-on Labs Exhibition Hall Demo Pods ReceptionsSan Francisco, September 21-23Additional Day of TutorialsOracle.com/mysqlconnect
  • 54 Copyright © 2012, Oracle and/or its affiliates. All rightsreserved.Thank you!Copyright 2012, Oracle and/or its affiliates. All rights reserved.