LinuxMySQLXfs and ext3 speed test

Source: Internet
Author: User
Environment worker memory E7 series cpu4 files stored in xfs format delimiter // createprocedureinsert_mang_rows (inloopsint) begindeclarev1int; setv1 = loops; whilev1 & gt; 0 doinsertintot

Environment RedHat 5.6 mysql 5.1.54
64 GB memory E7 series cpu 4

Use xfs File Format

Stored Procedure

Delimiter //
Create procedure insert_mang_rows (in loops int) begin declare v1 int; set v1 = loops; while v1> 0 do
Insert into test. test values ('qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww ', 'wqqqqqqqqqqqqqqew'

, 'Eeeeeeeeeeeeeeeeeeeeeeeeee ', 'weeeeeeeeeeeeeeeeeeeeeeeee ');
Set v1 = v1-1;
End while;
End ;//

Myisam storage engine inserts 100 million rows of records using Stored Procedures

Mysql> call insert_mang_rows (1, 1000000 );
Query OK, 1 row affected (20.10 sec)

Use the innodb Storage engine to insert rows,
Innodb_flush_log_at_trx_commit is 1 by default.
Execute the stored procedure. After going out for dinner, the execution has not been completed.

Modify the following two values and then restart the mysql service to execute the stored procedure.
Innodb_flush_method = O_DIRECT
Innodb_flush_log_at_trx_commit = 0

Mysql> call insert_mang_rows (1000000 )//
Query OK, 1 row affected (38.51 sec)
 

Modify the following two values and then restart the mysql service to execute the stored procedure.
Innodb_flush_method = O_DIRECT
Innodb_flush_log_at_trx_commit = 2

Mysql> call insert_mang_rows (1000000 )//
Query OK, 1 row affected (1 min 15.94 sec)
 

Autocommit = 1.

Disable Automatic submission

Set autocommit = 0;
Innodb_flush_method = O_DIRECT
Innodb_flush_log_at_trx_commit = 2 modify the Stored Procedure

Drop procedure if exists insert_mang_rows
Delimiter //
Create procedure insert_mang_rows (in loops int) begin declare v1 int; set v1 = loops; while v1> 0 do
Insert into test. test values ('qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww ', 'wqqqqqqqqqqqqqqew'

, 'Eeeeeeeeeeeeeeeeeeeeeeeeee ', 'weeeeeeeeeeeeeeeeeeeeeeeee ');
Set v1 = v1-1;
End while;
Commit;
End ;//

Mysql> call insert_mang_rows (1000000 )//
Query OK, 0 rows affected (27.50 sec)
 

The above is the xfs system format. The following test is the ext3 System Format test.

The engine of innodb in ext3 format is the same as the above configuration for testing.

Myisam storage engine test

Ext3 of myisam

Mysql> call insert_mang_rows (1000000 )//
Query OK, 1 row affected (27.12 sec)

It is still faster than innodb, but slower than xfs File Format

Innodb_flush_log_at_trx_commit = 2
Innodb_flush_method = O_DIRECT
Mysql> set autocommit = 1 //

Mysql> call insert_mang_rows (1000000 )//
Query OK, 1 row affected (1 min 19.51 sec)
 

Set not to submit automatically

Mysql> set autocommit = 1 //

Mysql> show variables like 'Auto % ';

+ --------- + --- +
| Variable_name | Value |
+ --------- + --- +
| Auto_increment_increment | 1 |
| Auto_increment_offset | 1 |
| Autocommit | OFF |
| Automatic_sp_privileges | ON |
+ --------- + --- +
4 rows in set (0.00 sec)

Mysql> call insert_mang_rows (1, 1000000 );
Query OK, 0 rows affected (38.81 sec)
 

After the above test, we can see that the xfs file format is faster than the ext3 format. About innodb_flush_method = O_DIRECT
Innodb_flush_log_at_trx_commit = 2 parameter settings see http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html

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.