SlideShare a Scribd company logo
1 of 69
MySQL Cluster and NoSQL

December 2012




Johan Andersson

Severalnines AB

johan@severalnines.com

Cell +46 73 073 60 99
Copyright 2011 Severalnines AB




Topics

  RDBMS/NoSQL

  API Overview

  Memcached Installation

  Configuration

  Performance Tuning

  Troubleshooting

  Use Cases

                                 2
Copyright 2012 Severalnines AB




  RDBMS vs NoSQL

RDBMS                                 NoSQL
  Structure and relations are          Structure and relations not as
   important                             important
     Relational schema                    Focus on storing/retrieving

  Complex Queries                      Simple access
     JOINs                                E.g. Key Value: get(), set()

  ACID                                 Eventual Consistency

  Scalability usually not built-in     Scalability built-in

  Durability of data on one            Durability of data guaranteed by
   node                                  having data on multiple nodes


                                                                            3
Copyright 2012 Severalnines AB




  RDBMS vs NoSQL

RDBMS                                 NoSQL
  Structure and relations are          Structure and relations not as
   important                             important
     Relational schema                    Focus on storing/retrieving

  Complex Queries                      Simple access
     JOINs                                E.g. Key Value: get(), set()

  ACID                                 Eventual Consistency

  Scalability usually not built-in     Scalability built-in

  Durability of data on one            Durability of data guaranteed by
   node                                  having data on multiple nodes


                                                                            4
Copyright 2012 Severalnines AB




  RDBMS vs NoSQL

RDBMS                                 NoSQL
  Structure and relations are          Structure and relations not as
   important                             important
     Relational schema                    Focus on storing/retrieving

  Complex Queries                      Simple access
     JOINs                                E.g. Key Value: get(), set()

  ACID                                 Eventual Consistency

  Scalability usually not built-in     Scalability built-in

  Durability of data on one            Durability of data guaranteed by
   node                                  having data on multiple nodes


                                                                            5
Copyright 2012 Severalnines AB




  RDBMS vs NoSQL

RDBMS                                 NoSQL
  Structure and relations are          Structure and relations not as
   important                             important
     Relational schema                    Focus on storing/retrieving

  Complex Queries                      Simple access
     JOINs                                E.g. Key Value: get(), set()

  ACID                                 Eventual Consistency

  Scalability usually not built-in     Scalability built-in

  Durability of data on one            Durability of data guaranteed by
   node                                  having data on multiple nodes


                                                                            6
Copyright 2012 Severalnines AB




  RDBMS vs NoSQL

RDBMS                                 NoSQL
  Structure and relations are          Structure and relations not as
   important                             important
     Relational schema                    Focus on storing/retrieving

  Complex Queries                      Simple access
     JOINs                                E.g. Key Value: get(), set()

  ACID                                 Eventual Consistency

  Scalability usually not built-in     Scalability built-in

  Durability of data on one            Durability of data guaranteed by
   node                                  having data on multiple nodes


                                                                            7
Copyright 2012 Severalnines AB




  RDBMS vs NoSQL

RDBMS                                 NoSQL
  Structure and relations are          Structure and relations not as
   important                             important
     Relational schema                    Focus on storing/retrieving

  Complex Queries                      Simple access
     JOINs                                E.g. Key Value: get(), set()

  ACID                                 Eventual Consistency

  Scalability usually not built-in     Scalability built-in

  Durability of data on one            Durability of data guaranteed by
   node                                  having data on multiple nodes


                                                                            8
Copyright 2012 Severalnines AB




Introducing MySQL Cluster
  Shared Nothing database
       Up to 255 nodes in a cluster
       Automatic sharding

  In-memory or hybrid disk data storage

  Multiple APIs

  Availability
       Strong consistency with synchronous replication
       Automatic fail-over within a cluster
       Eventual consistency between clusters


                                                          9
Copyright 2012 Severalnines AB




Architecture




                                 10
Copyright 2012 Severalnines AB




 #1 – Horizontal scalability
   Data Nodes
        Stores the data
        Memory or disk tables
        Can be added online




Shard 1                Shard 2    Shard 3




                                            11
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 Data

                                        12
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 13
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 14
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 15
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 16
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 17
Copyright 2012 Severalnines AB




#2 – API
 Not Only SQL




                                 18
Copyright 2012 Severalnines AB




 #3 – Schema
   SQL/Relational
          Add column
          Add/remove index

   Memcached
                                                   prefix   key     value
          Key-value
                                                 <city:     ldn       1>




Prefix       Table         Key-col   Val-col   policy         city    …     code   …     …
city:    AreaCode            city    code      cluster        ldn     …      1     …     …

           Configuration/Mapping                                     Table: ‘AreaCode’

                                                                                             19
Copyright 2012 Severalnines AB




#4 – Data Consistency
  Strong consistency within a cluster

  Eventual consistency across clusters




                                    EU Cluster
              US Cluster




                                                 20
Copyright 2012 Severalnines AB




#5 – Data Storage
  Memory Tables
       No disk checkpoints

  Memory Tables
       With disk checkpoints

  Disk Data tables
       Index in memory


  Writes not IO bound
       Transaction durability = data written in at least 2 nodes


                                                                    21
SQL Access

  Parsing/Optimizing/Executing Query Takes time

  Query plan converted to NDBAPI calls

  Introduces an extra network hop often:

     APP      MYSQLD        NDB
NoSQL : Memcached
(new in 7.2)

  Native Key-Value access (converts memcached proto to
   ndbapi calls)

  Bypasses SQL

  Schema and schemaless data storage
                               MEMCACHED
                    APP                       NDB
  By default                     server

    -    Every KV written to the same table
    -    Each KV in a single row
  Or configure to use existing tables
NoSQL : REST

  Bypasses SQL

  Native HTTP/REST access

  Loads in an Apache module (mod_ndb)

                  Apache      NDB
NoSQL : Cluster/J

  Bypasses SQL

  Native Java and JPA access



                  AppServer
                                NDB
                    EJB
NoSQL: NDBAPI (sync)

  C++ API supporting GET/SET/RANGE_SCAN/SCAN

  Bypasses SQL
                               NDBAPI
  Ultra low latency                         NDB
                                client


  Hand-optimize execution path

  Lots of freedom (also to make mistakes)
NoSQL : NDBAPI (sync)
   DEFINE AND STORAGE BUFFERS (NDB RECORD)

   START TRANSACTION

   CREATE OPERATION ( on table)
     -    DEFINE OPERATION (insert/update/read/delete) – PK operation
     -    GET/SET PK AND VALUES
     -    <repeat these for batching or read from many tables>


   EXECUTE ( COMMIT / NO COMMIT)

   CHECK STORAGE BUFFERS
NoSQL : NDBAPI (async)
  Bypasses SQL

  Similar to node.js with callbacks registered and executed
   on completion

  Ultra fast performance for GET/SET on PK

                                         NDBAPI
  Hand-optimize execution path                            NDB
                                          client

  Lots of freedom (also to make mistakes)

  Scales with number of threads and number of Apps
NoSQL : NDBAPI (async)
  DEFINE AND STORAGE BUFFERS (NDB RECORD)
   PREPARE TRANSACTION
    -    ASSIGN A CALLBACK
    -    CREATE OPERATION ( on table)
    -    DEFINE OPERATION (insert/update/read/delete) – PK operation
    -    GET/SET PK AND VALUES
    -    <repeat these for batching or read from many tables>

  <repeat and PREPARE up to 1024 TXs>

  SEND to NDB
  POLL for CALLBACKs
    -    Executes callbacks, and PREPARE a new TX if you want.
    -    CHECK STORAGE BUFFERS
NoSQL : NDBAPI (async)

  Using the Async NDBAPI Oracle managed to get 1.05 Billion
   Queries Per Minute
    -    flexAsync -a 25 -p 128 -t <cores> -l <iterations>
    -    8 data nodes (48GB of RAM)
    -    10 api nodes
    -    Intel X5670 (2 CPU x 6 cores)
    -    Infiniband (IPoIB)
Copyright 2011 Severalnines AB




Introduction

  Memcached access to NDB is included in MySQL Cluster
   7.2

  Provides a Memcached Interface to NDB data
       Using get/set to read and write data
       Avoid SQL altogether (except for creating tables)

  There several “run-time” models that can be configured
       Affects mainly placement of data




                                                            31
Copyright 2011 Severalnines AB




Introduction

  Memcached uses the NDBAPI (C++ direct API) to access
   data in NDB.

  There are two flavors of the NDBAPI
       Synchronous NDBAPI
       Asynchronous NDBAPI

  Memcached uses the Asynchronous NDBAPI




                                                          32
Copyright 2011 Severalnines AB




Introduction

                                     “S” SCHEDULER




                                     Worker threads

                                     ndb        ndb


                                 Ndb_cluster_connection



                                                          33
Copyright 2011 Severalnines AB




        Introduction

                  Synchronous                   Asynchronous
                    Start transaction            Start transaction
                                                     Associate callback

                    Create op                    Create op
logic                  Set op type                  Set op type
                                                     Bind keys/values
                         Bind keys/values
                                                  Prepare transaction
ndb                 Execute
                                                  Send
                         Send request to NDB        Send request to NDB
                         Check result
                                                  Poll
                                                     Check callbacks

                                                                            34
Copyright 2011 Severalnines AB




Introduction

  Asynchronous invocation gives
       Higher degree of parallelism, up to 1024 transactions in flight
        from each NDB object
       Less threads needed to drive load
       Both threads and transaction parallelism in one shot!
       Harder programming model

  Synchronous invocation gives
       Easy programming model
       One thread does one transaction at a time, less parallelism
       Many threads needed to drive high load


                                                                          35
Copyright 2011 Severalnines AB




Introduction

  Memcached supported operations
       GET / MULTI GET
       SET
       ADD
       REPLACE
       CAS
       INCR
       DECR




                                    36
Copyright 2011 Severalnines AB




Installation

  The memcached server is included in the MySQL Cluster
   distributions
       <basedir>/bin/memcached

  Memcached also requires a plugin that is also included in
   the distribution
       <basedir>/lib/ndb_engine.so or /usr/lib64/ndb_engine.so

  It requires a connect string to be able to join the NDB Cluster

  + “normal” memcached options
       port, bind-address etc


                                                                     37
Copyright 2011 Severalnines AB




Installation

  Starting Memcached can be done as follows:
   memcached -p11211                                          
              -E <basedir>/lib/ndb_engine.so                  
              -u nobody                                       
              -d                                              
              -l 127.0.0.1                                    
             -e connectstring=127.0.0.1:1186

  Options:
   -l   --               bind-address
   -u   --               user
   -d   --               daemon
   -e   --               connectstring and more NDB options
   -E   --               specifies a memcached plugin



                                                                  38
Copyright 2011 Severalnines AB




Installation
                                       memcached
                                       server
  Before we can start
   memcached we must sanity
   check NDB Cluster
       memcached will by default
        make two connections to the
        Data Nodes.
       This is same as
          --ndb-cluster-connection-
            pool=2
                                         P0        P1
                                         S1        S0



                                                        39
Copyright 2011 Severalnines AB




Installation

  Use ndb_mgm to check for free slots
          ndb_mgm> show
          Connected to Management Server at: localhost:1186
          Cluster Configuration
          ---------------------
          [ndbd(NDB)]    2 node(s)
          id=3 @10.176.129.89 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0,
          Master)
          id=4 @10.178.0.69 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0)

          [ndb_mgmd(MGM)]     2 node(s)
          id=1 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8)
          id=2 @10.177.67.255 (mysql-5.5.27 ndb-7.2.8)

          [mysqld(API)] 27 node(s)
          id=5 @10.176.131.164 (mysql-5.5.27   ndb-7.2.8)
          id=6 @10.176.131.164 (mysql-5.5.27   ndb-7.2.8)
          id=7 @10.176.131.165 (mysql-5.5.27   ndb-7.2.8)
          id=8 @10.176.131.165 (mysql-5.5.27   ndb-7.2.8)
Copyright 2011 Severalnines AB




Installation

  In the previous example you must add atleast two “slots”
       Change config.ini and add
        [mysqld]
        [mysqld]
       Perform a rolling restart
          Stop and start the management servers one at a time
            Stop and start one data node at a time
            Stop and start the mysql servers one at a time
Copyright 2011 Severalnines AB




Installation

  Now we can connect!
          ndb_mgm> show
          Connected to Management Server at: localhost:1186
          Cluster Configuration
          ---------------------
          [ndbd(NDB)]    2 node(s)
          id=3 @10.176.129.89 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0,
          Master)
          id=4 @10.178.0.69 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0)

          [ndb_mgmd(MGM)]     2 node(s)
          id=1 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8)
          id=2 @10.177.67.255 (mysql-5.5.27 ndb-7.2.8)

          [mysqld(API)] 27 node(s)
          id=5 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8)
          id=6 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8)
          id=7 @10.176.131.165 (mysql-5.5.27 ndb-7.2.8)
          id=8 @10.176.131.165 (mysql-5.5.27 ndb-7.2.8)
          id=9 (not connected, accepting connect from any host)
          id=10 (not connected, accepting connect from any host)
Copyright 2011 Severalnines AB




Installation

  But wait! We need to install the ndb_memcached
   schema!
       Only needed the first time
       Table are stored in NDB

  Defined in the file:
       <basedir>/share/memcache-api/
        ndb_memcache_metadata.sql

  mysql –uroot –p < <basedir>/share/memcache-api/
   ndb_memcache_metadata.sql
Copyright 2011 Severalnines AB




Exercise 1

  Install the schema
       /usr/local/mysql/share/memcache-api/
        ndb_memcache_metadata.sql

  Start memcached
         The management server is listening on 127.0.0.1
         Use port 11211
         Use bind address 127.0.0.1
         Don’t use the daemon option
         Basedir = /usr/local/mysql/

  Verify using the management client:
       ndb_mgm –e “show”
Copyright 2011 Severalnines AB




Troubleshooting

  Common errors :
       bind(): Cannot assign requested address
          Wrong bind address
       Hanging on “Contacting primary management server (..) ...”
            Wrong ndb-connectstring

  Success:
       done [0.759 sec
Copyright 2011 Severalnines AB




Configuration

  One of the key benefits with Memcached is that it can
   be used in multiple ways:
       Store data in NDB only
       Store data in NDB and cache in Memcached
       Cache only on Memcached


  An existing data model can also be presented to
   Memcached
       This requires a bit of setup to create mappings for the tables
        being exposed to Memcached
       Let’s do it now!
Copyright 2011 Severalnines AB




 Configuration

   Consider the following table. Goals:
        Expose it to memcached
        Read/write to it
        Make two configuration – NDB Only and NDB + Caching

create table users(
   uid integer auto_increment primary key,
   name varchar(255),
   email varchar(255),
   view_cnt bigint unsigned default 0,
   created bigint unsigned default 0,
   json_data varbinary(12000)
 ) engine = ndb;
Copyright 2011 Severalnines AB




Concepts

  Memcached uses two important concepts
       CONTAINERS (table ndbmemcache.containers)
       KEY_PREFIXES (table ndbmemcache.key_prefixes)

  CONTAINERS
       Specifies what tables, columns in the tables, keys etc

  KEY_PREFIXES
       Specifies key bindings, and roles (if data should be in ndb
        only e.g).



                                                                      48
Copyright 2011 Severalnines AB




Containers Table

  DESC containers;
       name                     - container name (PK)
       db_schema                - database where db_table is stored
       db_table                 - name of the database table
       key_columns              - the columns mapping to the memcached key
       value_columns            - the columns that map to the
       flags                    - not implemented
       increment_column         - for INCR / DECR - BIGINT UNSIGNED
       cas_column               - CAS , must be BIGINT UNSIGNED
       expire_time_column       - not implemented
       large_values_table



                                                                              49
Copyright 2011 Severalnines AB




      Cointainer for Users

      name                = users_container     create table users(
                                                      uid integer auto_increment primary key,
      db_schema           = test                     name varchar(255),
      db_table            = users                    email varchar(255),
                                                      view_cnt bigint unsigned default 0,
      key_columns = uid                              created bigint unsigned default 0
                                                  ) engine = ndb;
      value_columns =
       name,email,created,view_cnt, json_data
      flags                 =0
      increment_column = NULL
      cas_column           = NULL
      expire_time_column = NULL
      large_values_table = NULL
INSERT INTO containers(name,db_schema, db_table, key_columns, value_columns, flags,
increment_column,cas_column,expire_time_column,large_values_table) values
('users_container','test','users', 'uid','name,email,created,view_cnt,json_data', 0 ,
NULL , NULL, NULL, NULL);

                                                                                           50
Copyright 2011 Severalnines AB




Key_prefixes Table

  DESC key_prefixes;
       server_role_id           - id referencing memcache_server_roles table
       key_prefix               - memcache search key prefix (e.g ‘myid:’)
       cluster_id               - id referencing ndb_clusters table
       policy                   - referencing cache_policies table
       container                - name referencing containers.name

     We will now explore the referenced tables and see what they contain.




                                                                                51
Copyright 2011 Severalnines AB




Key_prefixes for Users

  server_role_id = 1 /*db-only*/ /*Must match how memcached is
   started*/

  key_prefix = ‘user:’

  cluster_id = 0

  policy = ‘ndb-only’

  container = ‘users_container’

insert into key_prefixes(server_role_id, key_prefix, cluster_id,
policy, container) values (1, 'user:' , 0 , 'ndb-only' ,
'users_container' );


                                                                   52
Copyright 2011 Severalnines AB




Exercise 2

    Create the ’Users’ table in database ’test’

    Create the Container (use ndbmemcache)

    Create the Key_prefix

    Stop memcached , some options:
         killlall -15 memcached
         ctrl-c
         killall -9 memcached

    Start memcached
     /usr/local//mysql/bin//memcached 
         -p11211                      
         -E /usr/local//mysql/lib//ndb_engine.so -unobody 
         -e “connectstring='127.0.0.1';role=db-only “

What happens?
Copyright 2011 Severalnines AB




Troubleshooting

  Common errors :
       Specified a column that does not exist:
          ‘Invalid column "test.users.view_cnt” ‘  seg fault
       The same column has been specified twice in the Container:
          createRecord() failure: Duplicate column specification in
           NdbDictionary::RecordSpecification
       Mismatch between container.name and key_prefixes.container:
          "users_containerxx" NOT FOUND in database.

  Fixing the problem:
       DELETE FROM key_prefixes …;
       DELETE FROM containers … ;
Copyright 2011 Severalnines AB




Exercise 3

  Insert a record into the users table:

  mysql –uroot –ppassword
    insert into users(name,email, view_cnt,created, json_data) values
     ('johan', 'johan@severalnines.com', 0, unix_timestamp(now()),
     "{messages: ['msg1', 'msg2']}");


  telnet localhost 11211
       GET user:1
       INCR user:1 1
       GET user:1

  Do you get what you expect?
Copyright 2011 Severalnines AB




        view_cnt
Container:                                          Key_prefixes:
    name              = users_view_cnt_container       server_role_id =
    db_schema         = test                           key_prefix = ‘user:’
    db_table          = users                          cluster_id = 0
    key_columns = uid
                                                        policy = ‘ndb-only’
    value_columns = NULL
                                                        container = ‘users_view_cnt_container’
    flags               =0
    increment_column = view_cnt
    cas_column       = NULL
    expire_time_column = NULL
    large_values_table = NULL


INSERT INTO containers(name,db_schema, db_table, key_columns, value_columns, flags,
increment_column,cas_column,expire_time_column,large_values_table) VALUES
('users_view_cnt_container','test','users', 'uid',NULL, 0 , 'view_cnt' , NULL, NULL,
NULL);

INSERT INTO key_prefixes(server_role_id, key_prefix, cluster_id, policy, container) VALUES
(1, 'user_view_cnt:' , 0 , 'ndb-only' , 'users_view_cnt_container');


                                                                                                  56
Copyright 2011 Severalnines AB




        view_cnt

INSERT INTO containers(name,db_schema, db_table, key_columns, value_columns,
flags, increment_column,cas_column,expire_time_column,large_values_table)
VALUES('users_view_cnt_container','test','users', 'uid',NULL, 0 ,
'view_cnt' , NULL, NULL, NULL);



INSERT INTO key_prefixes(server_role_id, key_prefix, cluster_id, policy,
container) VALUES(1, 'user_view_cnt:' , 0 , 'ndb-only' ,
'users_view_cnt_container');




                                                                               57
Copyright 2011 Severalnines AB




Exercise 4

  Create the Container and Key_prefix for the view_cnt.

  telnet localhost 11211
       GET user:1
       INCR user_view_cnt:1 1
       INCR user_view_cnt:1 1000
       DECR user_view_cnt:1 100
       GET user:1

  Do you get what you expect?
Copyright 2011 Severalnines AB




Recap

  One Container must be setup for each operation you
   want to do:
       Write/Read whole record
       INCR/DECR
       CAS
       Etc.

  One Key_prefix must be setup for each Container.
                                 1   1
Copyright 2011 Severalnines AB




Accessing the Data

  There are many client interfaces to memcached:
       libmemcached (c/c++)
       PECL/memcached (php)
       PHP/libmemcached (php)
       Spymemcached (java)
       Python-memcached (python)
       Cache::Memcached::Fast (perl)
       Telnet




                                                    60
Copyright 2011 Severalnines AB




TELNET

       Telnet can be used to access data stored in memcached:
       telnet localhost 11211
     get user 1




                                                                 61
Copyright 2011 Severalnines AB




Caching Policies

  Read-only/read-mostly data can be cached in the
   Memcached server

     CLIENT




                                       P0            P1
                                       S1            S0


                                                          62
Copyright 2011 Severalnines AB




Caching Policies –
Setup

  A new Key_prefix must be created:
       server_role_id = 3 /*caching*/ /*Must match how
        memcached is started*/
       key_prefix = ‘user_cache:’
       cluster_id = 0
       policy = ‘caching’
       container = ‘users_container’

insert into key_prefixes(server_role_id, key_prefix,
cluster_id, policy, container) values (3,
'user_cache:' , 0 , 'caching' , 'users_container' );
Copyright 2011 Severalnines AB




Caching Policies

  GET
       Read data from Cache if exists in Cache
       Read data from NDB if not exists in Cache  populate
        cache

  STORE
       Write data to Cache AND to NDB
       Overwrites existing data in cache
Copyright 2011 Severalnines AB




Performance Tuning

  Tunables are few
       NDB Cluster connections can be set 0-4 (0 means it will “figure it
        out”)
       Send timeout , 1-10 (ms), default 1 (ms)
       Force send On or Off (1 or 0), default Off

  Set with scheduler options:
       memcached -e “…;S:c1,t1,f1”
       This would set:
          Ndb_cluster_connections=1
          Send timeout=1 (ms)
          Force send = ON (1)


                                                                             65
Copyright 2011 Severalnines AB




Shoot out

  Host A and B: data node (ndbmtd)

  Host C: MySQL Server or Memcached

  Host C: Application

  Users table with 10000 records

  Get User based on UID. Queries:
       SELECT name,email,created,view_cnt,json_data FROM
        users WHERE uid=<random int 1-10000>
       GET user:<random int 1-10000>

                                                            66
Copyright 2011 Severalnines AB




    Shoot out

Access Method                        4 threads   8 thread/   16 threads
                                     4NDB        8NDB        8NDB
SQL (python)**                       1616        1376 ??     -
SQL ( C )                            3808        5712        9312
MEMCACHE (python)                    3076        5516*       6944*
MEMCACHE (C++)                       3300        7096*       14632*
NDBAPI (C++, sync)                   5500        10425       15500

  *) Max 4 ndb_cluster_connections is possible from MEMCACHED
  **) Connector/Python was used
  Averages measured over three runs.
  For all C/C++ tests bencher was used to drive load.
  Threading in Python doesn’t seem to be great.
                                                                          67
Copyright 2011 Severalnines AB




Recommendation

  Tuning the Memcached scheduler options make a difference:
       Scheduler: starting for 1 cluster; c4,f0,g1,t1
          10500 reads/sec
       Scheduler: starting for 1 cluster; c4,f1,g1,t1
          14632 reads/sec
       Scheduler: starting for 1 cluster; c2,f1,g1,t1
          11000 reads/sec

  Set:
       Scheduler option: f1 (force send = on)
       Scheduler option: c4 (4 ndb cluster connections
       Memcached option: -t <no workers> set depending on the number of
        clients you need.
       If you have many workers, >= 128 try force send = off.


                                                                           68
Copyright 2011 Severalnines AB




THANK YOU!

  Twitter : @severalnines

  Facebook: www.facebook.com/severalnines

  Slideshare : www.slideshare.net/severalnines

  Linked-in: www.linkedin.com/company/severalnines

  Web site: www.severalnines.com

  Mail: johan@severalnines.com



                                                      69

More Related Content

What's hot

Oracle my sql cluster cge
Oracle my sql cluster cgeOracle my sql cluster cge
Oracle my sql cluster cge
seungdon1
 
From Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise EditionFrom Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise Edition
郁萍 王
 

What's hot (20)

Severalnines Self-Training: MySQL® Cluster - Part II
Severalnines Self-Training: MySQL® Cluster - Part IISeveralnines Self-Training: MySQL® Cluster - Part II
Severalnines Self-Training: MySQL® Cluster - Part II
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance Tuning
 
Severalnines Self-Training: MySQL® Cluster - Part VIII
Severalnines Self-Training: MySQL® Cluster - Part VIIISeveralnines Self-Training: MySQL® Cluster - Part VIII
Severalnines Self-Training: MySQL® Cluster - Part VIII
 
Severalnines Self-Training: MySQL® Cluster - Part V
Severalnines Self-Training: MySQL® Cluster - Part VSeveralnines Self-Training: MySQL® Cluster - Part V
Severalnines Self-Training: MySQL® Cluster - Part V
 
Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)
 
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
 
Severalnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IX
 
Microsoft SQL Server Distributing Data with R2 Bertucci
Microsoft SQL Server Distributing Data with R2 BertucciMicrosoft SQL Server Distributing Data with R2 Bertucci
Microsoft SQL Server Distributing Data with R2 Bertucci
 
MySQL Cluster
MySQL ClusterMySQL Cluster
MySQL Cluster
 
Choosing a Next Gen Database: the New World Order of NoSQL, NewSQL, and MySQL
Choosing a Next Gen Database: the New World Order of NoSQL, NewSQL, and MySQLChoosing a Next Gen Database: the New World Order of NoSQL, NewSQL, and MySQL
Choosing a Next Gen Database: the New World Order of NoSQL, NewSQL, and MySQL
 
MariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineMariaDB: Connect Storage Engine
MariaDB: Connect Storage Engine
 
MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0
 
Oracle my sql cluster cge
Oracle my sql cluster cgeOracle my sql cluster cge
Oracle my sql cluster cge
 
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document StoreConnector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
KoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#9_London_FromPlanToBackupToCloud
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQL
 
From Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise EditionFrom Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise Edition
 
MySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & DemoMySQL InnoDB Cluster HA Overview & Demo
MySQL InnoDB Cluster HA Overview & Demo
 
MySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL ClusterMySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL Cluster
 

Viewers also liked

Viewers also liked (9)

Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
 
Implementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedImplementing High Availability Caching with Memcached
Implementing High Availability Caching with Memcached
 
Severalnines Training: MySQL Cluster - Part X
Severalnines Training: MySQL Cluster - Part XSeveralnines Training: MySQL Cluster - Part X
Severalnines Training: MySQL Cluster - Part X
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
Transactd ~高速・高機能なNoSQLプラグイン for MySQL/MariaDB~
Transactd ~高速・高機能なNoSQLプラグイン for MySQL/MariaDB~Transactd ~高速・高機能なNoSQLプラグイン for MySQL/MariaDB~
Transactd ~高速・高機能なNoSQLプラグイン for MySQL/MariaDB~
 
DIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterDIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL Cluster
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
Webinar: Data Streaming with Apache Kafka & MongoDB
Webinar: Data Streaming with Apache Kafka & MongoDBWebinar: Data Streaming with Apache Kafka & MongoDB
Webinar: Data Streaming with Apache Kafka & MongoDB
 
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
 

Similar to Conference tutorial: MySQL Cluster as NoSQL

REDIculouS: Introduction to Redis
REDIculouS: Introduction to RedisREDIculouS: Introduction to Redis
REDIculouS: Introduction to Redis
pootsbook
 

Similar to Conference tutorial: MySQL Cluster as NoSQL (20)

Minnebar 2013 - Scaling with Cassandra
Minnebar 2013 - Scaling with CassandraMinnebar 2013 - Scaling with Cassandra
Minnebar 2013 - Scaling with Cassandra
 
Sql no sql
Sql no sqlSql no sql
Sql no sql
 
Jan Steemann: Modelling data in a schema free world (Talk held at Froscon, 2...
Jan Steemann: Modelling data in a schema free world  (Talk held at Froscon, 2...Jan Steemann: Modelling data in a schema free world  (Talk held at Froscon, 2...
Jan Steemann: Modelling data in a schema free world (Talk held at Froscon, 2...
 
NoSQL Database
NoSQL DatabaseNoSQL Database
NoSQL Database
 
By Popular Demand: The Rise of Elastic SQL
By Popular Demand: The Rise of Elastic SQLBy Popular Demand: The Rise of Elastic SQL
By Popular Demand: The Rise of Elastic SQL
 
Azure Cosmos DB
Azure Cosmos DBAzure Cosmos DB
Azure Cosmos DB
 
REDIculouS: Introduction to Redis
REDIculouS: Introduction to RedisREDIculouS: Introduction to Redis
REDIculouS: Introduction to Redis
 
Introduction to nosql
Introduction to nosqlIntroduction to nosql
Introduction to nosql
 
Cloud Database Migration Made Easy: Migrating MySQL to NuoDB
Cloud Database Migration Made Easy: Migrating MySQL to NuoDBCloud Database Migration Made Easy: Migrating MySQL to NuoDB
Cloud Database Migration Made Easy: Migrating MySQL to NuoDB
 
SQL or NoSQL, is this the question? - George Grammatikos
SQL or NoSQL, is this the question? - George GrammatikosSQL or NoSQL, is this the question? - George Grammatikos
SQL or NoSQL, is this the question? - George Grammatikos
 
How to Evaluate an Elastic SQL Database
How to Evaluate an Elastic SQL DatabaseHow to Evaluate an Elastic SQL Database
How to Evaluate an Elastic SQL Database
 
Why nosql?
Why nosql?Why nosql?
Why nosql?
 
Nosql Introduction
Nosql IntroductionNosql Introduction
Nosql Introduction
 
MinneBar 2013 - Scaling with Cassandra
MinneBar 2013 - Scaling with CassandraMinneBar 2013 - Scaling with Cassandra
MinneBar 2013 - Scaling with Cassandra
 
How big data moved the needle from monolithic SQL RDBMS to distributed NoSQL
How big data moved the needle from monolithic SQL RDBMS to distributed NoSQLHow big data moved the needle from monolithic SQL RDBMS to distributed NoSQL
How big data moved the needle from monolithic SQL RDBMS to distributed NoSQL
 
RDBMS vs NoSQL
RDBMS vs NoSQLRDBMS vs NoSQL
RDBMS vs NoSQL
 
Large Scale Cassandra Made Better in Containers - Chris Duchesne and Aaron Sp...
Large Scale Cassandra Made Better in Containers - Chris Duchesne and Aaron Sp...Large Scale Cassandra Made Better in Containers - Chris Duchesne and Aaron Sp...
Large Scale Cassandra Made Better in Containers - Chris Duchesne and Aaron Sp...
 
No sql
No sqlNo sql
No sql
 
Introduction to NuoDB - March 2018
Introduction to NuoDB - March 2018Introduction to NuoDB - March 2018
Introduction to NuoDB - March 2018
 
Day2
Day2Day2
Day2
 

More from Severalnines

Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
Severalnines
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Severalnines
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Severalnines
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Severalnines
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Severalnines
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Severalnines
 
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBWebinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Severalnines
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
Severalnines
 
Webinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilityWebinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High Availability
Severalnines
 

More from Severalnines (20)

Cloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaSCloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaS
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
Working with the Moodle Database: The Basics
Working with the Moodle Database: The BasicsWorking with the Moodle Database: The Basics
Working with the Moodle Database: The Basics
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
 
Disaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBDisaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDB
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDB
 
Advanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerAdvanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona Server
 
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifePolyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
 
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBWebinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
 
Webinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilityWebinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High Availability
 

Recently uploaded

“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
Overkill Security
 

Recently uploaded (20)

UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 

Conference tutorial: MySQL Cluster as NoSQL

  • 1. MySQL Cluster and NoSQL December 2012 Johan Andersson Severalnines AB johan@severalnines.com Cell +46 73 073 60 99
  • 2. Copyright 2011 Severalnines AB Topics   RDBMS/NoSQL   API Overview   Memcached Installation   Configuration   Performance Tuning   Troubleshooting   Use Cases 2
  • 3. Copyright 2012 Severalnines AB RDBMS vs NoSQL RDBMS NoSQL   Structure and relations are   Structure and relations not as important important   Relational schema   Focus on storing/retrieving   Complex Queries   Simple access   JOINs   E.g. Key Value: get(), set()   ACID   Eventual Consistency   Scalability usually not built-in   Scalability built-in   Durability of data on one   Durability of data guaranteed by node having data on multiple nodes 3
  • 4. Copyright 2012 Severalnines AB RDBMS vs NoSQL RDBMS NoSQL   Structure and relations are   Structure and relations not as important important   Relational schema   Focus on storing/retrieving   Complex Queries   Simple access   JOINs   E.g. Key Value: get(), set()   ACID   Eventual Consistency   Scalability usually not built-in   Scalability built-in   Durability of data on one   Durability of data guaranteed by node having data on multiple nodes 4
  • 5. Copyright 2012 Severalnines AB RDBMS vs NoSQL RDBMS NoSQL   Structure and relations are   Structure and relations not as important important   Relational schema   Focus on storing/retrieving   Complex Queries   Simple access   JOINs   E.g. Key Value: get(), set()   ACID   Eventual Consistency   Scalability usually not built-in   Scalability built-in   Durability of data on one   Durability of data guaranteed by node having data on multiple nodes 5
  • 6. Copyright 2012 Severalnines AB RDBMS vs NoSQL RDBMS NoSQL   Structure and relations are   Structure and relations not as important important   Relational schema   Focus on storing/retrieving   Complex Queries   Simple access   JOINs   E.g. Key Value: get(), set()   ACID   Eventual Consistency   Scalability usually not built-in   Scalability built-in   Durability of data on one   Durability of data guaranteed by node having data on multiple nodes 6
  • 7. Copyright 2012 Severalnines AB RDBMS vs NoSQL RDBMS NoSQL   Structure and relations are   Structure and relations not as important important   Relational schema   Focus on storing/retrieving   Complex Queries   Simple access   JOINs   E.g. Key Value: get(), set()   ACID   Eventual Consistency   Scalability usually not built-in   Scalability built-in   Durability of data on one   Durability of data guaranteed by node having data on multiple nodes 7
  • 8. Copyright 2012 Severalnines AB RDBMS vs NoSQL RDBMS NoSQL   Structure and relations are   Structure and relations not as important important   Relational schema   Focus on storing/retrieving   Complex Queries   Simple access   JOINs   E.g. Key Value: get(), set()   ACID   Eventual Consistency   Scalability usually not built-in   Scalability built-in   Durability of data on one   Durability of data guaranteed by node having data on multiple nodes 8
  • 9. Copyright 2012 Severalnines AB Introducing MySQL Cluster   Shared Nothing database   Up to 255 nodes in a cluster   Automatic sharding   In-memory or hybrid disk data storage   Multiple APIs   Availability   Strong consistency with synchronous replication   Automatic fail-over within a cluster   Eventual consistency between clusters 9
  • 10. Copyright 2012 Severalnines AB Architecture 10
  • 11. Copyright 2012 Severalnines AB #1 – Horizontal scalability   Data Nodes   Stores the data   Memory or disk tables   Can be added online Shard 1 Shard 2 Shard 3 11
  • 12. Copyright 2012 Severalnines AB #2 – API  Not Only SQL Data 12
  • 13. Copyright 2012 Severalnines AB #2 – API  Not Only SQL 13
  • 14. Copyright 2012 Severalnines AB #2 – API  Not Only SQL 14
  • 15. Copyright 2012 Severalnines AB #2 – API  Not Only SQL 15
  • 16. Copyright 2012 Severalnines AB #2 – API  Not Only SQL 16
  • 17. Copyright 2012 Severalnines AB #2 – API  Not Only SQL 17
  • 18. Copyright 2012 Severalnines AB #2 – API  Not Only SQL 18
  • 19. Copyright 2012 Severalnines AB #3 – Schema   SQL/Relational   Add column   Add/remove index   Memcached prefix key value   Key-value <city: ldn 1> Prefix Table Key-col Val-col policy city … code … … city: AreaCode city code cluster ldn … 1 … … Configuration/Mapping Table: ‘AreaCode’ 19
  • 20. Copyright 2012 Severalnines AB #4 – Data Consistency   Strong consistency within a cluster   Eventual consistency across clusters EU Cluster US Cluster 20
  • 21. Copyright 2012 Severalnines AB #5 – Data Storage   Memory Tables   No disk checkpoints   Memory Tables   With disk checkpoints   Disk Data tables   Index in memory   Writes not IO bound   Transaction durability = data written in at least 2 nodes 21
  • 22. SQL Access   Parsing/Optimizing/Executing Query Takes time   Query plan converted to NDBAPI calls   Introduces an extra network hop often: APP MYSQLD NDB
  • 23. NoSQL : Memcached (new in 7.2)   Native Key-Value access (converts memcached proto to ndbapi calls)   Bypasses SQL   Schema and schemaless data storage MEMCACHED APP NDB   By default server -  Every KV written to the same table -  Each KV in a single row   Or configure to use existing tables
  • 24. NoSQL : REST   Bypasses SQL   Native HTTP/REST access   Loads in an Apache module (mod_ndb) Apache NDB
  • 25. NoSQL : Cluster/J   Bypasses SQL   Native Java and JPA access AppServer NDB EJB
  • 26. NoSQL: NDBAPI (sync)   C++ API supporting GET/SET/RANGE_SCAN/SCAN   Bypasses SQL NDBAPI   Ultra low latency NDB client   Hand-optimize execution path   Lots of freedom (also to make mistakes)
  • 27. NoSQL : NDBAPI (sync)   DEFINE AND STORAGE BUFFERS (NDB RECORD)   START TRANSACTION   CREATE OPERATION ( on table) -  DEFINE OPERATION (insert/update/read/delete) – PK operation -  GET/SET PK AND VALUES -  <repeat these for batching or read from many tables>   EXECUTE ( COMMIT / NO COMMIT)   CHECK STORAGE BUFFERS
  • 28. NoSQL : NDBAPI (async)   Bypasses SQL   Similar to node.js with callbacks registered and executed on completion   Ultra fast performance for GET/SET on PK NDBAPI   Hand-optimize execution path NDB client   Lots of freedom (also to make mistakes)   Scales with number of threads and number of Apps
  • 29. NoSQL : NDBAPI (async)   DEFINE AND STORAGE BUFFERS (NDB RECORD) PREPARE TRANSACTION -  ASSIGN A CALLBACK -  CREATE OPERATION ( on table) -  DEFINE OPERATION (insert/update/read/delete) – PK operation -  GET/SET PK AND VALUES -  <repeat these for batching or read from many tables>   <repeat and PREPARE up to 1024 TXs>   SEND to NDB   POLL for CALLBACKs -  Executes callbacks, and PREPARE a new TX if you want. -  CHECK STORAGE BUFFERS
  • 30. NoSQL : NDBAPI (async)   Using the Async NDBAPI Oracle managed to get 1.05 Billion Queries Per Minute -  flexAsync -a 25 -p 128 -t <cores> -l <iterations> -  8 data nodes (48GB of RAM) -  10 api nodes -  Intel X5670 (2 CPU x 6 cores) -  Infiniband (IPoIB)
  • 31. Copyright 2011 Severalnines AB Introduction   Memcached access to NDB is included in MySQL Cluster 7.2   Provides a Memcached Interface to NDB data   Using get/set to read and write data   Avoid SQL altogether (except for creating tables)   There several “run-time” models that can be configured   Affects mainly placement of data 31
  • 32. Copyright 2011 Severalnines AB Introduction   Memcached uses the NDBAPI (C++ direct API) to access data in NDB.   There are two flavors of the NDBAPI   Synchronous NDBAPI   Asynchronous NDBAPI   Memcached uses the Asynchronous NDBAPI 32
  • 33. Copyright 2011 Severalnines AB Introduction “S” SCHEDULER Worker threads ndb ndb Ndb_cluster_connection 33
  • 34. Copyright 2011 Severalnines AB Introduction Synchronous Asynchronous   Start transaction   Start transaction   Associate callback   Create op   Create op logic   Set op type   Set op type   Bind keys/values   Bind keys/values   Prepare transaction ndb   Execute   Send   Send request to NDB   Send request to NDB   Check result   Poll   Check callbacks 34
  • 35. Copyright 2011 Severalnines AB Introduction   Asynchronous invocation gives   Higher degree of parallelism, up to 1024 transactions in flight from each NDB object   Less threads needed to drive load   Both threads and transaction parallelism in one shot!   Harder programming model   Synchronous invocation gives   Easy programming model   One thread does one transaction at a time, less parallelism   Many threads needed to drive high load 35
  • 36. Copyright 2011 Severalnines AB Introduction   Memcached supported operations   GET / MULTI GET   SET   ADD   REPLACE   CAS   INCR   DECR 36
  • 37. Copyright 2011 Severalnines AB Installation   The memcached server is included in the MySQL Cluster distributions   <basedir>/bin/memcached   Memcached also requires a plugin that is also included in the distribution   <basedir>/lib/ndb_engine.so or /usr/lib64/ndb_engine.so   It requires a connect string to be able to join the NDB Cluster   + “normal” memcached options   port, bind-address etc 37
  • 38. Copyright 2011 Severalnines AB Installation   Starting Memcached can be done as follows: memcached -p11211 -E <basedir>/lib/ndb_engine.so -u nobody -d -l 127.0.0.1 -e connectstring=127.0.0.1:1186   Options: -l -- bind-address -u -- user -d -- daemon -e -- connectstring and more NDB options -E -- specifies a memcached plugin 38
  • 39. Copyright 2011 Severalnines AB Installation memcached server   Before we can start memcached we must sanity check NDB Cluster   memcached will by default make two connections to the Data Nodes.   This is same as   --ndb-cluster-connection- pool=2 P0 P1 S1 S0 39
  • 40. Copyright 2011 Severalnines AB Installation   Use ndb_mgm to check for free slots ndb_mgm> show Connected to Management Server at: localhost:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=3 @10.176.129.89 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0, Master) id=4 @10.178.0.69 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0) [ndb_mgmd(MGM)] 2 node(s) id=1 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8) id=2 @10.177.67.255 (mysql-5.5.27 ndb-7.2.8) [mysqld(API)] 27 node(s) id=5 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8) id=6 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8) id=7 @10.176.131.165 (mysql-5.5.27 ndb-7.2.8) id=8 @10.176.131.165 (mysql-5.5.27 ndb-7.2.8)
  • 41. Copyright 2011 Severalnines AB Installation   In the previous example you must add atleast two “slots”   Change config.ini and add [mysqld] [mysqld]   Perform a rolling restart   Stop and start the management servers one at a time   Stop and start one data node at a time   Stop and start the mysql servers one at a time
  • 42. Copyright 2011 Severalnines AB Installation   Now we can connect! ndb_mgm> show Connected to Management Server at: localhost:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=3 @10.176.129.89 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0, Master) id=4 @10.178.0.69 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0) [ndb_mgmd(MGM)] 2 node(s) id=1 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8) id=2 @10.177.67.255 (mysql-5.5.27 ndb-7.2.8) [mysqld(API)] 27 node(s) id=5 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8) id=6 @10.176.131.164 (mysql-5.5.27 ndb-7.2.8) id=7 @10.176.131.165 (mysql-5.5.27 ndb-7.2.8) id=8 @10.176.131.165 (mysql-5.5.27 ndb-7.2.8) id=9 (not connected, accepting connect from any host) id=10 (not connected, accepting connect from any host)
  • 43. Copyright 2011 Severalnines AB Installation   But wait! We need to install the ndb_memcached schema!   Only needed the first time   Table are stored in NDB   Defined in the file:   <basedir>/share/memcache-api/ ndb_memcache_metadata.sql   mysql –uroot –p < <basedir>/share/memcache-api/ ndb_memcache_metadata.sql
  • 44. Copyright 2011 Severalnines AB Exercise 1   Install the schema   /usr/local/mysql/share/memcache-api/ ndb_memcache_metadata.sql   Start memcached   The management server is listening on 127.0.0.1   Use port 11211   Use bind address 127.0.0.1   Don’t use the daemon option   Basedir = /usr/local/mysql/   Verify using the management client:   ndb_mgm –e “show”
  • 45. Copyright 2011 Severalnines AB Troubleshooting   Common errors :   bind(): Cannot assign requested address   Wrong bind address   Hanging on “Contacting primary management server (..) ...”   Wrong ndb-connectstring   Success:   done [0.759 sec
  • 46. Copyright 2011 Severalnines AB Configuration   One of the key benefits with Memcached is that it can be used in multiple ways:   Store data in NDB only   Store data in NDB and cache in Memcached   Cache only on Memcached   An existing data model can also be presented to Memcached   This requires a bit of setup to create mappings for the tables being exposed to Memcached   Let’s do it now!
  • 47. Copyright 2011 Severalnines AB Configuration   Consider the following table. Goals:   Expose it to memcached   Read/write to it   Make two configuration – NDB Only and NDB + Caching create table users( uid integer auto_increment primary key, name varchar(255), email varchar(255), view_cnt bigint unsigned default 0, created bigint unsigned default 0, json_data varbinary(12000) ) engine = ndb;
  • 48. Copyright 2011 Severalnines AB Concepts   Memcached uses two important concepts   CONTAINERS (table ndbmemcache.containers)   KEY_PREFIXES (table ndbmemcache.key_prefixes)   CONTAINERS   Specifies what tables, columns in the tables, keys etc   KEY_PREFIXES   Specifies key bindings, and roles (if data should be in ndb only e.g). 48
  • 49. Copyright 2011 Severalnines AB Containers Table   DESC containers;   name - container name (PK)   db_schema - database where db_table is stored   db_table - name of the database table   key_columns - the columns mapping to the memcached key   value_columns - the columns that map to the   flags - not implemented   increment_column - for INCR / DECR - BIGINT UNSIGNED   cas_column - CAS , must be BIGINT UNSIGNED   expire_time_column - not implemented   large_values_table 49
  • 50. Copyright 2011 Severalnines AB Cointainer for Users   name = users_container create table users( uid integer auto_increment primary key,   db_schema = test name varchar(255),   db_table = users email varchar(255), view_cnt bigint unsigned default 0,   key_columns = uid created bigint unsigned default 0 ) engine = ndb;   value_columns = name,email,created,view_cnt, json_data   flags =0   increment_column = NULL   cas_column = NULL   expire_time_column = NULL   large_values_table = NULL INSERT INTO containers(name,db_schema, db_table, key_columns, value_columns, flags, increment_column,cas_column,expire_time_column,large_values_table) values ('users_container','test','users', 'uid','name,email,created,view_cnt,json_data', 0 , NULL , NULL, NULL, NULL); 50
  • 51. Copyright 2011 Severalnines AB Key_prefixes Table   DESC key_prefixes;   server_role_id - id referencing memcache_server_roles table   key_prefix - memcache search key prefix (e.g ‘myid:’)   cluster_id - id referencing ndb_clusters table   policy - referencing cache_policies table   container - name referencing containers.name We will now explore the referenced tables and see what they contain. 51
  • 52. Copyright 2011 Severalnines AB Key_prefixes for Users   server_role_id = 1 /*db-only*/ /*Must match how memcached is started*/   key_prefix = ‘user:’   cluster_id = 0   policy = ‘ndb-only’   container = ‘users_container’ insert into key_prefixes(server_role_id, key_prefix, cluster_id, policy, container) values (1, 'user:' , 0 , 'ndb-only' , 'users_container' ); 52
  • 53. Copyright 2011 Severalnines AB Exercise 2   Create the ’Users’ table in database ’test’   Create the Container (use ndbmemcache)   Create the Key_prefix   Stop memcached , some options:   killlall -15 memcached   ctrl-c   killall -9 memcached   Start memcached /usr/local//mysql/bin//memcached -p11211 -E /usr/local//mysql/lib//ndb_engine.so -unobody -e “connectstring='127.0.0.1';role=db-only “ What happens?
  • 54. Copyright 2011 Severalnines AB Troubleshooting   Common errors :   Specified a column that does not exist:   ‘Invalid column "test.users.view_cnt” ‘  seg fault   The same column has been specified twice in the Container:   createRecord() failure: Duplicate column specification in NdbDictionary::RecordSpecification   Mismatch between container.name and key_prefixes.container:   "users_containerxx" NOT FOUND in database.   Fixing the problem:   DELETE FROM key_prefixes …;   DELETE FROM containers … ;
  • 55. Copyright 2011 Severalnines AB Exercise 3   Insert a record into the users table:   mysql –uroot –ppassword   insert into users(name,email, view_cnt,created, json_data) values ('johan', 'johan@severalnines.com', 0, unix_timestamp(now()), "{messages: ['msg1', 'msg2']}");   telnet localhost 11211   GET user:1   INCR user:1 1   GET user:1   Do you get what you expect?
  • 56. Copyright 2011 Severalnines AB view_cnt Container: Key_prefixes:   name = users_view_cnt_container   server_role_id =   db_schema = test   key_prefix = ‘user:’   db_table = users   cluster_id = 0   key_columns = uid   policy = ‘ndb-only’   value_columns = NULL   container = ‘users_view_cnt_container’   flags =0   increment_column = view_cnt   cas_column = NULL   expire_time_column = NULL   large_values_table = NULL INSERT INTO containers(name,db_schema, db_table, key_columns, value_columns, flags, increment_column,cas_column,expire_time_column,large_values_table) VALUES ('users_view_cnt_container','test','users', 'uid',NULL, 0 , 'view_cnt' , NULL, NULL, NULL); INSERT INTO key_prefixes(server_role_id, key_prefix, cluster_id, policy, container) VALUES (1, 'user_view_cnt:' , 0 , 'ndb-only' , 'users_view_cnt_container'); 56
  • 57. Copyright 2011 Severalnines AB view_cnt INSERT INTO containers(name,db_schema, db_table, key_columns, value_columns, flags, increment_column,cas_column,expire_time_column,large_values_table) VALUES('users_view_cnt_container','test','users', 'uid',NULL, 0 , 'view_cnt' , NULL, NULL, NULL); INSERT INTO key_prefixes(server_role_id, key_prefix, cluster_id, policy, container) VALUES(1, 'user_view_cnt:' , 0 , 'ndb-only' , 'users_view_cnt_container'); 57
  • 58. Copyright 2011 Severalnines AB Exercise 4   Create the Container and Key_prefix for the view_cnt.   telnet localhost 11211   GET user:1   INCR user_view_cnt:1 1   INCR user_view_cnt:1 1000   DECR user_view_cnt:1 100   GET user:1   Do you get what you expect?
  • 59. Copyright 2011 Severalnines AB Recap   One Container must be setup for each operation you want to do:   Write/Read whole record   INCR/DECR   CAS   Etc.   One Key_prefix must be setup for each Container. 1 1
  • 60. Copyright 2011 Severalnines AB Accessing the Data   There are many client interfaces to memcached:   libmemcached (c/c++)   PECL/memcached (php)   PHP/libmemcached (php)   Spymemcached (java)   Python-memcached (python)   Cache::Memcached::Fast (perl)   Telnet 60
  • 61. Copyright 2011 Severalnines AB TELNET   Telnet can be used to access data stored in memcached:   telnet localhost 11211 get user 1 61
  • 62. Copyright 2011 Severalnines AB Caching Policies   Read-only/read-mostly data can be cached in the Memcached server CLIENT P0 P1 S1 S0 62
  • 63. Copyright 2011 Severalnines AB Caching Policies – Setup   A new Key_prefix must be created:   server_role_id = 3 /*caching*/ /*Must match how memcached is started*/   key_prefix = ‘user_cache:’   cluster_id = 0   policy = ‘caching’   container = ‘users_container’ insert into key_prefixes(server_role_id, key_prefix, cluster_id, policy, container) values (3, 'user_cache:' , 0 , 'caching' , 'users_container' );
  • 64. Copyright 2011 Severalnines AB Caching Policies   GET   Read data from Cache if exists in Cache   Read data from NDB if not exists in Cache  populate cache   STORE   Write data to Cache AND to NDB   Overwrites existing data in cache
  • 65. Copyright 2011 Severalnines AB Performance Tuning   Tunables are few   NDB Cluster connections can be set 0-4 (0 means it will “figure it out”)   Send timeout , 1-10 (ms), default 1 (ms)   Force send On or Off (1 or 0), default Off   Set with scheduler options:   memcached -e “…;S:c1,t1,f1”   This would set:   Ndb_cluster_connections=1   Send timeout=1 (ms)   Force send = ON (1) 65
  • 66. Copyright 2011 Severalnines AB Shoot out   Host A and B: data node (ndbmtd)   Host C: MySQL Server or Memcached   Host C: Application   Users table with 10000 records   Get User based on UID. Queries:   SELECT name,email,created,view_cnt,json_data FROM users WHERE uid=<random int 1-10000>   GET user:<random int 1-10000> 66
  • 67. Copyright 2011 Severalnines AB Shoot out Access Method 4 threads 8 thread/ 16 threads 4NDB 8NDB 8NDB SQL (python)** 1616 1376 ?? - SQL ( C ) 3808 5712 9312 MEMCACHE (python) 3076 5516* 6944* MEMCACHE (C++) 3300 7096* 14632* NDBAPI (C++, sync) 5500 10425 15500 *) Max 4 ndb_cluster_connections is possible from MEMCACHED **) Connector/Python was used Averages measured over three runs. For all C/C++ tests bencher was used to drive load. Threading in Python doesn’t seem to be great. 67
  • 68. Copyright 2011 Severalnines AB Recommendation   Tuning the Memcached scheduler options make a difference:   Scheduler: starting for 1 cluster; c4,f0,g1,t1   10500 reads/sec   Scheduler: starting for 1 cluster; c4,f1,g1,t1   14632 reads/sec   Scheduler: starting for 1 cluster; c2,f1,g1,t1   11000 reads/sec   Set:   Scheduler option: f1 (force send = on)   Scheduler option: c4 (4 ndb cluster connections   Memcached option: -t <no workers> set depending on the number of clients you need.   If you have many workers, >= 128 try force send = off. 68
  • 69. Copyright 2011 Severalnines AB THANK YOU!   Twitter : @severalnines   Facebook: www.facebook.com/severalnines   Slideshare : www.slideshare.net/severalnines   Linked-in: www.linkedin.com/company/severalnines   Web site: www.severalnines.com   Mail: johan@severalnines.com 69