最近测了一下TokuDB6.5与InnoDB1.1.18的性能对比测试,下面分享一下测试过程和测试结果,希望对以后可能需要用的TokuDB的朋友有点
大家对MySQL存储引擎最熟悉的恐怕就是InnoDB了,InnoDB的性能还算不错,尤其适用互联网应用。但是InnoDB也不能称作完美,尤其是单实例MySQL的性能那还真不敢恭维,,现在大多数互联网公司都是通过优秀的架构来弥补这点吧。今天说到的这个MySQL存储引擎单实例性能在特定情况下确实比InnoDB强很多,普通情况下也不差-----TokuDB------完美兼容MySQL。TokuDB是一个比较牛逼的引擎,它不是用常规数据库所用的B+树存储数据,而是采用所谓的分形树来存储,这种特殊的数据结构就使得TokuDB的读写性能很强(尤其是写,是InnoDB的许多倍吧)。最近测了一下TokuDB6.5与InnoDB1.1.18的性能对比测试,下面分享一下测试过程和测试结果,希望对以后可能需要用的TokuDB的朋友有点帮助(TokuDB数据文件在50G以内是免费的,超过就要收费,具体google tokudb既可找到,又是收费!!)。
首先简单介绍一下TokuDB,它是基于MySQL的存储引擎,采用分形数的数据结构做存储,最典型的几个特征就是插入速度极快,压缩效率高。官方给的它与InnoDB对比图如下:
TokuDB支持事务,MVCC等等一系列功能,看上图确实比InnoDB有很多优势,但是似乎在备份工具上面没有很好的支持(不知道是否有较好的收费版本)。关于TokuDB的功能基本上了解了,那接下来看看我们的具体测试结果。
测试工具:sysbench0.5。
测试方法:sysbench初始化一部分数据,然后跑脚本测试,测试过程中记录OS的相关数据。
sysbench测试脚本(没用热点数据模式,随机初始化数据):
sysbench --test=/home/zbs/sysbench-0.5/sysbench/tests/db/parallel_prepare.lua --oltp_tables_count=1 --oltp-table-size=$records --rand-init=on --num-threads=$thds --oltp-read-only=off --report-interval=10 --rand-type=uniform --mysql-table-engine=$type --max-time=8000 --mysql-host=$host --mysql-port=$port --mysql-user=test --mysql-password=test --mysql-db=test1 --max-requests=0 prepare >$log 2>&1
sysbench --test=/home/zbs/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp_tables_count=1 --oltp-table-size=$records --rand-init=on --num-threads=$thds --oltp-read-only=off --report-interval=10 --rand-type=uniform --mysql-table-engine=$type --max-time=8000 --mysql-host=$host --mysql-port=$port --mysql-user=test --mysql-password=test --mysql-db=test1 --max-requests=0 run >$log 2>&1
第一次测试出来之后,TPS出乎我们的意料,见下图:
你会发现TokuDB6竟然比InnoDB和TokuDB5.0好这么多倍(测试TokuDB时iostat的%util列10%以下,vmstat的r列较高)。这个结果很吓人,但明眼人都不会相信这个结果(实际上TokuDB官方给的结果也是两者几乎差不多,TokuDB稍好),因为如果世上有一个这么好的存储引擎,那InnoDB就不要混了。带着怀疑的态度进行了第二次测试(第一次测试虽然表的规模很大,但是没有指定--rand-init=on,导致初始化的数据大多数行的内容相同,而此时TokuDB的压缩能力显现出来了,比InnoDB数据文件大概小了20倍左右),第二次测试了好几种数据规模情况(数据随机初始化,非热点数据模式)。

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment