简体   繁体   English

MySQL的最佳配置? InnoDB和MyISAM

[英]Best configuration for MySQL? InnoDB and MyISAM

I read that InnoDB is supposed to be better at writing into MySQL than MyISAM, however, I'm trying it out, by running 3000 MySQL queries(Inserting rows, 8 Columns + id)... but results haven't turned out how I'd hoped. 我读到InnoDB应该比MyISAM更好地写MySQL,但是,我通过运行3000个MySQL查询(插入行,8列+ id)来进行尝试...但是结果还没有证明我希望。
Using InnoDB the execution time is around 5.3 Seconds while for MyISAM it takes around 2.2 Seconds. 使用InnoDB的执行时间约为5.3秒,而MyISAM的执行时间约为2.2秒。

My current mysql configuration is: 我当前的mysql配置是:

innodb_io_capacity = 8000
innodb_read_io_threads = 64
innodb_write_io_threads = 64
innodb_log_buffer_size = 32M
innodb_log_file_size = 564M
innodb_buffer_pool_size = 6G
innodb_buffer_pool_instances = 6
innodb_thread_concurrency = 0

Everything else is at its default value. 其他所有内容均为默认值。
My server is currently running: Ubuntu 14.04 x64 我的服务器当前正在运行:Ubuntu 14.04 x64
Has 12GB RAM 拥有12GB RAM
6 Cores 6芯
And using an SSD (service provider says it provides 10,000 IOPS) 并使用SSD(服务提供商表示可提供10,000 IOPS)

What would be the best configuration for InnoDB if I were to only use InnoDB, and what would be the best configuration for just MyISAM (like would it for some reason be faster if I were to disable InnoDB while not using it.)? 如果仅使用InnoDB,InnoDB的最佳配置是什么?仅MyISAM的最佳配置将是什么(例如,由于某些原因,如果我不使用InnoDB而不使用它,它会更快)。

Right now just thinking of using my server for storing stuff, and will need to write more data, than reading it... while later on, thinking of reading more than writing. 现在,只是考虑使用我的服务器来存储东西,并且需要比读取更多的数据。。。后来,考虑读取的不仅仅是写入。
Not sure if it matters, but right now running nginx (do not have apache on the server), php 5.6 and MySQL 5.6.19. 不确定是否重要,但是现在正在运行nginx(服务器上没有apache),php 5.6和MySQL 5.6.19。

MyISAM is not crash safe, or transactional.. InnoDB is and is ensuring the data is synced to disk (MyISAM does not) before finishing the statement (or COMMIT). MyISAM不是安全的崩溃或事务性的。InnoDB在并且确保在完成语句(或COMMIT)之前将数据同步到磁盘(MyISAM不会)。

Try bulking your writes together into a single transaction (BEGIN; INSERT, INSERT; COMMIT), or, running multiple inserts in parallel rather than sequentially (or both at the same time).. these things will improve the performance significantly. 尝试将您的写入内容合并到一个事务中(BEGIN; INSERT,INSERT; COMMIT),或者并行而不是顺序(或同时)运行多个插入。这些都将显着提高性能。

I would also read through the link suggested by Stuart Wagner. 我还将阅读Stuart Wagner建议的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM