• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
What can we learn from NoSQL technologies?

What can we learn from NoSQL technologies?



I presented these slides for the first time at the Percona Live Conference 2013 in Santa Clara

I presented these slides for the first time at the Percona Live Conference 2013 in Santa Clara



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

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

    What can we learn from NoSQL technologies? What can we learn from NoSQL technologies? Presentation Transcript

    • Ivan ZorattiWhat Can We Learn FromNoSQLTechnologies?Percona Live Santa ClaraV1304.01Friday, 3 May 13
    • Who is Ivan?Friday, 3 May 13
    • SkySQL•Leading provider of opensource databases, services andsolutions•Home for the founders and theoriginal developers of the coreof MySQL•The creators of MariaDB, thedrop-off, innovativereplacement of MySQLFriday, 3 May 13
    • NoSQLTechnologiesFriday, 3 May 13
    • PAGE%SQL?•SQL•NoSQL•NewSQL5Friday, 3 May 13
    • PAGE[Allegedly] Reasons to adopt NoSQL•Not all the needs for a databasefit with the relational model•Key/value stores?•Who needsACID?•Who needs schemas?•Relational databases cannothandle many modern workloads•Scalability is an issue in general•RDBMSs are pretty inflexible•There is no elasticity•Schemas and administration istoo complicated, especiallyduring the development phase•SQL is unnecessarily complicated•NOSQL = Not Only SQL6Friday, 3 May 13
    • PAGENoSQL vs SQL7NoSQL•Schema-less (or dynamic schema)•Dynamic horizontal scaling•Good to store and retrieve a great quantity ofdata•Great Flexibility•FullACID not required - “BASE is better”•BasicallyAvailable, Soft state, Eventuallyconsistent•Objects: Collections, Documents, Fields•NoSQL DBs:•Key/Value•BigTable•Document•Graph(My)SQL•Rigid Schema design•Static or no horizontal scaling•Good to store and retrieve data that hasrelationship between the elements•Pretty inflexible•ACID as a given•Atomic, Consistent, Isolated, Durable•Objects: Tables, Rows, Columns•SQL DBs:•Row-based•Columnar•Object RelationalFriday, 3 May 13
    • PAGEUnderstanding the CAP Theorem•CA•Synchronous Replication•Two Phase Commit•MySQL,ACID/RDBMSs•CP•MongoDB, HBase, Redis, MemcacheD•AP•Cassandra, Riak, CouchDB8C APFriday, 3 May 13
    • PAGE 9Friday, 3 May 13
    • PAGEThe NoSQL Ecosystem10Friday, 3 May 13
    • Friday, 3 May 13
    • PAGEWhen is MySQL a good fit?•Complex (but well defined)schema•ACID and Consistency as a must•Interaction/Integration withtools and applications that speakMySQL•Typically “simple” data•Data “limited” in size•Application-based scalability•Applications require “complex”queries (read: joins)•Many developers / Few DBs•In-house expertise12Friday, 3 May 13
    • PAGEWhen is NoSQL a good fit?•Schema-less for startupapplications•Performance is more importantthan consistency andACIDfeatures•Documents, binary data andmore•Lots of data, unstructured•Scalability and elasticity out ofthe box will solve lots ofproblems•Applications mainly have“simple” queries (read: accessto single tables, by key or simpleconditions)•One man job (for each module)13Friday, 3 May 13
    • NewSQLFriday, 3 May 13
    • My[No]SQL CookbookFriday, 3 May 13
    • PAGEHandler Socket16Handler InterfaceInnodb MyISAM Other storage engines …SQL Layer Handlersocket PluginListener for libmysqllibmysql libhsclientApplicationsmysqldclient appFriday, 3 May 13
    • PAGEInnoDB and Memcached17http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-intro.htmlFriday, 3 May 13
    • PAGEVirtual Columns•For InnoDB, MyISAM andAria•Column content is dynamicallygenerated or materialised (but onlyfrom the row)•PERSISTENT (stored) or VIRTUAL(generated)18CREATE TABLE t3 (c1 int(11) NOT NULL AUTO_INCREMENT,c2 text,char_count int(11) AS( LENGTH( c2 ) ) PERSISTENT,word_count int(11) AS( LENGTH( c2 ) -LENGTH( REPLACE( c2, , ) ) +1 )PERSISTENT,PRIMARY KEY (`c1`)) ENGINE=InnoDB;Friday, 3 May 13
    • PAGEDynamic Columns•Implement a schema-less,document store•Options for COLUMN_ CREATE,ADD, GET, LIST, JSON, EXISTS,CHECK, DELETE•Nested colums are allowed•Main datatypes are allowed•Documents are <=1GB19CREATE TABLE assets (item_name VARCHAR(32) PRIMARY KEY,dynamic_cols BLOB );INSERT INTO assets VALUES (MariaDB T-shirt,COLUMN_CREATE( color, blue,size, XL ) );INSERT INTO assets VALUES (Thinkpad Laptop,COLUMN_CREATE( color, black,price, 500 ) );SELECT item_name, COLUMN_JSON( dynamic_cols )FROM assets;+-----------------+----------------------------------------+| item_name | COLUMN_JSON(dynamic_cols) |+-----------------+----------------------------------------+| MariaDB T-shirt | {"size":"XL","color":"blue"} || Thinkpad Laptop | {"color":"black","warranty":"3 years"} |+-----------------+----------------------------------------+Friday, 3 May 13
    • PAGESphinx•Available as storage engineSphinxSE or external search server•Write operations throughSphinxQL•Joins with non-Sphinx tables areallowed20CREATE TABLE t1 (id INTEGER UNSIGNED NOT NULL,weight INTEGER NOT NULL,query VARCHAR(3072) NOT NULL,group_id INTEGER,INDEX( query )) ENGINE=SPHINXCONNECTION = "sphinx://localhost:9312/test";SELECT * FROM t1WHERE query = test it;mode=any;SELECT content, date_addedFROM test.documents docsJOIN t1 ON ( docs.id = t1.id )WHERE query = ‘one document;mode=any;;Friday, 3 May 13
    • PAGEMap/Reduce approach•Available with InfiniDB andScaleDB•Experimental with MySQL Proxyand Gearman21Friday, 3 May 13
    • PAGEAdditions to the core MySQL•MySQL Cluster/NDB•Galera•ScaleDB•Continuent•ScaleBase•ScaleArc•CodeFutures22Friday, 3 May 13
    • Things to Improve in MySQLFriday, 3 May 13
    • PAGESharding - Sharding - Sharding!24SELECT ...FROM T4WHERE ID BETWEEN X AND YThequeryissenttoalltheshardsFriday, 3 May 13
    • PAGEEventual Consistency25DatabaseDatabaseDatabase Database DatabaseClient ApplicationsCommunication Protocol Communication Protocol Communication Protocol Communication Protocol Communication ProtocolOutbound Protocol Outbound Protocol Outbound Protocol Outbound Protocol Outbound Protocolbinlog binlog binlog binlog binlogFriday, 3 May 13
    • PAGEMultiple Communication Protocols26192.168.0.10MySQL Client3306JSON Client80ODATA Client8080192.168.0.20192.168.0.1192.168.0.30Friday, 3 May 13
    • PAGECassandra Storage Engine•Column Family == Table•Rowkey, static and dynamiccolumns allowed•Batch key access supportSET cassandra_default_thrift_host = TABLE cassandra_tbl (rowkey INT PRIMARY KEY,col1 VARCHAR(25),col2 BIGINT,dyn_cols BLOB DYNAMIC_COLUMN_STORAGE = yes )ENGINE = cassandraKEYSPACE = cassandra_key_spaceCOLUMN_FAMILY = column_family_name;27Friday, 3 May 13
    • PAGEConnect Storage Engine•Any file format as MySQLTABLE:•ODBC•Text, XML, *ML•Excel,Access etc.•MariaDB CREATE TABLE options•Multi-file table•TableAutocreation•Condition push down•Read/Write and Multi Storage Engine Join•CREATE INDEX28CREATE TABLE handoutENGINE = CONNECTTABLE_TYPE = XMLFILE_NAME = handout.htmHEADER = yes OPTION_LIST =name = TABLE,coltype = HTML,attribute =(border=1;cellpadding=5);Friday, 3 May 13
    • PAGEJoin us at the Solutions Day•Cassandra and Connect Storage Engine•Map/Reduce approach - Proxy optimisation•Multiple protocols and more29Friday, 3 May 13
    • Thank You!ivan@skysql.comizoratti.blogspot.comwww.slideshare.net/izorattiwww.skysql.comFriday, 3 May 13