SlideShare a Scribd company logo
1 of 40
Download to read offline
Developing High-Throughput
Services with NoSQL APIs to
InnoDB and MySQL Cluster
Andrew Morgan – MySQL Product Management
John Duncan – MySQL Cluster Engineering




1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Program Agenda

         Why NoSQL
         MySQL Cluster Attributes
         NoSQL APIs for MySQL Cluster
         Memcached API for InnoDB
         Node.js – Native javascript access
         Next Steps


2   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Disclaimer


        The f ll i is intended to tli
        Th following i i t d d t outline our general product di ti
                                                         l   d t direction. It i
                                                                               is
        intended for information purposes only, and may not be incorporated
        into
        i t any contract. It is not a commitment to deliver any material,
                     t t i         t       it    t t d li           t i l
        code, or functionality, and should not be relied upon in making
        purchasing d i i
             h i decisions. Th d The development, release, and ti i of any
                                         l       t l          d timing f
        features or functionality described for Oracle’s products remains at
        the l discretion of O l
        th sole di     ti     f Oracle.



3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
NoSQL – Why the demand?

                                                                                                                                      2.1BN USERS
       Web
        W b applications
               li ti                                                                                                        8X DATA GROWTH IN 5 YRS                  900M USERS
        demanding:                                                                                    40% DATA
                                                                                                                       70+ NEW DOMAINS EVERY 60 SECONDS 20M APPS PER DAY

          Development velocity:                                                                     GROWTH PER
                                                                                                         YEAR                                               60 HOURS
               Simplicity & flexibility of                                                                                                                  UPLOADED
                                                                                                                                                         EVERY MINUTE
               data model & APIs
          Scalability &                                                                                                                                   $1TR BY 2014
                                                                                             350m TWEETS
               performance: high write                                                               PER DAY                                             $700BN IN 2011

               throughput and
               Key/Value access
          Support for “Big Data”                                                                         5.9BN MOBILE SUBS IN 2011
                                                                                                          1 BILLION iOS & ANDROID                   85% HANDSETS
                                                                                                                                                    SHIPPED WITH A
                                                                                                          APPS DOWNLOADED PER WEEK
                                                                                                                                                         BROWSER


    4   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
What NoSQL must deliver


                                                                                                  Massive scalability
         Scalability
                                                                                                     No application-level sharding
                                                                                                        o app cat o e e s a d g
      Performance                                                                                 Performance
                                                                                                  High Availability/Fault Tolerance
                   HA
                                                                                                  Ease of use
        Ease of use                                                                                  Simple operations/administration
                                                                                                     Simple APIs
                                                                                                     Quickly evolve application & schema




5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Still a role for the RDBMS?

       No best single solution
        fits all                                                                                     NoSQL                        RDBMS
       Mix and match
                                                                                                        Simple
                                                                                                        Si l access patterns
                                                                                                                      tt           Complex queries with j i
                                                                                                                                   C   l       i    ith joins
              Scalability
                                                                                                      Compromise on consistency
           Performance                                                                                                                 ACID transactions
                                                                                                          for performance

                        HA
                                                                                                          Ad-hoc data format         Well defined schemas
             Ease o use
              ase of

              SQL/Joins                                                                                    Simple operation             Rich set of tools

    ACID Transactions


    6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster introduction
                  Carrier Grade                                                         • Shared-nothing in-memory parallel database server
                   Database                                                             • ACID compliant relational database

                                                                                        • Five nines (99.999%) availability
              Highly Available                                                          • Self-healing, sub-second failover

                    Real-time                                                           • High load, real-time performance
                   Performance                                                          • Predictable low latency, bounded access times

                                                                                        • Incrementally grow out with application demands
           Linearly Scalable                                                            • Linearly scale with distribution awareness
                                                                                                 y

                                                                                        • Open Source, multiple data access
       Open Development                                                                 • High performance APIs (C++, Java, SQL, LDAP)
                                                                                                                 (C ,

7   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Who’s Using MySQL Cluster?




8   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Scalability

            MySQL Cluster Architecture                                                                                              Performance

                                                                                                                                           HA

                                                                                                                                    Ease of use

                                                                                                                                     SQL/Joins
                                                                                                                                     SQL/J i         
                                                                                                             Clients             ACID Transactions   




                                                                                                                       Application Layer

                                                                                                Data Layer


Management


                                                                               MySQL Cluster Data Nodes

    9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.    September 30th 2012
Scalability   
            MySQL Cluster Architecture                                                                                                 Performance

                                                                                                                                           HA

                                                                                                                                       Ease of use

                                                                                                                                        SQL/Joins
                                                                                                                                        SQL/J i       
                                                                                                             Clients             ACID Transactions    




                                                                                                                       Application Layer

                                                                                                Data Layer


Management
                                                                                                                          Management

                                                                               MySQL Cluster Data Nodes

   10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.    September 30th 2012
Scalability   
            MySQL Cluster Architecture                                                                                                 Performance

                                                                                                                                           HA         
                                                                                                                                       Ease of use

                                                                                                                                        SQL/Joins
                                                                                                                                        SQL/J i       
                                                                                                             Clients             ACID Transactions    




                                                                                                                       Application Layer

                                                                                                Data Layer


Management
                                                                                                                          Management

                                                                               MySQL Cluster Data Nodes

   11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.    September 30th 2012
Scalability      
         On-line Scheduled Maintenance                                                                        Performance

                                                                                                                   HA           
                                                                                                               Ease of use

                                                                                                               SQL/Joins
                                                                                                               SQL/J i          
                                                                                                            ACID Transactions   

                                                        Scale                                     Backup




                                                         Evolve                                   Upgrade
                                                                                                   pg

12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Scalability      
         Extreme performance                                                                                 Performance       
                                                                                                                  HA           
                                                                                                              Ease of use

                                                                                                              SQL/Joins
                                                                                                              SQL/J i          
                                                                                                           ACID Transactions   


                                                                                                  writes




13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Creating & running your first Cluster
         The traditional way (pre-MCM) – Up and running in 15 mins




                      Download &                                                                  Configure              Start processes
                      Extract                                                                     •Cluster-wide
                                                                                                  •Cluster wide          •Management Nodes
                      •edelivery.oracle.com                                                        “config.ini”          •Data Nodes
                      •www.mysql.com                                                              •Per-mysqld “my.cnf”   •MySQL Servers
                      •dev.mysql.com




      Up & running in 10-15 minutes using Quick Start guides from http://dev mysql com/downloads/cluster/
                                                                   http://dev.mysql.com/downloads/cluster/
               –      Versions for Linux, Windows & Solaris
14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Scalability        
                                                                               Performance             
                                                                                                  HA   
                                                                                 Ease of use           
                                                                                    SQL/Joins          
                                                                ACID Transactions                      
15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster Manager
         Bootstrap single h t Cl t
         B t t      i l host Cluster


         1.            Download MCM/Cluster package from edelivery.oracle.com:
         2.            Unzip
         3.            Run agent, define, create & start Cluster!
                    $ binmcmd bootst ap
                    $> b  c d –bootstrap
                    MySQL Cluster Manager 1.1.2 started
                    Connect to MySQL Cluster Manager by running "D:AndrewDocumentsMySQLmcmbinmcm" -a NOVA:1862
                    Configuring default cluster 'mycluster'...
                    Starting default cluster 'mycluster'...
                    Cluster 'mycluster' started successfully
                     ndb_mgmd NOVA 1186
                      db    d NOVA:1186
                     ndbd NOVA
                     ndbd NOVA
                     mysqld NOVA:3306
                     mysqld NOVA:3307
                     ndbapi *
                    Connect to the database by running "D:AndrewDocumentsMySQLmcmclusterbinmysql" -h NOVA -P 3306 -u root




16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster 7.3 labs: Auto-Installer

     •        Fast configuration                                                                      Specify
                                                                                                       p    y     Auto-
                                                                                                      Workload   Discover
     •        Auto-discovery

     •        Workload ti i d
              W kl d optimized

     •        Repeatable best
              practices
                  ti

     •        For MySQL Cluster                                                                                  Confirm
              7.2 7 3
              7 2 + 7.3                                                                               Deploy     Topology




17       Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster 7.3 labs: Auto-Installer

     •        Fast configuration

     •        Auto-discovery

     •        Workload ti i d
              W kl d optimized

     •        Repeatable best
              practices
                  ti

     •        For MySQL Cluster
              7.2 7 3
              7 2 + 7.3




18       Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Scalability        
                                                                               Performance             
                                                                                                  HA   
                                                                                 Ease of use           
                                                                                    SQL/Joins          
                                                                ACID Transactions                      
19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
NoSQL Access to MySQL Cluster data

     Apps             Apps               Apps               Apps               Apps               Apps             Apps             Apps   Apps      Apps      Apps        Apps

                                                                                                             JPA
                                                                                                               ClusterJPA

     PHP              PERL              Python               Ruby                             JDBC                          ClusterJ       JSON      Apache    Memcached


                                                                                                                                           Node.js   mod-ndb   ndb-eng
                                                           MySQL                                                              JNI
                                                                                                         NDB API (C++)




                                                                                                  MySQL Cluster Data Nodes




20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster 7.1: ClusterJ/JPA
                                                                                        •         Domain Object Model Persistence API (ClusterJ):
                                                                                                     •   Java API
                                                                                                     •   High performance, low latency
                                                                                                     •   Feature rich
                                                                                        •         JPA interface built upon this new Java layer:
                                                                                                     •   Java Persistence API compliant
                                                                                                         •   Implemented as an OpenJPA plugin
                                                                                                     •   Uses ClusterJ where possible, reverts to JDBC for
                                                                                                         some operations
                                                                                                     •   Higher performance than JDBC
                                                                                                     •   More natural for most Java designers
                                                                                                     •   Easier Cluster adoption for web applications
                                                                                                                Cl ster               eb

21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster 7.2: Memcached

                                                                                        •         Memcached is a distributed memory based hash-
                                                                                                  key/value t
                                                                                                  k / l store with no persistence to disk
                                                                                                                     ith      i t      t di k
                                                                                        •         NoSQL, simple API, popular with developers
                                                                                        •         MySQL Cluster already provides scalable, in-
                                                                                                    y                    yp
                                                                                                  memory performance with NoSQL (hashed) access
                                                                                                  as well as persistence
                                                                                                      • Provide the Memcached API but map to NDB
                                                                                                        API calls
                                                                                        •         Writes-in-place, so no need to invalidate cache
                                                                                        •         Simplifies
                                                                                                  Si lifi architecture as caching & d t b
                                                                                                                hit t           hi      database
                                                                                                  integrated into 1 tier
                                                                                        •         Access data from existing relational tables

22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Traditional Memcached Architecture
          Two l
          T levels of hashing
                l f h hi


           httpd                                                                                  memcached

                                                                                                               hash key
     PHP/Perl                                                                                     memcached
                                                                                                              to find data
 Memcache
                                  friends:12389                                                   memcached
                                  memcache key




23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Memcache Protocol Elements


• Key                                                                Up to 250 characters
• Expire Time                                                        A number in seconds, up to 30 days
                                                                                  seconds
• Flags                                                              32-bit number for application use
• CAS ID                                                             64-bit incrementing version number on value
                                                                     64 bit i        ti       i        b         l
• Value                                                              Value stored for key; traditionally up to 1 MB.




24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Memcache Protocol Commands (1)

• get k
    t key                 Fetch value for this key
                                  al e          ke
•    set key value        Store this data
•    add key value        Store this data (strict insert)
•    replace key value    Store this data (strict update)
•    cas key value cas-id Update with version number check




    25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Memcache Protocol Commands (2)

• append key value                                                                                Append text to current value
• prepend key value                                                                               Insert text before current value
• incr key amount                                                                                 Add to current stored integer value
• decr key amount                                                                                 Subtract from current stored value
• delete key                                                                                      Delete a key and value
• flush_all                                                                                       Delete all stored values on the server
• stats stat-name                                                                                 Fetch server statistics



26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
NDB & Memcache Architecture:
         Memcache protocol + NDB storage
         M      h    t   l        t


                                                                                                                MySQL
                                                                                                                  y Q
Application                                                                                                     Cluster
                                                                                                  memcached    Data Node

 Memcache
                                                                                                  NDB Engine    MySQL
   Client
                                                                                                                Cluster
                                                                                                                Cl
                                                                                                               Data Node


27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Goals

     • Access stored data directly from memcache client
                  • Memcached perspective:
                              • MySQL Cluster is a write-scalable, replicated data store
                                            • with reliable in-memory storage,
                                            • plus on-disk storage when data is too big for memory.
                  • MySQL Cluster perspective:
                              • memcache is a high performance API
                                        • providing easy access to in-memory data,
                                        • plus an extra layer of caching when data is on disk.



28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Memcached/MySQL Cluster latency
                                                                                                  memcachetest -t 2 -M 7000 -c 25000




29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Cluster & Memcached – Schema-Free


                                                                                                  key             value
                                                                            <town:maidenhead,SL6>
          Application i
          A li ti view
          SQL view                                                                                key             value

                                                                            <town:maidenhead,SL6>


                                                                                                  Key         Value
                                                                                      town:maidenhead         SL6
                                                                                                  generic table

30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Cluster & Memcached – Configured Schema


                                                                                                   key         value
                                                                            <town:maidenhead,SL6>
          Application i
          A li ti view
          SQL view                                                               prefix                  key   value

                                                                            <town:maidenhead,SL6>

     Prefix                 Table                  Key-col                   Val-col              policy               town     ...   code    ...
     town:                map.zip                       town                    code              cluster        maidenhead     ...     SL6   ...

                                                 Config tables
                                                 C fi t bl                                                                    map.zip
                                                                                                                                   i

31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Memcached NoSQL Access with InnoDB
•   Memcached as a plugin of
                                                                                                                              Application
    MySQL Server; same
    process space, with very low
    latency access to data                                                                                     SQL                     Memcached protocol
•   Memcapable: supports both                                                                         mysqld

    memcached ascii protocol
                                                                                                               MySQL Server
    and binary protocol                                                                                                                     memcached plugin

•   Support multiple columns:
                                                                                                                                                        local cache
    users can map multiple                                                                                                            innodb_memcache
                                                                                                                                                         (optional)
    columns into “value”                                                                                        Handler API             InnoDB API
•   Optional local caching:
    “innodb-only”, “cache-only”,                                                                                         InnoDB Storage Engine
    and “caching”
•   Batch operations for
    performance
    32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster 7.3 EA: Node.js NoSQL API
                                                                                            Native JavaScript access to MySQL Cluster
                                                                                                        S                  SQ C
                                                                                                    – End-to-End JavaScript: browser to the app and
                                                                         Clients                      database
                                                                                                    – Storing and retrieving JavaScript objects directly
                                                                                                      in MySQL Cluster
                                                                                                          y
                                                                                                    – Eliminate SQL transformation
 V8 JavaScript Engine                                                                       Implemented as a module for node.js
                                                                                               p                              j
     MySQL Cluster Node.js Module                                                                   – Integrates full Cluster API library within the web
                                                                                                      app
                                                                                            Couple high performance, distributed apps, with
                                                                                                   high performance distributed database
     MySQL Cluster Data Nodes

33    Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster NoSQL API for Node.js
     Application Code
     A li ti C d

     // Constructor
     function Tweet(user, message) {
       this.id = UUID.generate();
       this.timestamp = Date.now();
                    p
       this.user = user;
       this.message = message;
            message
     }


34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster NoSQL API for Node.js

                                                                                                   • Modular connector with
// Server Startup                                                                                    various back-end adapters:
                                                                                                      •   ndb: low-level native
                                                                                                          access to MySQL Cluster
var nosql = require('mysql-js');
                                                                                                      •   mysql: access to any
                                                                                                          MySQL server (translates
                                                                                                            y            (
var sessionFactory =                                                                                      operations to SQL
 nosql.connectSync('ndb');                                                                                statements)


nosql.mapClass(Tweet, 'tweets');

 35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster NoSQL API for Node.js


     // Create a tweet

     function newTweet(err, dbSession, httpReq) {
       var tweet = new Tweet(
              httpReq.user,
              httpReq.message);
           dbSession.persist(tweet);
     }

36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster NoSQL API for Node.js


       function onNewTweetRequest(err, httpReq) {
         sessionFactory.openSession(null, newTweet, httpReq);
       }




37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
MySQL Cluster NoSQL API for Node.js
         Sync s Async Execution
         S nc vs. As nc E ec tion
        If you had all synchronous operations
            y            y           p
                  – Single execution context blocked for I/O.
                  – Low performance
                        p
        If you had all async operations
                  – Complex code
                  – Each individual operation nested within its own callback function.
        The right balance
                  – Define a database operation as an immediate call (no I/O)
                  – Execute database operations in async calls with callbacks
38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Next Steps
                             Learn More
                             • www.mysql.com/cluster
                             • A th ti M SQL C i l
                               Authentic MySQL Curriculum:
                               http://oracle.com/education/mysql

                             Try O t
                             T it Out
                             • dev.mysql.com/cluster
                             • labs.mysql.com
                                     y


                             Let us know what you think
                             • clusterdb.com
                             • @clusterdb
                             • forums mysql com/list php?25
                               forums.mysql.com/list.php?25

39   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012
Graphic Section Divider




40   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   September 30th 2012

More Related Content

What's hot

Going mobile with Liferay 6.0
Going mobile with Liferay 6.0Going mobile with Liferay 6.0
Going mobile with Liferay 6.0
ACA IT-Solutions
 
Dev mobile apps ent it final
Dev mobile apps ent   it finalDev mobile apps ent   it final
Dev mobile apps ent it final
Heinrich Seeger
 
5 Starting Apps for Your Business and How to Roll Them Out
5 Starting Apps for Your Business and How to Roll Them Out5 Starting Apps for Your Business and How to Roll Them Out
5 Starting Apps for Your Business and How to Roll Them Out
Apperian
 
Cisco @ Canadian Construction Association 2012
Cisco @ Canadian Construction Association 2012Cisco @ Canadian Construction Association 2012
Cisco @ Canadian Construction Association 2012
Rick Huijbregts
 
1st day 3 - agility vs risk
1st day   3 - agility vs risk1st day   3 - agility vs risk
1st day 3 - agility vs risk
Lilian Schaffer
 
Ibm Java在企业级开发中的应用
Ibm Java在企业级开发中的应用Ibm Java在企业级开发中的应用
Ibm Java在企业级开发中的应用
George Ang
 
Adobe Flex体系架构深度剖析
Adobe Flex体系架构深度剖析Adobe Flex体系架构深度剖析
Adobe Flex体系架构深度剖析
George Ang
 

What's hot (20)

Oop2012 keynote Design Driven Development
Oop2012 keynote Design Driven DevelopmentOop2012 keynote Design Driven Development
Oop2012 keynote Design Driven Development
 
Unwired Platform
Unwired PlatformUnwired Platform
Unwired Platform
 
Eva flex java_1_slides
Eva flex java_1_slidesEva flex java_1_slides
Eva flex java_1_slides
 
The Enterprise Goes Mobile
The Enterprise Goes MobileThe Enterprise Goes Mobile
The Enterprise Goes Mobile
 
Slides - The 4 Golden Rules Of Mobility
Slides - The 4 Golden Rules Of MobilitySlides - The 4 Golden Rules Of Mobility
Slides - The 4 Golden Rules Of Mobility
 
Adobe et la stratégie multi-écrans
Adobe et la stratégie multi-écransAdobe et la stratégie multi-écrans
Adobe et la stratégie multi-écrans
 
RTView - Monitoring Service for SmartCloud Applications
RTView - Monitoring Service for SmartCloud ApplicationsRTView - Monitoring Service for SmartCloud Applications
RTView - Monitoring Service for SmartCloud Applications
 
Going mobile with Liferay 6.0
Going mobile with Liferay 6.0Going mobile with Liferay 6.0
Going mobile with Liferay 6.0
 
Dev mobile apps ent it final
Dev mobile apps ent   it finalDev mobile apps ent   it final
Dev mobile apps ent it final
 
Flex and the city in London - Keynote
Flex and the city in London - KeynoteFlex and the city in London - Keynote
Flex and the city in London - Keynote
 
Mobile trends and impressions
Mobile trends and impressionsMobile trends and impressions
Mobile trends and impressions
 
5 Starting Apps for Your Business and How to Roll Them Out
5 Starting Apps for Your Business and How to Roll Them Out5 Starting Apps for Your Business and How to Roll Them Out
5 Starting Apps for Your Business and How to Roll Them Out
 
UC Vendor Overview
UC Vendor Overview UC Vendor Overview
UC Vendor Overview
 
Flash camp portugal - Let's talk about Flex baby
Flash camp portugal - Let's talk about Flex babyFlash camp portugal - Let's talk about Flex baby
Flash camp portugal - Let's talk about Flex baby
 
Cisco @ Canadian Construction Association 2012
Cisco @ Canadian Construction Association 2012Cisco @ Canadian Construction Association 2012
Cisco @ Canadian Construction Association 2012
 
MYZEAL IT Solutions-Offshore Mobile Apps Development Company India
MYZEAL IT Solutions-Offshore Mobile Apps Development Company IndiaMYZEAL IT Solutions-Offshore Mobile Apps Development Company India
MYZEAL IT Solutions-Offshore Mobile Apps Development Company India
 
1st day 3 - agility vs risk
1st day   3 - agility vs risk1st day   3 - agility vs risk
1st day 3 - agility vs risk
 
Adobe flash platform java
Adobe flash platform javaAdobe flash platform java
Adobe flash platform java
 
Ibm Java在企业级开发中的应用
Ibm Java在企业级开发中的应用Ibm Java在企业级开发中的应用
Ibm Java在企业级开发中的应用
 
Adobe Flex体系架构深度剖析
Adobe Flex体系架构深度剖析Adobe Flex体系架构深度剖析
Adobe Flex体系架构深度剖析
 

Viewers also liked

Viewers also liked (6)

PistonHead's use of MongoDB for Analytics
PistonHead's use of MongoDB for AnalyticsPistonHead's use of MongoDB for Analytics
PistonHead's use of MongoDB for Analytics
 
Joins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsJoins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation Enhancements
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinar
 
The rise of microservices - containers and orchestration
The rise of microservices - containers and orchestrationThe rise of microservices - containers and orchestration
The rise of microservices - containers and orchestration
 
Data Streaming with Apache Kafka & MongoDB - EMEA
Data Streaming with Apache Kafka & MongoDB - EMEAData Streaming with Apache Kafka & MongoDB - EMEA
Data Streaming with Apache Kafka & MongoDB - EMEA
 
Powering Microservices with MongoDB, Docker, Kubernetes & Kafka – MongoDB Eur...
Powering Microservices with MongoDB, Docker, Kubernetes & Kafka – MongoDB Eur...Powering Microservices with MongoDB, Docker, Kubernetes & Kafka – MongoDB Eur...
Powering Microservices with MongoDB, Docker, Kubernetes & Kafka – MongoDB Eur...
 

Similar to Developing high-throughput services with no sql ap-is to innodb and mysql cluster

ReadyCloud Collaboration, a Cisco Powered service
ReadyCloud Collaboration, a Cisco Powered serviceReadyCloud Collaboration, a Cisco Powered service
ReadyCloud Collaboration, a Cisco Powered service
Gen-i
 
Express Data - BYOD
Express Data - BYODExpress Data - BYOD
Express Data - BYOD
Gen-i
 
Express Data - BYOD
Express Data - BYODExpress Data - BYOD
Express Data - BYOD
Gen-i
 
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
Eucalyptus Systems, Inc.
 
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
Eucalyptus Systems, Inc.
 
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
Eucalyptus Systems, Inc.
 
Cisco tec surya panditi - service provider
Cisco tec   surya panditi - service providerCisco tec   surya panditi - service provider
Cisco tec surya panditi - service provider
Cisco Public Relations
 
Cisco pat adamiak navigating with a world of many clouds
Cisco pat adamiak   navigating with a world of many cloudsCisco pat adamiak   navigating with a world of many clouds
Cisco pat adamiak navigating with a world of many clouds
Khazret Sapenov
 

Similar to Developing high-throughput services with no sql ap-is to innodb and mysql cluster (20)

MySQL Cluster 7.2 e 7.3 - por Andrew Morgan
MySQL Cluster 7.2 e 7.3 - por Andrew MorganMySQL Cluster 7.2 e 7.3 - por Andrew Morgan
MySQL Cluster 7.2 e 7.3 - por Andrew Morgan
 
NoSQL and MySQL webinar - best of both worlds
NoSQL and MySQL webinar - best of both worldsNoSQL and MySQL webinar - best of both worlds
NoSQL and MySQL webinar - best of both worlds
 
MySQL HA Solutions
MySQL HA SolutionsMySQL HA Solutions
MySQL HA Solutions
 
Application-Aware Network Performance Management
Application-Aware Network Performance ManagementApplication-Aware Network Performance Management
Application-Aware Network Performance Management
 
Leverage An Intelligent Application Infrastructure for Competitive Advantage.
Leverage An Intelligent Application Infrastructure for Competitive Advantage.Leverage An Intelligent Application Infrastructure for Competitive Advantage.
Leverage An Intelligent Application Infrastructure for Competitive Advantage.
 
Day 2 p3 - automation
Day 2   p3 - automationDay 2   p3 - automation
Day 2 p3 - automation
 
Day 2 p3 - automation
Day 2   p3 - automationDay 2   p3 - automation
Day 2 p3 - automation
 
ReadyCloud Collaboration, a Cisco Powered service
ReadyCloud Collaboration, a Cisco Powered serviceReadyCloud Collaboration, a Cisco Powered service
ReadyCloud Collaboration, a Cisco Powered service
 
Express Data - BYOD
Express Data - BYODExpress Data - BYOD
Express Data - BYOD
 
Express Data - BYOD
Express Data - BYODExpress Data - BYOD
Express Data - BYOD
 
AppDynamics- A sneak peak into the product that is disrupting the Application...
AppDynamics- A sneak peak into the product that is disrupting the Application...AppDynamics- A sneak peak into the product that is disrupting the Application...
AppDynamics- A sneak peak into the product that is disrupting the Application...
 
Joint Oracle-cVidya Cloud webinar - SaaS Market Growth & Opportunities
Joint Oracle-cVidya Cloud webinar - SaaS Market Growth & OpportunitiesJoint Oracle-cVidya Cloud webinar - SaaS Market Growth & Opportunities
Joint Oracle-cVidya Cloud webinar - SaaS Market Growth & Opportunities
 
Sdnhpkorea
SdnhpkoreaSdnhpkorea
Sdnhpkorea
 
It's 2013 - Time to build and test mobile apps...FAST
It's 2013 - Time to build and test mobile apps...FASTIt's 2013 - Time to build and test mobile apps...FAST
It's 2013 - Time to build and test mobile apps...FAST
 
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
 
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
 
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
How to Transform Enterprise Applications to On-premise Clouds with Wipro and ...
 
WebLogic Consolidation Webcast 27 Jan 2011
WebLogic Consolidation Webcast 27 Jan 2011WebLogic Consolidation Webcast 27 Jan 2011
WebLogic Consolidation Webcast 27 Jan 2011
 
Cisco tec surya panditi - service provider
Cisco tec   surya panditi - service providerCisco tec   surya panditi - service provider
Cisco tec surya panditi - service provider
 
Cisco pat adamiak navigating with a world of many clouds
Cisco pat adamiak   navigating with a world of many cloudsCisco pat adamiak   navigating with a world of many clouds
Cisco pat adamiak navigating with a world of many clouds
 

More from Andrew Morgan

More from Andrew Morgan (11)

Document validation in MongoDB 3.2
Document validation in MongoDB 3.2Document validation in MongoDB 3.2
Document validation in MongoDB 3.2
 
What's new in MySQL Cluster 7.4 webinar charts
What's new in MySQL Cluster 7.4 webinar chartsWhat's new in MySQL Cluster 7.4 webinar charts
What's new in MySQL Cluster 7.4 webinar charts
 
MySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinarMySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinar
 
FOSDEM 2015 - NoSQL and SQL the best of both worlds
FOSDEM 2015 - NoSQL and SQL the best of both worldsFOSDEM 2015 - NoSQL and SQL the best of both worlds
FOSDEM 2015 - NoSQL and SQL the best of both worlds
 
MySQL Replication: What’s New in MySQL 5.7 and Beyond
MySQL Replication: What’s New in MySQL 5.7 and BeyondMySQL Replication: What’s New in MySQL 5.7 and Beyond
MySQL Replication: What’s New in MySQL 5.7 and Beyond
 
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQLNoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
NoSQL and SQL - Why Choose? Enjoy the best of both worlds with MySQL
 
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
 
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worldsOUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
OUG Scotland 2014 - NoSQL and MySQL - The best of both worlds
 
NoSQL & SQL - Best of both worlds - BarCamp Berkshire 2013
NoSQL & SQL - Best of both worlds - BarCamp Berkshire 2013NoSQL & SQL - Best of both worlds - BarCamp Berkshire 2013
NoSQL & SQL - Best of both worlds - BarCamp Berkshire 2013
 
NoSQL and SQL - blending the best of both worlds
NoSQL and SQL - blending the best of both worldsNoSQL and SQL - blending the best of both worlds
NoSQL and SQL - blending the best of both worlds
 
Mysql cluster introduction
Mysql cluster introductionMysql cluster introduction
Mysql cluster introduction
 

Developing high-throughput services with no sql ap-is to innodb and mysql cluster

  • 1. Developing High-Throughput Services with NoSQL APIs to InnoDB and MySQL Cluster Andrew Morgan – MySQL Product Management John Duncan – MySQL Cluster Engineering 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 2. Program Agenda  Why NoSQL  MySQL Cluster Attributes  NoSQL APIs for MySQL Cluster  Memcached API for InnoDB  Node.js – Native javascript access  Next Steps 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 3. Disclaimer The f ll i is intended to tli Th following i i t d d t outline our general product di ti l d t direction. It i is intended for information purposes only, and may not be incorporated into i t any contract. It is not a commitment to deliver any material, t t i t it t t d li t i l code, or functionality, and should not be relied upon in making purchasing d i i h i decisions. Th d The development, release, and ti i of any l t l d timing f features or functionality described for Oracle’s products remains at the l discretion of O l th sole di ti f Oracle. 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 4. NoSQL – Why the demand? 2.1BN USERS  Web W b applications li ti 8X DATA GROWTH IN 5 YRS 900M USERS demanding: 40% DATA 70+ NEW DOMAINS EVERY 60 SECONDS 20M APPS PER DAY  Development velocity: GROWTH PER YEAR 60 HOURS Simplicity & flexibility of UPLOADED EVERY MINUTE data model & APIs  Scalability & $1TR BY 2014 350m TWEETS performance: high write PER DAY $700BN IN 2011 throughput and Key/Value access  Support for “Big Data” 5.9BN MOBILE SUBS IN 2011 1 BILLION iOS & ANDROID 85% HANDSETS SHIPPED WITH A APPS DOWNLOADED PER WEEK BROWSER 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 5. What NoSQL must deliver  Massive scalability Scalability  No application-level sharding o app cat o e e s a d g Performance  Performance  High Availability/Fault Tolerance HA  Ease of use Ease of use  Simple operations/administration  Simple APIs  Quickly evolve application & schema 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 6. Still a role for the RDBMS?  No best single solution fits all NoSQL RDBMS  Mix and match Simple Si l access patterns tt Complex queries with j i C l i ith joins Scalability Compromise on consistency Performance ACID transactions for performance HA Ad-hoc data format Well defined schemas Ease o use ase of SQL/Joins Simple operation Rich set of tools ACID Transactions 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 7. MySQL Cluster introduction Carrier Grade • Shared-nothing in-memory parallel database server Database • ACID compliant relational database • Five nines (99.999%) availability Highly Available • Self-healing, sub-second failover Real-time • High load, real-time performance Performance • Predictable low latency, bounded access times • Incrementally grow out with application demands Linearly Scalable • Linearly scale with distribution awareness y • Open Source, multiple data access Open Development • High performance APIs (C++, Java, SQL, LDAP) (C , 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 8. Who’s Using MySQL Cluster? 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 9. Scalability MySQL Cluster Architecture Performance HA Ease of use SQL/Joins SQL/J i  Clients ACID Transactions  Application Layer Data Layer Management MySQL Cluster Data Nodes 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 10. Scalability  MySQL Cluster Architecture Performance HA Ease of use SQL/Joins SQL/J i  Clients ACID Transactions  Application Layer Data Layer Management Management MySQL Cluster Data Nodes 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 11. Scalability  MySQL Cluster Architecture Performance HA  Ease of use SQL/Joins SQL/J i  Clients ACID Transactions  Application Layer Data Layer Management Management MySQL Cluster Data Nodes 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 12. Scalability  On-line Scheduled Maintenance Performance HA  Ease of use SQL/Joins SQL/J i  ACID Transactions  Scale Backup Evolve Upgrade pg 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 13. Scalability  Extreme performance Performance  HA  Ease of use SQL/Joins SQL/J i  ACID Transactions  writes 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 14. Creating & running your first Cluster The traditional way (pre-MCM) – Up and running in 15 mins Download & Configure Start processes Extract •Cluster-wide •Cluster wide •Management Nodes •edelivery.oracle.com “config.ini” •Data Nodes •www.mysql.com •Per-mysqld “my.cnf” •MySQL Servers •dev.mysql.com  Up & running in 10-15 minutes using Quick Start guides from http://dev mysql com/downloads/cluster/ http://dev.mysql.com/downloads/cluster/ – Versions for Linux, Windows & Solaris 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 15. Scalability  Performance  HA  Ease of use  SQL/Joins  ACID Transactions  15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 16. MySQL Cluster Manager Bootstrap single h t Cl t B t t i l host Cluster 1. Download MCM/Cluster package from edelivery.oracle.com: 2. Unzip 3. Run agent, define, create & start Cluster! $ binmcmd bootst ap $> b c d –bootstrap MySQL Cluster Manager 1.1.2 started Connect to MySQL Cluster Manager by running "D:AndrewDocumentsMySQLmcmbinmcm" -a NOVA:1862 Configuring default cluster 'mycluster'... Starting default cluster 'mycluster'... Cluster 'mycluster' started successfully ndb_mgmd NOVA 1186 db d NOVA:1186 ndbd NOVA ndbd NOVA mysqld NOVA:3306 mysqld NOVA:3307 ndbapi * Connect to the database by running "D:AndrewDocumentsMySQLmcmclusterbinmysql" -h NOVA -P 3306 -u root 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 17. MySQL Cluster 7.3 labs: Auto-Installer • Fast configuration Specify p y Auto- Workload Discover • Auto-discovery • Workload ti i d W kl d optimized • Repeatable best practices ti • For MySQL Cluster Confirm 7.2 7 3 7 2 + 7.3 Deploy Topology 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 18. MySQL Cluster 7.3 labs: Auto-Installer • Fast configuration • Auto-discovery • Workload ti i d W kl d optimized • Repeatable best practices ti • For MySQL Cluster 7.2 7 3 7 2 + 7.3 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 19. Scalability  Performance  HA  Ease of use  SQL/Joins  ACID Transactions  19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 20. NoSQL Access to MySQL Cluster data Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps Apps JPA ClusterJPA PHP PERL Python Ruby JDBC ClusterJ JSON Apache Memcached Node.js mod-ndb ndb-eng MySQL JNI NDB API (C++) MySQL Cluster Data Nodes 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 21. MySQL Cluster 7.1: ClusterJ/JPA • Domain Object Model Persistence API (ClusterJ): • Java API • High performance, low latency • Feature rich • JPA interface built upon this new Java layer: • Java Persistence API compliant • Implemented as an OpenJPA plugin • Uses ClusterJ where possible, reverts to JDBC for some operations • Higher performance than JDBC • More natural for most Java designers • Easier Cluster adoption for web applications Cl ster eb 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 22. MySQL Cluster 7.2: Memcached • Memcached is a distributed memory based hash- key/value t k / l store with no persistence to disk ith i t t di k • NoSQL, simple API, popular with developers • MySQL Cluster already provides scalable, in- y yp memory performance with NoSQL (hashed) access as well as persistence • Provide the Memcached API but map to NDB API calls • Writes-in-place, so no need to invalidate cache • Simplifies Si lifi architecture as caching & d t b hit t hi database integrated into 1 tier • Access data from existing relational tables 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 23. Traditional Memcached Architecture Two l T levels of hashing l f h hi httpd memcached hash key PHP/Perl memcached to find data Memcache friends:12389 memcached memcache key 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 24. Memcache Protocol Elements • Key Up to 250 characters • Expire Time A number in seconds, up to 30 days seconds • Flags 32-bit number for application use • CAS ID 64-bit incrementing version number on value 64 bit i ti i b l • Value Value stored for key; traditionally up to 1 MB. 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 25. Memcache Protocol Commands (1) • get k t key Fetch value for this key al e ke • set key value Store this data • add key value Store this data (strict insert) • replace key value Store this data (strict update) • cas key value cas-id Update with version number check 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 26. Memcache Protocol Commands (2) • append key value Append text to current value • prepend key value Insert text before current value • incr key amount Add to current stored integer value • decr key amount Subtract from current stored value • delete key Delete a key and value • flush_all Delete all stored values on the server • stats stat-name Fetch server statistics 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 27. NDB & Memcache Architecture: Memcache protocol + NDB storage M h t l t MySQL y Q Application Cluster memcached Data Node Memcache NDB Engine MySQL Client Cluster Cl Data Node 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 28. Goals • Access stored data directly from memcache client • Memcached perspective: • MySQL Cluster is a write-scalable, replicated data store • with reliable in-memory storage, • plus on-disk storage when data is too big for memory. • MySQL Cluster perspective: • memcache is a high performance API • providing easy access to in-memory data, • plus an extra layer of caching when data is on disk. 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 29. Memcached/MySQL Cluster latency memcachetest -t 2 -M 7000 -c 25000 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 30. Cluster & Memcached – Schema-Free key value <town:maidenhead,SL6> Application i A li ti view SQL view key value <town:maidenhead,SL6> Key Value town:maidenhead SL6 generic table 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 31. Cluster & Memcached – Configured Schema key value <town:maidenhead,SL6> Application i A li ti view SQL view prefix key value <town:maidenhead,SL6> Prefix Table Key-col Val-col policy town ... code ... town: map.zip town code cluster maidenhead ... SL6 ... Config tables C fi t bl map.zip i 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 32. Memcached NoSQL Access with InnoDB • Memcached as a plugin of Application MySQL Server; same process space, with very low latency access to data SQL Memcached protocol • Memcapable: supports both mysqld memcached ascii protocol MySQL Server and binary protocol memcached plugin • Support multiple columns: local cache users can map multiple innodb_memcache (optional) columns into “value” Handler API InnoDB API • Optional local caching: “innodb-only”, “cache-only”, InnoDB Storage Engine and “caching” • Batch operations for performance 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 33. MySQL Cluster 7.3 EA: Node.js NoSQL API  Native JavaScript access to MySQL Cluster S SQ C – End-to-End JavaScript: browser to the app and Clients database – Storing and retrieving JavaScript objects directly in MySQL Cluster y – Eliminate SQL transformation V8 JavaScript Engine  Implemented as a module for node.js p j MySQL Cluster Node.js Module – Integrates full Cluster API library within the web app  Couple high performance, distributed apps, with high performance distributed database MySQL Cluster Data Nodes 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 34. MySQL Cluster NoSQL API for Node.js Application Code A li ti C d // Constructor function Tweet(user, message) { this.id = UUID.generate(); this.timestamp = Date.now(); p this.user = user; this.message = message; message } 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 35. MySQL Cluster NoSQL API for Node.js • Modular connector with // Server Startup various back-end adapters: • ndb: low-level native access to MySQL Cluster var nosql = require('mysql-js'); • mysql: access to any MySQL server (translates y ( var sessionFactory = operations to SQL nosql.connectSync('ndb'); statements) nosql.mapClass(Tweet, 'tweets'); 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 36. MySQL Cluster NoSQL API for Node.js // Create a tweet function newTweet(err, dbSession, httpReq) { var tweet = new Tweet( httpReq.user, httpReq.message); dbSession.persist(tweet); } 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 37. MySQL Cluster NoSQL API for Node.js function onNewTweetRequest(err, httpReq) { sessionFactory.openSession(null, newTweet, httpReq); } 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 38. MySQL Cluster NoSQL API for Node.js Sync s Async Execution S nc vs. As nc E ec tion  If you had all synchronous operations y y p – Single execution context blocked for I/O. – Low performance p  If you had all async operations – Complex code – Each individual operation nested within its own callback function.  The right balance – Define a database operation as an immediate call (no I/O) – Execute database operations in async calls with callbacks 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 39. Next Steps Learn More • www.mysql.com/cluster • A th ti M SQL C i l Authentic MySQL Curriculum: http://oracle.com/education/mysql Try O t T it Out • dev.mysql.com/cluster • labs.mysql.com y Let us know what you think • clusterdb.com • @clusterdb • forums mysql com/list php?25 forums.mysql.com/list.php?25 39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012
  • 40. Graphic Section Divider 40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. September 30th 2012