Simple Performance Test of MyISAM engine and InnoDB Engine in MySQL

Source: Internet
Author: User
Developer online builder.com.cn Updated on: 2008-02-18Author: heiyeluren Source: csdn Keywords: Test InnoDB Engine MyISAM Engine MySQL [Hardware configuration]
CPU: amd2500 + (1.8 GB)
Memory: 1 GB/modern
Hard Disk: 80 GB/ide

[Software configuration]
OS: Windows XP SP2
SE: php5.2.1
DB: mysql5.0.37
Web: IIS6

[MySQL table structure]


Create Table 'Myisam '(
'Id'Int(11)Not Null Auto_increment,
'Name'Varchar(100)Default Null ,
'Content'Text ,
Primary Key ('Id ')
) Engine=MyISAMDefaultCharset= GBK;

Create   Table 'Innodb '(
'Id'Int(11)Not Null Auto_increment,
'Name'Varchar(100)Default Null ,
'Content'Text ,
Primary Key ('Id ')
) Engine=InnoDBDefaultCharset=GBK;

[Data content]

$ Name = "heiyeluren ";
$ Content = "MySQL supports several storage engines as processors for different table types. MySQL storage engine includes the engine for processing transaction security tables and the engine for processing non-transaction security tables: · MyISAM manages non-transaction tables. It provides high-speed storage and retrieval, as well as full-text search capabilities. MyISAM is supported in all MySQL configurations. It is the default storage engine, unless you configure MySQL to use another engine by default. · The memory storage engine provides "in-memory" tables. The merge storage engine allows a set to process the same MyISAM table as a separate table. Like MyISAM, memory and merge storage engines process non-transaction tables. Both engines are included in MySQL by default. Note: The memory storage engine is officially identified as the heap engine. · InnoDB and bdb storage engines provide transaction security tables. Bdb is included in the mysql-Max binary distribution version released for the operating system that supports it. InnoDB is also included in all MySQL 5.1 binary distributions by default. You can configure MySQL to allow or disable any engine as you like. · The example storage engine is a "stub" engine, which does not do anything. You can use this engine to create tables, but no data is stored or retrieved from them. The purpose of this engine is to serve MySQLSource codeThis example shows how to write a new storage engine. Similarly, it is mainly interested in developers. ";

[Insert data-1] (innodb_flush_log_at_trx_commit = 1)
MyISAM 1 W: 3/s
InnoDB, W: 219/s

MyISAM 10 W: 29/s
InnoDB 10 W: 2092/s

MyISAM 100 W: 287/s
InnoDB 100 W: dare not test

[Insert data-2] (innodb_flush_log_at_trx_commit = 0)
MyISAM 1 W: 3/s
InnoDB 1 W: 3/s

MyISAM 10 W: 30/s
InnoDB 10 W: 29/s

MyISAM 100 W: 273/s
InnoDB 100 W: 423/s

[Insert data 3] (innodb_buffer_pool_size = 1024 m)
InnoDB 1 W: 3/s
InnoDB 10 W: 33/s
InnoDB 100 W: 607/s

[Insert data 4] (innodb_buffer_pool_size = 256 m, innodb_flush_log_at_trx_commit = 1, set autocommit = 0)

InnoDB 1 W: 3/s
InnoDB 10 W: 26/s
InnoDB 100 W: 379/s

[MySQL configuration file] (default configuration)

# MySQL server instance configuration file
[Client]
Port =3306

[MySQL]
Default-character-Set=GBK

[ Mysqld ]
Port =3306
Basedir ="C:/mysql50/"
Datadir ="C:/mysql50/data/"
Default-character-Set = GBK
Default-storage-engine= InnoDB
SQL-Mode="Strict_trans_tables, no_auto_create_user, no_engine_substitution"
Max_connections =100

Query_cache_size =0
Table_cache =256
Tmp_table_size = 50 m
Thread_cache_size=8
Myisam_max_sort_file_size = 100 GB
Myisam_max_extra_sort_file_size= 100 GB
Myisam_sort_buffer_size= 100 m
Key_buffer_size= 82 m
Read_buffer_size= 64 K
Read_rnd_buffer_size= 256 K
Sort_buffer_size= K

innodb_additional_mem_pool_size = 4 m
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 2 m
innodb_buffer_pool_size = 159 m
innodb_log_file_size = 80 m
innodb_thread_concurrency = 8

[Summary]

It can be seen that in MySQL 5.0, the performance of MyISAM and InnoDB Storage engines is not very different. For InnoDB, innodb_flush_log_at_trx_commit is the main option that affects performance. If it is set to 1, therefore, data is automatically submitted each time it is inserted, resulting in a sharp decline in performance. It should be related to refreshing logs. Setting it to 0 can significantly improve the efficiency. Of course, similarly, you can submit "set autocommit = 0" in SQL to set the performance. In addition, I also heard that setting innodb_buffer_pool_size can improve the performance of InnoDB, but I did not find it significantly improved.

Basically, we can consider using InnoDB to replace our MyISAM engine, because InnoDB has many good features, such as transaction support, stored procedures, views, row-level locking, etc, in the case of a lot of concurrency, I believe that InnoDB must be much better than MyISAM. the configuration in CNF is also critical. A good configuration can effectively accelerate your application.

If it is not a complex web application, non-critical application, you can continue to consider MyISAM. You can consider the specific situation as needed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.