SlideShare a Scribd company logo
1 of 54
Download to read offline
MySQL Cluster: NoSQL Memcached API
•  Meet New Requirements: Add persistence, sharding, fault tolerance
•  Ease-of-Use: Standard Memcached libraries
•  Simplification: Eliminate cache-coherency & consolidate data tiers
•  Flexible Data Model: Schema / Schema-less storage
•  Flexible Access Patterns: SQL and NoSQL
•  Flexible Deployments: values stored in Cluster, Memcached or both
•  Key / Value Performance: Native access to MySQL Cluster




                              Copyright © 2012 Oracle Corp.
Program Agenda

•  Overview, MySQL Cluster                          <Insert Picture Here>

•  Memcached API
   •  Memcache Overview
   •  MySQL Cluster (NDB) & Memcache setup
   •  Sample Application
•  Resources to Get Started




                    Copyright © 2012 Oracle Corp.
MySQL Cluster

 HIGH SCALE,     •  Auto-Sharding, Multi-Master
READS + WRITES   •  ACID Compliant, OLTP + Real-Time Analytics



   99.999%       •  Shared nothing, no Single Point of Failure
 AVAILABILITY    •  Self Healing + On-Line Operations



                 •  High Load, Real Time Performance
  REAL-TIME
                 •  Predictable Low-Latency, Bounded Access Time



                 •  Key/Value + Complex, Relational Queries
 SQL + NoSQL
                 •  SQL + Memcached + Java + JPA + HTTP/REST + C++



                 •  Open Source + Commercial Editions
   LOW TCO
                 •  Commodity hardware + Management, Monitoring Toos




                            Copyright © 2012 Oracle Corp.
MySQL Cluster 7.2
                          70x Faster JOINs


                         8x Higher Per Node
                            Performance
    Fastest Ramp…Ever

                        NoSQL Memcached API


                           Geo-Distributed
                              Clusters
            writes
Memcached API




            Copyright © 2012 Oracle Corp.
Memcached Overview



                                                           memcached
Application
                                                                        hash key
                                   erver                   memcached
                         to pick s                                     to find data
 Memcache
                hash key
   Client

         friends:12389!                                    memcached
        memcache key




                           Copyright © 2012 Oracle Corp.
Memcache Protocol Elements


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




                        Copyright © 2012 Oracle Corp.
Memcache Protocol Commands (1)


•  get key                    Fetch value for this key
•  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




                          Copyright © 2012 Oracle Corp.
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




                       Copyright © 2012 Oracle Corp.
Traditional architecture:
   Memcached & MySQL


Application                       t!
                         ro  ughpu
               hi gher th tency!
                           a
                   lower l                              memcached
 Memcache
   Client


mysql client

                     more sto
                  more po    rage (on                          MySQL
                         werful p      disk)!
                                  rotocol (                    Slave
                                            SQL)!

                        Copyright © 2012 Oracle Corp.
NDB & Memcache Architecture:
  Memcache protocol + NDB storage



                                                MySQL
Application                                     Cluster
                     memcached                 Data Node

 Memcache
   Client            NDB Engine                 MySQL
                                                Cluster
                                               Data Node




               Copyright © 2012 Oracle Corp.
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.




                          Copyright © 2012 Oracle Corp.
Measured Latency                  memcachetest -t 2 -M 7000 -c 25000 !




             Copyright © 2012 Oracle Corp.
Configuration Overview
NDB Memcache




                Copyright © 2012 Oracle Corp.
Anatomy of a Memcache key




                 user:1248

    the prefix                                     the database key




                   Copyright © 2012 Oracle Corp.
A key-prefix mapping




Memcache
                                                       Cache
   key            Cluster                  Container
                                                       Policy
  prefix




               Copyright © 2012 Oracle Corp.
A memcache server role

                        key                               Con-    Cache
                                               Cluster
                       prefix                            tainer   Policy



                        key                               Con-    Cache
                                               Cluster
                       prefix                            tainer   Policy
 Server
  Role
   ID
                        key                               Con-    Cache
                                               Cluster
                       prefix                            tainer   Policy



                        key                               Con-    Cache
                                               Cluster
                       prefix                            tainer   Policy



               Copyright © 2012 Oracle Corp.
Getting Started
MySQL Cluster and Memcached




                     Copyright © 2012 Oracle Corp.
Cluster on a laptop


•  Configuration file            cluster.ini
•  Management server             ndb_mgmd
•  Data node                     ndbd
•  MySQL server                  mysqld
•  Memcached server              memcached

   (All of these are present in MySQL Cluster 7.2 distribution)




                         Copyright © 2012 Oracle Corp.
Cluster Configuration File

A single central file for the whole cluster
Loaded by the management server on --initial
And then stored in cache for future restarts
Sections:
   [MGM]
   [DB DEFAULT]
   [NDBD]
   [API]




                         Copyright © 2012 Oracle Corp.
[MGM] section: Management Server


[MGM]	
NodeId=1	
datadir=/Users/jdd/sandbox/ndb	
hostname=localhost	




                  Copyright © 2012 Oracle Corp.
[DB DEFAULT] Section: data node
parameters

[DB DEFAULT]	
NoOfReplicas=1	
TimeBetweenGlobalCheckpoints=12000	
HeartbeatIntervalDbApi=15000	
DataMemory=180M	
IndexMemory=60M	




                  Copyright © 2012 Oracle Corp.
[NDBD] Sections: individual data node


[NDBD]	
NodeId=2	




              Copyright © 2012 Oracle Corp.
[API] Sections for MySQL &
Memcached servers

[API]	
[API]	
[API]	
[API]	
[API]	
[API]	
[API]	




              Copyright © 2012 Oracle Corp.
Complete cluster.ini file
 [MGM]	
 NodeId=1	
 datadir=/Users/jdd/sandbox/ndb	
 hostname=localhost	
 	
 [DB DEFAULT]	
 NoOfReplicas=1	
 TimeBetweenGlobalCheckpoints=12000	
 HeartbeatIntervalDbApi=15000	
 DataMemory=180M	
 IndexMemory=60M	
 	
 [NDBD]	
 NodeId=2	
 	
 [API]	
 [API]	
   ...	




                      Copyright © 2012 Oracle Corp.
Start the Management Server


% ndb_mgmd -f config-file-path	




              Copyright © 2012 Oracle Corp.
Start the Data Node


% ndbd	




              Copyright © 2012 Oracle Corp.
Configure & start mysqld (my.cnf file)


[mysqld]	
ndbcluster	




              Copyright © 2012 Oracle Corp.
Load NDB Memcache configuration
  tables

% cd /usr/local/mysql/share/memcache-api	
	
% mysql -u root < ndb_memcache_metadata.sql 	




                  Copyright © 2012 Oracle Corp.
Sample Application




                Copyright © 2012 Oracle Corp.
"Twitter-like" Application

•  Two Tables
      •  authors
      •  tweets
•  Three Perl Functions
      •  Create a new author record
      •  Insert a new tweet
      •  Increment an author's tweet count




                          Copyright © 2012 Oracle Corp.
Required Perl Modules


% cpan install Cache::Memcached	
	
% cpan install UUID::Tiny	




                Copyright © 2012 Oracle Corp.
Sample Application


% mysql -u root	
	
mysql> CREATE DATABASE demo;	
       use demo;	




                Copyright © 2012 Oracle Corp.
Data Definition: Authors


CREATE TABLE authors (	
  author varchar(15) not null,	
  date_created timestamp, 	
  tweets bigint unsigned not null default 0,	
  followers bigint unsigned not null default 0,	
  following bigint unsigned not null default 0,	
  PRIMARY KEY (author)	
) ENGINE=ndb;	




                  Copyright © 2012 Oracle Corp.
Data Definition: Tweets


CREATE TABLE tweets ( 	
id varchar(36) primary key,
author varchar(15),
time_stamp timestamp,
tweet varchar(140),     	
index(time_stamp),    	
index(author))ENGINE=ndb;	




                Copyright © 2012 Oracle Corp.
Configuration: Use the ndbmemcache
config schema
mysql> use ndbmemcache;	
       show tables;	




              Copyright © 2012 Oracle Corp.
Configuration: Create container &
    key_prefixes
INSERT into containers 	
SET 	
  name = 'tweets_table' ,	
  db_schema = 'demo' , db_table = 'tweets',	
  key_columns = 'id' ,   	
  value_columns = 'time_stamp,author,tweet';	


INSERT into key_prefixes	
SET 	
  key_prefix = 'tweet:',	
  policy = 'ndb-only',	
  container = 'tweets_table';	

                    Copyright © 2012 Oracle Corp.
Two key_prefixes for authors table

•  newauthor:
  •  ADD an author record and set date_created
•  tweetcount:
  •  INCR tweet count for author




                       Copyright © 2012 Oracle Corp.
Configuration: New Author

INSERT into containers 	
SET 	
  name = 'author_new' ,	
  db_schema = 'demo' , db_table = 'authors',	
 	key_columns = 'author' ,	
  value_columns = 'date_created';	


INSERT into key_prefixes	
SET 	
  key_prefix = 'newauthor:',	
  policy = 'ndb-only',	
  container = 'author_new';	

                   Copyright © 2012 Oracle Corp.
Configuration: Tweet Count

INSERT into containers 	
SET 	
  name = 'author_count',	
  db_schema = 'demo', db_table = 'authors',	
  key_columns = 'author',	
  increment_column = 'tweets';	


INSERT into key_prefixes	
SET 	
  key_prefix = 'tweetcount:',	
  policy = 'ndb-only',	
  container = 'author_count';	

                    Copyright © 2012 Oracle Corp.
Memcached: Start the server

% cd /usr/local/mysql	
% bin/memcached -E lib/ndb_engine.so 	
	


17-Aug-2012 13:53:32 PDT NDB Memcache 5.5.25-ndb-7.2.7 ...	
Contacting primary management server (localhost:1186) ...
Connected to "localhost:1186" as node id 4.Retrieved 6 key
prefixes for server role "default_role".	
Server started with 4 threads.	
Priming the pump ... done [0.661 sec].	




                            Copyright © 2012 Oracle Corp.
Perl: Startup Code

use Cache::Memcached;	
use UUID::Tiny;	
	
our $mc = new Cache::Memcached( {	
  'servers' => [ "localhost:11211" ]	
});	
	




                    Copyright © 2012 Oracle Corp.
Perl: Add a new author


## Takes one parameter: author	
sub new_author {	
   my $author = shift;	
   my $time = time();	
	
   my $key = "newauthor:$author";	
	
   $mc->add($key, $time);	
}	




                        Copyright © 2012 Oracle Corp.
Perl: Insert a Tweet


## Take two parameters: author and tweet	
sub insert_tweet {	
   my $author = shift;	
   my $tweet = shift;	
   my $id = create_UUID_as_string(UUID_V4);	
   my $time = time();	
	
   # Insert the tweet 	
   my $key = "tweet:$id";	
   my $value = "$time" ."t". $author ."t". $tweet;	
   $mc->add($key, $value);	
}	




                           Copyright © 2012 Oracle Corp.
Perl: Increment Tweet Count


## Increment the author's tweet count.	
## Take one parameter: author	
sub increment_tweetcount {	
   my $author = shift;	
 	
   my $key = "tweetcount:$author";	
   $mc->incr($key, 1);	
}	




                        Copyright © 2012 Oracle Corp.
Download MySQL Cluster + Memcached API




http://www.mysql.com/downloads/cluster/#downloads
MySQL Cluster CGE
Most secure, scalable MySQL Database, Development /
Management / Monitoring Tools, backed by Oracle Premier
Lifetime Support


                    Oracle Product        Oracle Premier
              Certifications/Integrations    Support

         MySQL Enterprise                        MySQL Enterprise
             Backup                            Monitor/Query Analyzer


   MySQL Enterprise                                        MySQL Enterprise
      Security                                                Scalability


  MySQL Cluster
                                                             MySQL Workbench
    Manager
Oracle Premier Support for MySQL
     Rely on The Experts - Get Unique Benefits
•    Straight from the Source
•    Largest Team of MySQL Experts
•    Direct Access to MySQL Support Engineers
•    Backed by MySQL Developers                                    Only From
•    Global 24/7/365, 29 languages
•    Forward Compatible Hot Fixes
                                                                    Oracle
•    MySQL Maintenance Releases
•    Unlimited Incidents
•    Knowledge Base
                                         "The MySQL support service has been
•    MySQL Consultative Support          essential in helping us with troubleshooting
                                                  and providing recommendations for the
                                                  production cluster, Thanks."

                                                  -- Carlos Morales – Playfulplay.com
Getting Started
                                                     Learn More
                                    Scaling Web
                                    Databases Guide

                                    www.mysql.com/cluster/




                Get MySQL Cluster 7.2                            Review Documentation
                                                             https://dev.mysql.com/doc/refman/5.5/en/
     Download Today                                          mysql-cluster-ndbmemcache.html
     http://www.mysql.com/
     downloads/cluster/




Copyright 2011 Oracle Corporation                                                                       50
Summary


                                        Scale Web Services with
                                          99.999% Availability



                                    Native Memcached NoSQL Access



                                             Try it out Today!




Copyright 2011 Oracle Corporation                                   51
MySQL Cluster Architecture



                   JPA            REST
                         Application Nodes



          Node Group 1                       Node Group 2

                    F1                                 F2
          Node 1




                                             Node 3
Cluster                                                     Cluster
Mgmt                F3                                 F4   Mgmt


                    F3                                 F4




                                             Node 4
          Node 2




                    F1                                 F2
                             Data Nodes
MySQL Cluster - Extreme Resilience



                   JPA                 REST
                         Application Nodes



          Node Group 1                        Node Group 2

                    F1                                  F2
          Node 1




                                              Node 3
Cluster                                                      Cluster
Mgmt                F3                                  F4   Mgmt


                    F3                                  F4




                                              Node 4
          Node 2




                    F1                                  F2
                             Data Nodes

More Related Content

What's hot

Ari Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture PatternsAri Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture Patternsdeimos
 
Elastic Scalability in MySQL Fabric Using OpenStack
Elastic Scalability in MySQL Fabric Using OpenStackElastic Scalability in MySQL Fabric Using OpenStack
Elastic Scalability in MySQL Fabric Using OpenStackMats Kindahl
 
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 5.6 Updates
MySQL 5.6 UpdatesMySQL 5.6 Updates
MySQL 5.6 UpdatesDave Stokes
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 Geir Høydalsvik
 
Toronto jaspersoft meetup
Toronto jaspersoft meetupToronto jaspersoft meetup
Toronto jaspersoft meetupPatrick McFadin
 
MySQL 5.7 GIS-Norvald H. Ryeng
MySQL 5.7 GIS-Norvald H. RyengMySQL 5.7 GIS-Norvald H. Ryeng
MySQL 5.7 GIS-Norvald H. Ryeng郁萍 王
 
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 MorganMySQL Brasil
 
Paris Cassandra Meetup - Overview of New Cassandra Drivers
Paris Cassandra Meetup - Overview of New Cassandra DriversParis Cassandra Meetup - Overview of New Cassandra Drivers
Paris Cassandra Meetup - Overview of New Cassandra DriversMichaël Figuière
 
Playing in the Same Sandbox: MySQL and Oracle
Playing in the Same Sandbox:  MySQL and OraclePlaying in the Same Sandbox:  MySQL and Oracle
Playing in the Same Sandbox: MySQL and Oraclelynnferrante
 
Thu 1100 duncan_john_color
Thu 1100 duncan_john_colorThu 1100 duncan_john_color
Thu 1100 duncan_john_colorDATAVERSITY
 
SQL Server Workshop Paul Bertucci
SQL Server Workshop Paul BertucciSQL Server Workshop Paul Bertucci
SQL Server Workshop Paul BertucciMark Ginnebaugh
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important VariablesFromDual GmbH
 
Sharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL FabricSharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL FabricMats Kindahl
 
Developing polyglot persistence applications #javaone 2012
Developing polyglot persistence applications  #javaone 2012Developing polyglot persistence applications  #javaone 2012
Developing polyglot persistence applications #javaone 2012Chris Richardson
 
Effective Usage of SQL Server 2005 Database Mirroring
Effective Usage of SQL Server 2005 Database MirroringEffective Usage of SQL Server 2005 Database Mirroring
Effective Usage of SQL Server 2005 Database Mirroringwebhostingguy
 
MySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textMySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textFrazer Clement
 
Building Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL FabricBuilding Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL FabricMats Kindahl
 

What's hot (20)

Ari Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture PatternsAri Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture Patterns
 
Elastic Scalability in MySQL Fabric Using OpenStack
Elastic Scalability in MySQL Fabric Using OpenStackElastic Scalability in MySQL Fabric Using OpenStack
Elastic Scalability in MySQL Fabric Using OpenStack
 
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 5.6 Updates
MySQL 5.6 UpdatesMySQL 5.6 Updates
MySQL 5.6 Updates
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
 
Toronto jaspersoft meetup
Toronto jaspersoft meetupToronto jaspersoft meetup
Toronto jaspersoft meetup
 
MySQL 5.7 GIS-Norvald H. Ryeng
MySQL 5.7 GIS-Norvald H. RyengMySQL 5.7 GIS-Norvald H. Ryeng
MySQL 5.7 GIS-Norvald H. Ryeng
 
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
 
Paris Cassandra Meetup - Overview of New Cassandra Drivers
Paris Cassandra Meetup - Overview of New Cassandra DriversParis Cassandra Meetup - Overview of New Cassandra Drivers
Paris Cassandra Meetup - Overview of New Cassandra Drivers
 
Playing in the Same Sandbox: MySQL and Oracle
Playing in the Same Sandbox:  MySQL and OraclePlaying in the Same Sandbox:  MySQL and Oracle
Playing in the Same Sandbox: MySQL and Oracle
 
SQL Server User Group 02/2009
SQL Server User Group 02/2009SQL Server User Group 02/2009
SQL Server User Group 02/2009
 
Thu 1100 duncan_john_color
Thu 1100 duncan_john_colorThu 1100 duncan_john_color
Thu 1100 duncan_john_color
 
SQL Server Workshop Paul Bertucci
SQL Server Workshop Paul BertucciSQL Server Workshop Paul Bertucci
SQL Server Workshop Paul Bertucci
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important Variables
 
SQL Server High Availability
SQL Server High AvailabilitySQL Server High Availability
SQL Server High Availability
 
Sharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL FabricSharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL Fabric
 
Developing polyglot persistence applications #javaone 2012
Developing polyglot persistence applications  #javaone 2012Developing polyglot persistence applications  #javaone 2012
Developing polyglot persistence applications #javaone 2012
 
Effective Usage of SQL Server 2005 Database Mirroring
Effective Usage of SQL Server 2005 Database MirroringEffective Usage of SQL Server 2005 Database Mirroring
Effective Usage of SQL Server 2005 Database Mirroring
 
MySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial textMySQL Cluster 8.0 tutorial text
MySQL Cluster 8.0 tutorial text
 
Building Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL FabricBuilding Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL Fabric
 

