newest topic of spider 20131016 in buenos aires argentina

28
Spider Storage Engine: The sharding plugin of MySQL/MariaDB Introducing and newest topics Team-Lab / Spiral-Arm Kentoku SHIBA

Upload: kentoku

Post on 24-Jun-2015

366 views

Category:

Technology


0 download

DESCRIPTION

Introducing newest topic of Spider at 20131016 in Buenos Aires Argentina

TRANSCRIPT

Page 1: Newest topic of spider 20131016 in Buenos Aires Argentina

Spider Storage Engine:

The sharding plugin of MySQL/MariaDB

Introducing and newest topics

Team-Lab / Spiral-Arm

Kentoku SHIBA

Page 2: Newest topic of spider 20131016 in Buenos Aires Argentina

What is Spider Storage Engine

Spider Storage Engine is a plugin of

MySQL/MariaDB. Spider tables can be

used on other MySQL/MariaDB/OracleDB

tables as local tables.

Spider is bundled in MariaDB from 10.0.4.

Page 3: Newest topic of spider 20131016 in Buenos Aires Argentina

The use of Spider

dividing huge data into multiple servers

1. High traffic processing(DB sharding)

2. Parallel processing

You can use

3. multiple database for different application

as one database through Spider.

Page 4: Newest topic of spider 20131016 in Buenos Aires Argentina

SPIDER (MySQL/MariaDB)

SPIDER (MySQL/MariaDB)

Spider structure sample

DB1

tbl_a

1.Request

2.Just connect to spider

3.Response

DB2

tbl_b

DB3

tbl_c

AP

SPIDER (MySQL/MariaDB)

An application can use all databases

by only connecting one database.

AP AP AP AP

Page 5: Newest topic of spider 20131016 in Buenos Aires Argentina

How to use Spider (1/5)

1. Install Spider bundled

MySQL/MariaDB.

2. Login MySQL/MariaDB then

install Spider as a plugin.

(execute install_spider.sql)

3. Create Spider table.

Page 6: Newest topic of spider 20131016 in Buenos Aires Argentina

How to use Spider (2/5)

Create one to one Spider table.

CREATE TABLE t1(

c1 int,

c2 varchar(100),

PRIMARY KEY(c1)

)ENGINE=spider DEFAULT CHARSET=utf8

COMMENT '

table "rt1", database "test", port "3306",

host "host name of data node",

user "user name for data node",

password "password for data node"

';

Set engine name to “Spider” and write connect

information (and parameter) to comment.

Page 7: Newest topic of spider 20131016 in Buenos Aires Argentina

How to use Spider (3/5)

You can create Spider table without column definition on

MariaDB. In this case Spider gets column definition from

data node.

CREATE TABLE t1

ENGINE=spider DEFAULT CHARSET=utf8

COMMENT '

table "rt1", database "test", port "3306",

host "host name of data node",

user "user name for data node",

password "password for data node"

';

Page 8: Newest topic of spider 20131016 in Buenos Aires Argentina

How to use Spider (4/5)

Create one to many (sharding) Spider table

CREATE TABLE t1(

c1 int,

c2 varchar(100),

PRIMARY KEY(c1)

)ENGINE=spider DEFAULT CHARSET=utf8

COMMENT 'table "rt1", database "test", port "3306",

user "user name for data node", password "password for data node"'

PARTITION BY RANGE(c1) (

PARTITION p0 VALUES LESS THAN (100000) COMMENT 'host "h1"',

PARTITION p1 VALUES LESS THAN (200000) COMMENT 'host "h2"',

PARTITION p2 VALUES LESS THAN (300000) COMMENT 'host "h3"',

PARTITION p3 VALUES LESS THAN MAXVALUE COMMENT 'host "h4"'

);

Write shared connect information to table comment,

shard specific connect information to partition comment.

Page 9: Newest topic of spider 20131016 in Buenos Aires Argentina

How to use Spider (5/5)

You can use “CREATE SERVER” statement for defining

connect information.

CREATE SERVER srv1

FOREIGN DATA WRAPPER mysql

HOST 'host name of data node',

DATABASE 'test',

USER 'user name for data node',

PASSWORD 'password for data node',

PORT 3306

;

You can use create server definition by writing server parameter

into table/partition comment.

CREATE TABLE t1(

c1 int,

c2 varchar(100),

PRIMARY KEY(c1)

)ENGINE=spider DEFAULT CHARSET=utf8

COMMENT 'table "rt1", server "srv1"';

Page 10: Newest topic of spider 20131016 in Buenos Aires Argentina

Spider’s other features

Page 11: Newest topic of spider 20131016 in Buenos Aires Argentina

Spider’s other features

Redundant feature

You can choose redundant level per table/partition.

Fault tolerance feature

You can use not only Spider’s fault tolerance feature

but also other MySQL’s fault tolerance solutions.

Fulltext/Geo search feature

(with table partitioning, not available for MariaDB yet)

You can use backend Fulltext/Geo search feature

transparently.

Page 12: Newest topic of spider 20131016 in Buenos Aires Argentina

Spider’s other features

NoSQL feature (not available for MariaDB yet)

You can use handlersocket for Spider.

OracleDB connecting feature

You can use OracleDB for data node.

Note: You need to build from source code

for using this feature

Parallel searching feature

(not available for MariaDB yet)

You can search sharded table by parallel.

Page 13: Newest topic of spider 20131016 in Buenos Aires Argentina

Introducing other plugin

which is combined with Spider in many cases

Page 14: Newest topic of spider 20131016 in Buenos Aires Argentina

1. Vertical Partitioning Storage Engine

2. Handlersocket Plugin

3. Mroonga Storage Engine

Other plugins

Page 15: Newest topic of spider 20131016 in Buenos Aires Argentina

Vertical Partitioning Storage Engine

Vertical Partitioning (VP) Storage Engine’s

main features

1. Column level partitioning.

2. Works like a view of one to one relation tables.

Possible to direct access to child tables.

But, VP table can use as a table including

insert statement.

3. For using different horizontal partitioning rules

case by case.

4. Support online coping data between child tables.

Page 16: Newest topic of spider 20131016 in Buenos Aires Argentina

1. Vertical Partitioning Storage Engine

2. Handlersocket Plugin

3. Mroonga Storage Engine

Other plugins

Page 17: Newest topic of spider 20131016 in Buenos Aires Argentina

Handlersocket Plugin

Handlersocket (HS) Plugin’s main features

1. Offering high-speed NoSQL access to MySQL.

2. Offering NoSQL access to sharded servers by

combining with Spider.

Handlersocket is developed by Akira Higuchi.

https://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL

Patched version for Spider is bundled with

Spider bundled MySQL.

http://spiderformysql.com/download_spider.html

Page 18: Newest topic of spider 20131016 in Buenos Aires Argentina

1. Vertical Partitioning Storage Engine

2. Handlersocket Plugin

3. Mroonga Storage Engine

Other plugins

Page 19: Newest topic of spider 20131016 in Buenos Aires Argentina

Mroonga Storage Engine (1/2)

Mroonga Storage Engine’s main features

1. Offering high-speed FULLTEXT search.

2. Offering high-speed GEO search.

3. High-speed updating with multiple thread

searching. (lock-free model)

4. Support CJK languages.

Page 20: Newest topic of spider 20131016 in Buenos Aires Argentina

Mroonga Storage Engine (2/2)

Mroonga Storage Engine’s main features

5. You can use to add FULLTEXT/GEO search for

other storage engines.

6. Offering FULLTEXT/GEO search to sharded

servers by combining with Spider.

Mroonga’s document is available.

http://mroonga.github.com/

Page 21: Newest topic of spider 20131016 in Buenos Aires Argentina

The newest topics

Page 22: Newest topic of spider 20131016 in Buenos Aires Argentina

Bundled in MariaDB

Spider bundled in MariaDB 10.0.4.

Currently, we are trying to bundle Mroonga

into MariaDB too.

But there are some limitation as the following.

- A feature of needing a patch to MariaDB.

- A feature of combining with other storage engine.

Currently, we work for solving these limitations.

Page 23: Newest topic of spider 20131016 in Buenos Aires Argentina

The newest improvement

1. spider_bka_mode=2 This parameter is performance improvement parameter for

“batched key access”. Sometimes “spider_bka_mode=1” causes

replication delay. So this is added.

2. Optimizing aggregate functions Improvement aggregation functions (COUNT/MAX/MIN/SUM) performance,

if executing SQL has no join and distinct.

Page 24: Newest topic of spider 20131016 in Buenos Aires Argentina

The newest improvement

3. log_result_errors , spider_log_result_errors ,

spider_general_log (parameters),

spider_xa_failed_log (table)

It’s log enhancements. You can see SQLs that send from Spider node

to data node, error from data node to Spider node, error from Spider node

to application. And if xa transaction is failed, it is logged into

mysql.spider_xa_failed_log table. This features are useful for troubleshooting.

These parameters can be changed immediately.

Page 25: Newest topic of spider 20131016 in Buenos Aires Argentina

For more useful

Now, I plan to develop some tools for schema design and management.

It helps schema design, deploying and managing.

The other concepts are

1. It is possible to use with accustomed schema design tools.

2. It is possible to use for cloud services.

3. It is possible to use for already structured databases.

4. It is possible to use with accustomed management tools.

I can’t say when it is available, but I develop it as soon as possible,

and introducing about how to use.

Page 26: Newest topic of spider 20131016 in Buenos Aires Argentina

Conclusion

Page 27: Newest topic of spider 20131016 in Buenos Aires Argentina

- You can use other database tables include

OracleDB through Spider tables by only

connecting one database.

- You can divide huge data into multiple

database transparently through Spider

tables. Spider has great design flexibility.

Conclusion

Page 28: Newest topic of spider 20131016 in Buenos Aires Argentina

http://spiderformysql.com

Kentoku SHIBA (kentokushiba [at] gmail [dot] com)

Any Questions?

You can see me later!

Come to visit me!!

Thank you for taking your time!