Tokudb

13
Transaction friendly engine that is better than InnoDB TokuDB may take the same amount of time to complete the query if the data is small and fits in memory. But with huge data, InnoDB is not able to perform while tokuDB gives you quick results.

description

TokuDB advantages

Transcript of Tokudb

Page 1: Tokudb

Transaction friendly engine that is better than InnoDB

TokuDB may take the same amount of time to complete the query if the data is small and fits in memory. But with huge data, InnoDB is not able to perform while tokuDB gives you quick results.

Page 2: Tokudb

Data warehouse / big data solution

TokuDB may take the same amount of time to complete the query if the data is small and fits in memory. But with huge data, InnoDB is not able to perform while tokuDB gives you quick results.

Page 3: Tokudb

Mysql engine

• Integrates with MySQL as an engine• TOkuDB is an engine just like MyISAM and

InnoDB. It is listed as default engine in the output of "show engines" command.

• No separate process when you start mysql all including myisam, innodb and tokudb are available

Page 4: Tokudb

15% compressed files on disk !!• TokuDB compresses data upto 15 to 20% compared to MyISAM or InnODB.

• Tokudb disk consumption:• -rwxrwx--x 1 root root 222M Oct 25 19:27 _akola_ticket_main_41e0_1_18_B_0.tokudb• -rwxrwx--x 1 root root 68M Oct 25 19:27 _akola_ticket_key_tripindex_41e0_1_18_B_2.tokudb• -rwxrwx--x 1 root root 52M Oct 25 19:27 _akola_ticket_key_route_no_41e0_1_18_B_5.tokudb• -rwxrwx--x 1 root root 50M Oct 25 19:27 _akola_ticket_key_adjtripno_41e0_1_18_B_3.tokudb• -rwxrwx--x 1 root root 36M Oct 25 19:42 _akola_ticket_key_wbindex_41e0_1_18_B_1.tokudb• -rwxrwx--x 1 root root 34M Oct 25 19:27 _akola_ticket_key_NewIndex1_41e0_1_18_B_4.tokudb

• MyISAM disk consumption for the same table:• -rw-rw---- 1 root root 1.5G Jul 10 00:36 ticket.MYD• -rw-rw---- 1 root root 335M Jul 10 00:40 ticket.MYI

Page 5: Tokudb

compatible sql

• Foreign keys are not supported• Transactions are supported• I can simply alter table to toku using alter table statement.

alter table tbl_name engine=TokuDB;• Or I can take the backup of tables from other engines and

restore them to tokudb• mysqldump db_name --routines --

compatible=no_table_options > db_name_to_toku.sql

Since TokuDB is the default engine, it will be converted to tokudb while restoring data.

Page 6: Tokudb

Crash recovery

• TOkuDB has one of the excellent crash recovery feature just like InnoDB (that MyISAM is missing!)

Page 7: Tokudb

Replication — Eliminate Slave Lag

• MySQL’s single threaded design often leads to slave lag. With TokuDB, slave lag is eliminated. This insures replication can be used for read scaling, backups, and disaster recovery, without resorting to sharding, expensive hardware.

Page 8: Tokudb

Hot Schema Changes in Seconds

• TokuDB introduced Hot Column Addition (HCAD). You can add or delete columns from an existing table with no downtime.

Page 9: Tokudb

No need to configure parameters

• There is no need to change my.cnf file• You may need to change only 2 following

options • if you get an error: Too many open files

open-files-limit=40000• You may need to disable sql mode

sql_mode='‘• By default, TokuDB uses about half the memory

of the machine as buffer pool

Page 10: Tokudb

disk consumption

• InnoDB stores data in ibdata files and the disk consumption is not reduced even if you drop tables. TokuDB tables works like MyISAM and frees the disk space immediately once you drop / truncate tables.

Page 11: Tokudb

Adding path

• You may need to add the path • export PATH=$PATH:/root/percona-5.5.30-

tokudb-7.0.1-fedora-x86_64/bin

Page 12: Tokudb

Install TokuDB part I• groupadd mysql

• useradd -r -g mysql mysql

• wget http://www.percona.com/redir/downloads/TESTING/Percona-TokuDB/percona-5.5.30-tokudb-7.0.1-fedora-x86_64.tar.gz

• tar zxvf percona-5.5.30-tokudb-7.0.1-fedora-x86_64.tar.gz

• ln -s `pwd`/percona-5.5.30-tokudb-7.0.1-fedora-x86_64 /usr/local/mysql• • cd /usr/local/mysql

• chown -R mysql .• chgrp -R mysql .

Page 13: Tokudb

Install TokuDB part II• scripts/mysql_install_db --user=mysql

• chown -R root .• chown -R mysql data

• mkdir /var/run/mysqld

• bin/mysqld_safe --user=root &

• # make sure that my.cnf has the following parameter:• user=root• # make sure that the following line is commented in my.cnf• #socket=/var/lib/mysql/mysql.sock• # you may need to provide socket file path while using command line• mysql --socket=/var/lib/mysql/mysql.sock