Several days ago MySQL AB made new storage engine Falcon available for wide auditory. We cannot miss this event and executed several benchmarks to see how Falcon performs in comparison to InnoDB and MyISAM.
The second goal of benchmark was a popular myth that MyISAM is faster than InnoDB in reads, as InnoDB is transactional, supports Foreign Key and has an operational overhead. As you will see it is not always true.
For benchmarks I used our PHPTestSuite which allows to test wide range tables and queries.
The script and instruction are available here:
http://www.mysqlperformanceblog.com/files/benchmarks/phptestsuite.stable.tar.gz
We used table "normal" table structure which corresponds to typical structure you would see in OLTP or Web applications - medium size rows, auto increment primary key and couple of extra indexes.
-
CREATE TABLE IF NOT EXISTS `$tableName` (
-
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-
`name` varchar(64) NOT NULL DEFAULT '',
-
`email` varchar(64) NOT NULL DEFAULT '',
-
`password` varchar(64) NOT NULL DEFAULT '',
-
`dob` date DEFAULT NULL,
-
`address` varchar(128) NOT NULL DEFAULT '',
-
`city` varchar(64) NOT NULL DEFAULT '',
-
`state_id` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
-
`zip` varchar(8) NOT NULL DEFAULT '',
-
`country_id` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
-
PRIMARY KEY (`id`),
-
UNIQUE KEY `email` (`email`),
-
KEY `country_id` (`country_id`,`state_id`,`city`)
-
)
In this benchmark we used only read (SELECT) queries with different typical data access patterns:
primary key single row lookup, primary key range lookup, same access types for primary key and full table scans.
To highlight different properties of storage engines we tested ranges with and without LIMIT clause, and tested queries which
need to read the data or can only be satisfied by reading the index.
This benchmark is so called "micro" benchmark which concentrates on particular simple storage engine functions and we use it to see performance and scalability in this simple cases. We also use CPU bound workload in this case (no disk IO) to see how efficient storage engines are in terms of CPU usage. In real life workload results are likely to be very different.
The schema and queries are described here
Used hardware
CentOS release 4.4 (Final)
2 х Dual Core Intel XEON 5130model name : Intel(R) Xeon(R) CPU 5130 @ 2.00GHz
stepping : 6
cpu MHz : 1995.004
cache size : 4096 KB16GB of RAM
MySQL version
We used MySQL 5.1.14-beta sources for MyISAM / InnoDB
and MySQL 5.1.14-falcon bitkeeper tree
bk://mysql.bkbits.net/mysql-5.1-falcon for Falcon
(Please note this is a first release of Falcon and it is still in alpha stage and performance parameters may vary a lot in next releases)
Compilation parameters:
-
For MyISAM / InnoDB
-
./configure --prefix=/usr/local/mysqltest/mysql-<release> --with-innodb </release>
-
For Falcon
-
./configure --prefix=/usr/local/mysqltest/mysql-<release> --with-falcon </release>
mysqld startup params:
-
Falcon:
-
libexec/mysqld --no-defaults --user=root --falcon_min_record_memory=1G --falcon_max_record_memory=2GB --falcon_page_cache_size=1500M --max-connections=1500 --table-cache=512 --net_read_timeout=30 --net_write_timeout=30 --backlog=128
-
-
MyISAM / InnoDB:
-
libexec/mysqld --no-defaults --user=root --key-buffer-size=1500M --innodb-buffer-pool-size=1500M --innodb-log-file-size=100M --innodb-thread-concurrency=8 --max-connections=1500 --table-cache=512 --net_read_timeout=30 --net_write_timeout=30 --back_log=128
Method of benchmark:
1. Prepare table with 1,000,000 records (about 350Mb of data on disk)
2. Run each query for 1, 4, 16, 64, 128, 256 concurrent threads.
3. For each thread perform a warm-up run (duration 180 sec), and then
run three effective runs (duration of each is 60 sec).
As the final result we get a maximal result of three runs.
The raw numbers are available here:
http://www.mysqlperformanceblog.com/files/benchmarks/innodb-myisam-falcon.html
(Note: This benchmark is synthetic micro benchmarks focusing on particular simple data access patterns. Results for your workload are likely to be different.)
There are interesting results I want to show graphics with comments
READ_PK_POINT
Query: SELECT name FROM $tableName WHERE id = %d
The very common query with access by primary key.
InnoDB is faster than MyISAM by 6-9%.
Falcon shows very bad scalabilty.
READ_KEY_POINT
Query: SELECT name FROM $tableName WHERE country_id = %d
In this case Falcon is the best, because Falcon uses a tricky technic to retrieve rows (more
details with Jim Starkey's comments in Part 2).
There MyISAM shows bad scalability with increasing count of thread. I think the reason is pread system
call MyISAM uses to access data and retrieving from OS cache is not scaled.
READ_KEY_POINT_LIMIT
Query: SELECT name FROM $tableName WHERE country_id = %d LIMIT 5
The same query as previous but with LIMIT clause.
Due to Falcon's way of key access Falcon cannot handle LIMIT properly and that is why
we see bad performance. We hope the performance of LIMIT queries will be fixed before release.
MyISAM shows stable result.
InnoDB is better than MyISAM by 58% in case with 4 threads, but does not scale good enough.
Perhaps there is still a problem with InnoDB mutexes.
READ_KEY_POINT_NO_DATA
Query: SELECT state_id FROM $tableName WHERE country_id = %d
This query is similar to previous READ_KEY_POINT with only different the values of accessed column is stored in key. MyISAM and InnoDB handle this case and retrive the value only from key.
InnoDB is better by 25-30%.
Falcon needs an access to data beside key access, and most likely this will not be fixed, as this is
specific Falcon's way to handle multi-versioning. I think this is a big weakness of Falcon, as 'using index' is very common optimization we use in our practice.
READ_KEY_POINT_NO_DATA_LIMIT
Query: SELECT state_id FROM $tableName WHERE country_id = %d LIMIT 5
The previous query but with LIMIT.
Again the LIMIT is bad for Falcon.
InnoDB is better than MyISAM by 87% in case with 4 threads but drops down very fast.
READ_PK_POINT_INDEX
Query: SELECT id FROM $tableName WHERE id = %d
Simple but very quick query to retrieve value from PK.
The results for InnoDB and MyISAM are comparable and I think this shows both engines are maximally optimized and the result is maximal that can be reached for this query.
Falcon scales pretty bad and there is a big room for optimization.
READ_PK_RANGE
Query: SELECT min(dob) FROM $tableName WHERE id between %d and %d
Access by range of PK values.
MyISAM scales very bad, and reason is the same as for READ_KEY_POINT queries.
InnoDB is better than MyISAM by 2-26 times
and than Falcon by 1.64 - 3.85 times.
READ_PK_RANGE_INDEX
Query: SELECT count(id) FROM $tableName WHERE id between %d and %d
MyISAM scales good here, because of access only to key column and 'pread' syscall is not used.
READ_KEY_RANGE
Query: SELECT name FROM $tableName WHERE country_id = %d and state_id between %d and %d
As in case with READ_KEY_RANGE Falcon is the best here.
Falcon's resuts better than InnoDB by 10-30%
MyISAM drops down with 128-256 threads
READ_KEY_RANGE_LIMIT
Query: SELECT name FROM $tableName WHERE country_id = %d and state_id between %d and %d LIMIT 50
Again Falcon does not hanle LIMIT and the results are much worse.
READ_KEY_RANGE_NO_DATA
Query: SELECT city FROM $tableName WHERE country_id = %d and state_id between %d and %d
READ_KEY_RANGE_NO_DATA_LIMIT
Query: SELECT city FROM $tableName WHERE country_id = %d and state_id between %d and %d LIMIT 50
READ_FTS
Query: SELECT min(dob) FROM $tableName
The hardest query performs a scan of all million rows.
InnoDB is better than MyISAM by ~30% with 4-16 threads, but MyISAM scales a bit better in this case.
InnoDB is better than Falcon by 2-3 times.
相关推荐
本文实例讲述了mysql更改引擎(InnoDB,MyISAM)的方法,分享给大家供大家参考。具体实现方法如下: mysql默认的数据库引擎是MyISAM,不支持事务和外键,也可使用支持事务和外键的InnoDB。 查看当前数据库的所支持的...
MySQL数据库系统提供了多种存储引擎,其中最常用的两种是MyISAM和InnoDB。它们各自具有独特的特性和适用场景,理解二者的性能差异对于优化数据库设计至关重要。 MyISAM引擎是MySQL早期的默认存储引擎,以其高速度和...
MySQL 数据存储引擎 InnoDB 和 MyISAM 的优势及区别分享 MySQL 数据存储引擎 InnoDB 和 MyISAM 是 MySQL 中最常用的两个表类型,每种类型都有其优缺点,本文将详细介绍 InnoDB 和 MyISAM 的特点、优缺点和应用场景...
### Innodb与Myisam引擎的区别与应用场景 在MySQL数据库管理系统中,选择合适的存储引擎对于确保数据的安全性、完整性和性能至关重要。其中,InnoDB和MyISAM是最为常见的两种存储引擎,它们各自具备独特的特性和...
《MYSQL备份与恢复》之 Innodb与 MyISAM引擎 一、系统环境 1.1 ubuntu 12.0.4 X86_64 1.2 percona-xtrabackup-2.0.3.tar.gz 1.3 xtrabackup简介 xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时...
本文主要讨论的是InnoDB和MyISAM这两个引擎的对决,两者在事务处理、数据恢复、并发控制、存储空间占用以及读取性能等方面都有显著差异。 首先,InnoDB存储引擎支持事务处理,这使得它适用于那些需要确保数据完整性...
mysql存储引擎-innodb与myisam的区别.doc
### MyISAM与InnoDB的异同 在MySQL数据库系统中,存储引擎是数据库的核心组件之一,它负责处理数据的存储、检索等底层操作。MyISAM和InnoDB是MySQL中最常用的两种存储引擎,它们各自拥有不同的特点和适用场景。 ##...
MySQL存储引擎--MyISAM与InnoDB区别 MySQL是一种关系型数据库管理系统,它支持多种存储引擎,每种存储引擎都有其特点和优缺。MyISAM和InnoDB是MySQL中最常用的两种存储引擎,它们都有其优缺点,本文将对比MyISAM...
MySQL中的InnoDB和MyISAM是两种非常重要的存储引擎,它们各自有着独特的特性和适用场景。下面我们将深入探讨这两种引擎的主要区别。 首先,InnoDB是MySQL的默认存储引擎,它支持事务处理,这意味着用户可以执行诸如...
自己总结的 关于mysql存储引擎myisam innodb 的比较 两者区别 对面试会很有帮助
MySQL中的存储引擎MyISAM和InnoDB在处理索引上有显著的差异,这些差异主要体现在索引的组织方式以及对数据存储的影响上。两者都基于B+树这种高效的索引结构,但具体实现有所不同。 首先,MyISAM的索引采用非聚集...
MyISAM InnoDB 区别 InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持。MyISAM类型的表强调的...
InnoDB索引与MyISAM索引实现的区别是什么?.mp4 InnoDB索引与MyISAM索引实现的区别是什么?.mp4 InnoDB索引与MyISAM索引实现的区别是什么?.mp4 InnoDB索引与MyISAM索引实现的区别是什么?.mp4 InnoDB索引与MyISAM...
### MySQL 数据库引擎 MyISAM 与 InnoDB 在 MySQL 数据库系统中,存在多种不同的存储引擎,其中最为人所熟知且广泛使用的两种是 MyISAM 和 InnoDB。这两种存储引擎各自具有独特的特点和适用场景。 #### InnoDB:...
本文主要讨论了两种最常用的存储引擎——InnoDB和MyISAM,并分析了它们的优缺点。 首先,MyISAM是MySQL的默认存储引擎,适用于读取密集型应用。它提供了快速的全表扫描和COUNT()操作,适合那些不需要事务处理和外键...
MySQL数据库系统中,InnoDB和MyISAM是两种非常重要的存储引擎,它们各自拥有独特的特性和适用场景。这篇文章将深入探讨两者在存储上的特点和差异。 首先,MyISAM引擎是MySQL早期默认的存储引擎,以其快速的读取速度...