Similar to MySQL Cluster NoSQL Memcached API

Moving from C#/.NET to Hadoop/MongoDB
Moving from C#/.NET to Hadoop/MongoDBMoving from C#/.NET to Hadoop/MongoDB
Moving from C#/.NET to Hadoop/MongoDBMongoDB
 
Membase Meetup Chicago - january 2011
Membase Meetup Chicago - january 2011Membase Meetup Chicago - january 2011
Membase Meetup Chicago - january 2011Membase
 
Oracle my sql cluster cge
Oracle my sql cluster cgeOracle my sql cluster cge
Oracle my sql cluster cgeseungdon1
 
Gear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with MemcachedGear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with MemcachedGear6
 
Redis e Memcached - Daniel Naves - Omnilogic
Redis e Memcached - Daniel Naves - OmnilogicRedis e Memcached - Daniel Naves - Omnilogic
Redis e Memcached - Daniel Naves - OmnilogicFelipe Guimarães
 
Implementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedImplementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedGear6
 
Memcached, presented to LCA2010
Memcached, presented to LCA2010Memcached, presented to LCA2010
Memcached, presented to LCA2010Mark Atwood
 
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
Living with SQL and NoSQL at craigslist, a Pragmatic ApproachLiving with SQL and NoSQL at craigslist, a Pragmatic Approach
Living with SQL and NoSQL at craigslist, a Pragmatic ApproachJeremy Zawodny
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Javasunnygleason
 
High Performance Drupal Sites
High Performance Drupal SitesHigh Performance Drupal Sites
High Performance Drupal SitesAbayomi Ayoola
 
Membase Meetup - Silicon Valley
Membase Meetup - Silicon ValleyMembase Meetup - Silicon Valley
Membase Meetup - Silicon ValleyMembase
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached PresentationAsif Ali
 
Where Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsWhere Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsConcentric Sky
 
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...Olivier DASINI
 
Enhancing scalability with intelligent caching
Enhancing scalability with intelligent cachingEnhancing scalability with intelligent caching
Enhancing scalability with intelligent cachingEric Ritchie
 
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUGEmbracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUGKeith Hollman
 
MySQL cluster 72 in the Cloud
MySQL cluster 72 in the CloudMySQL cluster 72 in the Cloud
MySQL cluster 72 in the CloudMarco Tusa
 

Similar to MySQL Cluster NoSQL Memcached API (20)

Moving from C#/.NET to Hadoop/MongoDB
Moving from C#/.NET to Hadoop/MongoDBMoving from C#/.NET to Hadoop/MongoDB
Moving from C#/.NET to Hadoop/MongoDB
 
NoSQL and MySQL
NoSQL and MySQLNoSQL and MySQL
NoSQL and MySQL
 
Membase Meetup Chicago - january 2011
Membase Meetup Chicago - january 2011Membase Meetup Chicago - january 2011
Membase Meetup Chicago - january 2011
 
Oracle my sql cluster cge
Oracle my sql cluster cgeOracle my sql cluster cge
Oracle my sql cluster cge
 
Gear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with MemcachedGear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with Memcached
 
Redis e Memcached - Daniel Naves - Omnilogic
Redis e Memcached - Daniel Naves - OmnilogicRedis e Memcached - Daniel Naves - Omnilogic
Redis e Memcached - Daniel Naves - Omnilogic
 
Implementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedImplementing High Availability Caching with Memcached
Implementing High Availability Caching with Memcached
 
Memcached, presented to LCA2010
Memcached, presented to LCA2010Memcached, presented to LCA2010
Memcached, presented to LCA2010
 
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
Living with SQL and NoSQL at craigslist, a Pragmatic ApproachLiving with SQL and NoSQL at craigslist, a Pragmatic Approach
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Java
 
High Performance Drupal Sites
High Performance Drupal SitesHigh Performance Drupal Sites
High Performance Drupal Sites
 
Membase Meetup - Silicon Valley
Membase Meetup - Silicon ValleyMembase Meetup - Silicon Valley
Membase Meetup - Silicon Valley
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached Presentation
 
Where Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsWhere Django Caching Bust at the Seams
Where Django Caching Bust at the Seams
 
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
 
cosbench-openstack.pdf
cosbench-openstack.pdfcosbench-openstack.pdf
cosbench-openstack.pdf
 
Enhancing scalability with intelligent caching
Enhancing scalability with intelligent cachingEnhancing scalability with intelligent caching
Enhancing scalability with intelligent caching
 
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUGEmbracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
 
MySQL cluster 72 in the Cloud
MySQL cluster 72 in the CloudMySQL cluster 72 in the Cloud
MySQL cluster 72 in the Cloud
 

More from Mat Keep

Blockchain & the IoT
Blockchain & the IoTBlockchain & the IoT
Blockchain & the IoTMat Keep
 
10-Step Methodology to Building a Single View with MongoDB
10-Step Methodology to Building a Single View with MongoDB10-Step Methodology to Building a Single View with MongoDB
10-Step Methodology to Building a Single View with MongoDBMat Keep
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at BaiduMat Keep
 
MongoDB_Spark
MongoDB_SparkMongoDB_Spark
MongoDB_SparkMat Keep
 
Business of iot_mongodb_spark
Business of iot_mongodb_sparkBusiness of iot_mongodb_spark
Business of iot_mongodb_sparkMat Keep
 
Mongo db 2.6_security_architecture
Mongo db 2.6_security_architectureMongo db 2.6_security_architecture
Mongo db 2.6_security_architectureMat Keep
 
PayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterPayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterMat Keep
 
MySQL HA Solutions
MySQL HA SolutionsMySQL HA Solutions
MySQL HA SolutionsMat Keep
 
MySQL Cluster performance best practices
MySQL Cluster performance best practicesMySQL Cluster performance best practices
MySQL Cluster performance best practicesMat Keep
 

More from Mat Keep (9)

Blockchain & the IoT
Blockchain & the IoTBlockchain & the IoT
Blockchain & the IoT
 
10-Step Methodology to Building a Single View with MongoDB
10-Step Methodology to Building a Single View with MongoDB10-Step Methodology to Building a Single View with MongoDB
10-Step Methodology to Building a Single View with MongoDB
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at Baidu
 
MongoDB_Spark
MongoDB_SparkMongoDB_Spark
MongoDB_Spark
 
Business of iot_mongodb_spark
Business of iot_mongodb_sparkBusiness of iot_mongodb_spark
Business of iot_mongodb_spark
 
Mongo db 2.6_security_architecture
Mongo db 2.6_security_architectureMongo db 2.6_security_architecture
Mongo db 2.6_security_architecture
 
PayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterPayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL Cluster
 
MySQL HA Solutions
MySQL HA SolutionsMySQL HA Solutions
MySQL HA Solutions
 
MySQL Cluster performance best practices
MySQL Cluster performance best practicesMySQL Cluster performance best practices
MySQL Cluster performance best practices
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

MySQL Cluster NoSQL Memcached API

  • 1. MySQL Cluster: NoSQL Memcached API
  • 2. •  Meet New Requirements: Add persistence, sharding, fault tolerance •  Ease-of-Use: Standard Memcached libraries •  Simplification: Eliminate cache-coherency & consolidate data tiers •  Flexible Data Model: Schema / Schema-less storage •  Flexible Access Patterns: SQL and NoSQL •  Flexible Deployments: values stored in Cluster, Memcached or both •  Key / Value Performance: Native access to MySQL Cluster Copyright © 2012 Oracle Corp.
  • 3. Program Agenda •  Overview, MySQL Cluster <Insert Picture Here> •  Memcached API •  Memcache Overview •  MySQL Cluster (NDB) & Memcache setup •  Sample Application •  Resources to Get Started Copyright © 2012 Oracle Corp.
  • 4. MySQL Cluster HIGH SCALE, •  Auto-Sharding, Multi-Master READS + WRITES •  ACID Compliant, OLTP + Real-Time Analytics 99.999% •  Shared nothing, no Single Point of Failure AVAILABILITY •  Self Healing + On-Line Operations •  High Load, Real Time Performance REAL-TIME •  Predictable Low-Latency, Bounded Access Time •  Key/Value + Complex, Relational Queries SQL + NoSQL •  SQL + Memcached + Java + JPA + HTTP/REST + C++ •  Open Source + Commercial Editions LOW TCO •  Commodity hardware + Management, Monitoring Toos Copyright © 2012 Oracle Corp.
  • 5. MySQL Cluster 7.2 70x Faster JOINs 8x Higher Per Node Performance Fastest Ramp…Ever NoSQL Memcached API Geo-Distributed Clusters writes
  • 6. Memcached API Copyright © 2012 Oracle Corp.
  • 7. Memcached Overview memcached Application hash key erver memcached to pick s to find data Memcache hash key Client friends:12389! memcached memcache key Copyright © 2012 Oracle Corp.
  • 8. Memcache Protocol Elements •  Key Up to 250 characters •  Expire Time A number in seconds, up to 30 days •  Flags 32-bit number for application use •  CAS ID 64-bit incrementing version number on value •  Value Value stored for key; traditionally up to 1 MB. Copyright © 2012 Oracle Corp.
  • 9. Memcache Protocol Commands (1) •  get key Fetch value for this key •  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 Copyright © 2012 Oracle Corp.
  • 10. 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 Copyright © 2012 Oracle Corp.
  • 11. Traditional architecture: Memcached & MySQL Application t! ro ughpu hi gher th tency! a lower l memcached Memcache Client mysql client more sto more po rage (on MySQL werful p disk)! rotocol ( Slave SQL)! Copyright © 2012 Oracle Corp.
  • 12. NDB & Memcache Architecture: Memcache protocol + NDB storage MySQL Application Cluster memcached Data Node Memcache Client NDB Engine MySQL Cluster Data Node Copyright © 2012 Oracle Corp.
  • 13. 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. Copyright © 2012 Oracle Corp.
  • 14. Measured Latency memcachetest -t 2 -M 7000 -c 25000 ! Copyright © 2012 Oracle Corp.
  • 15. Configuration Overview NDB Memcache Copyright © 2012 Oracle Corp.
  • 16. Anatomy of a Memcache key user:1248 the prefix the database key Copyright © 2012 Oracle Corp.
  • 17. A key-prefix mapping Memcache Cache key Cluster Container Policy prefix Copyright © 2012 Oracle Corp.
  • 18. A memcache server role key Con- Cache Cluster prefix tainer Policy key Con- Cache Cluster prefix tainer Policy Server Role ID key Con- Cache Cluster prefix tainer Policy key Con- Cache Cluster prefix tainer Policy Copyright © 2012 Oracle Corp.
  • 19. Getting Started MySQL Cluster and Memcached Copyright © 2012 Oracle Corp.
  • 20. Cluster on a laptop •  Configuration file cluster.ini •  Management server ndb_mgmd •  Data node ndbd •  MySQL server mysqld •  Memcached server memcached (All of these are present in MySQL Cluster 7.2 distribution) Copyright © 2012 Oracle Corp.
  • 21. Cluster Configuration File A single central file for the whole cluster Loaded by the management server on --initial And then stored in cache for future restarts Sections: [MGM] [DB DEFAULT] [NDBD] [API] Copyright © 2012 Oracle Corp.
  • 22. [MGM] section: Management Server [MGM] NodeId=1 datadir=/Users/jdd/sandbox/ndb hostname=localhost Copyright © 2012 Oracle Corp.
  • 23. [DB DEFAULT] Section: data node parameters [DB DEFAULT] NoOfReplicas=1 TimeBetweenGlobalCheckpoints=12000 HeartbeatIntervalDbApi=15000 DataMemory=180M IndexMemory=60M Copyright © 2012 Oracle Corp.
  • 24. [NDBD] Sections: individual data node [NDBD] NodeId=2 Copyright © 2012 Oracle Corp.
  • 25. [API] Sections for MySQL & Memcached servers [API] [API] [API] [API] [API] [API] [API] Copyright © 2012 Oracle Corp.
  • 26. Complete cluster.ini file [MGM] NodeId=1 datadir=/Users/jdd/sandbox/ndb hostname=localhost [DB DEFAULT] NoOfReplicas=1 TimeBetweenGlobalCheckpoints=12000 HeartbeatIntervalDbApi=15000 DataMemory=180M IndexMemory=60M [NDBD] NodeId=2 [API] [API] ... Copyright © 2012 Oracle Corp.
  • 27. Start the Management Server % ndb_mgmd -f config-file-path Copyright © 2012 Oracle Corp.
  • 28. Start the Data Node % ndbd Copyright © 2012 Oracle Corp.
  • 29. Configure & start mysqld (my.cnf file) [mysqld] ndbcluster Copyright © 2012 Oracle Corp.
  • 30. Load NDB Memcache configuration tables % cd /usr/local/mysql/share/memcache-api % mysql -u root < ndb_memcache_metadata.sql Copyright © 2012 Oracle Corp.
  • 31. Sample Application Copyright © 2012 Oracle Corp.
  • 32. "Twitter-like" Application •  Two Tables •  authors •  tweets •  Three Perl Functions •  Create a new author record •  Insert a new tweet •  Increment an author's tweet count Copyright © 2012 Oracle Corp.
  • 33. Required Perl Modules % cpan install Cache::Memcached % cpan install UUID::Tiny Copyright © 2012 Oracle Corp.
  • 34. Sample Application % mysql -u root mysql> CREATE DATABASE demo; use demo; Copyright © 2012 Oracle Corp.
  • 35. Data Definition: Authors CREATE TABLE authors ( author varchar(15) not null, date_created timestamp, tweets bigint unsigned not null default 0, followers bigint unsigned not null default 0, following bigint unsigned not null default 0, PRIMARY KEY (author) ) ENGINE=ndb; Copyright © 2012 Oracle Corp.
  • 36. Data Definition: Tweets CREATE TABLE tweets ( id varchar(36) primary key, author varchar(15), time_stamp timestamp, tweet varchar(140), index(time_stamp), index(author))ENGINE=ndb; Copyright © 2012 Oracle Corp.
  • 37. Configuration: Use the ndbmemcache config schema mysql> use ndbmemcache; show tables; Copyright © 2012 Oracle Corp.
  • 38. Configuration: Create container & key_prefixes INSERT into containers SET name = 'tweets_table' , db_schema = 'demo' , db_table = 'tweets', key_columns = 'id' , value_columns = 'time_stamp,author,tweet'; INSERT into key_prefixes SET key_prefix = 'tweet:', policy = 'ndb-only', container = 'tweets_table'; Copyright © 2012 Oracle Corp.
  • 39. Two key_prefixes for authors table •  newauthor: •  ADD an author record and set date_created •  tweetcount: •  INCR tweet count for author Copyright © 2012 Oracle Corp.
  • 40. Configuration: New Author INSERT into containers SET name = 'author_new' , db_schema = 'demo' , db_table = 'authors', key_columns = 'author' , value_columns = 'date_created'; INSERT into key_prefixes SET key_prefix = 'newauthor:', policy = 'ndb-only', container = 'author_new'; Copyright © 2012 Oracle Corp.
  • 41. Configuration: Tweet Count INSERT into containers SET name = 'author_count', db_schema = 'demo', db_table = 'authors', key_columns = 'author', increment_column = 'tweets'; INSERT into key_prefixes SET key_prefix = 'tweetcount:', policy = 'ndb-only', container = 'author_count'; Copyright © 2012 Oracle Corp.
  • 42. Memcached: Start the server % cd /usr/local/mysql % bin/memcached -E lib/ndb_engine.so 17-Aug-2012 13:53:32 PDT NDB Memcache 5.5.25-ndb-7.2.7 ... Contacting primary management server (localhost:1186) ... Connected to "localhost:1186" as node id 4.Retrieved 6 key prefixes for server role "default_role". Server started with 4 threads. Priming the pump ... done [0.661 sec]. Copyright © 2012 Oracle Corp.
  • 43. Perl: Startup Code use Cache::Memcached; use UUID::Tiny; our $mc = new Cache::Memcached( { 'servers' => [ "localhost:11211" ] }); Copyright © 2012 Oracle Corp.
  • 44. Perl: Add a new author ## Takes one parameter: author sub new_author { my $author = shift; my $time = time(); my $key = "newauthor:$author"; $mc->add($key, $time); } Copyright © 2012 Oracle Corp.
  • 45. Perl: Insert a Tweet ## Take two parameters: author and tweet sub insert_tweet { my $author = shift; my $tweet = shift; my $id = create_UUID_as_string(UUID_V4); my $time = time(); # Insert the tweet my $key = "tweet:$id"; my $value = "$time" ."t". $author ."t". $tweet; $mc->add($key, $value); } Copyright © 2012 Oracle Corp.
  • 46. Perl: Increment Tweet Count ## Increment the author's tweet count. ## Take one parameter: author sub increment_tweetcount { my $author = shift; my $key = "tweetcount:$author"; $mc->incr($key, 1); } Copyright © 2012 Oracle Corp.
  • 47. Download MySQL Cluster + Memcached API http://www.mysql.com/downloads/cluster/#downloads
  • 48. MySQL Cluster CGE Most secure, scalable MySQL Database, Development / Management / Monitoring Tools, backed by Oracle Premier Lifetime Support Oracle Product Oracle Premier Certifications/Integrations Support MySQL Enterprise MySQL Enterprise Backup Monitor/Query Analyzer MySQL Enterprise MySQL Enterprise Security Scalability MySQL Cluster MySQL Workbench Manager
  • 49. Oracle Premier Support for MySQL Rely on The Experts - Get Unique Benefits •  Straight from the Source •  Largest Team of MySQL Experts •  Direct Access to MySQL Support Engineers •  Backed by MySQL Developers Only From •  Global 24/7/365, 29 languages •  Forward Compatible Hot Fixes Oracle •  MySQL Maintenance Releases •  Unlimited Incidents •  Knowledge Base "The MySQL support service has been •  MySQL Consultative Support essential in helping us with troubleshooting and providing recommendations for the production cluster, Thanks." -- Carlos Morales – Playfulplay.com
  • 50. Getting Started Learn More Scaling Web Databases Guide www.mysql.com/cluster/ Get MySQL Cluster 7.2 Review Documentation https://dev.mysql.com/doc/refman/5.5/en/ Download Today mysql-cluster-ndbmemcache.html http://www.mysql.com/ downloads/cluster/ Copyright 2011 Oracle Corporation 50
  • 51. Summary Scale Web Services with 99.999% Availability Native Memcached NoSQL Access Try it out Today! Copyright 2011 Oracle Corporation 51
  • 52.
  • 53. MySQL Cluster Architecture JPA REST Application Nodes Node Group 1 Node Group 2 F1 F2 Node 1 Node 3 Cluster Cluster Mgmt F3 F4 Mgmt F3 F4 Node 4 Node 2 F1 F2 Data Nodes
  • 54. MySQL Cluster - Extreme Resilience JPA REST Application Nodes Node Group 1 Node Group 2 F1 F2 Node 1 Node 3 Cluster Cluster Mgmt F3 F4 Mgmt F3 F4 Node 4 Node 2 F1 F2 Data Nodes