If you’re doing significant amount of writes to Innodb tables decent size of innodb_log_file_size is important for MySQL Performance. However setting it too large will increase recovery time, so in case of MySQL crash or power failure it may take long time before MySQL Server is operational again.

So how to find the optimal combination ?

First let me explain what happens on recovery and why large innodb_log_file_size slows down recovery. During startup after crash Innodb scans log files to find log records which only have been applied in memory and do not exist in tablespace. Log records for modifications which did not make it to the tablespace are then applied. This is called redo phase of recovery. It can take pretty long time and this time depends on number of variables – how large are rows ? (smaller log records mean more records for same sized logs), how random were data modifications (random updates will need random IO to check if pages are up to date), number of unflushed pages in innodb buffer pool and its size as well as performance of IO subsystem. As there are so many factors, it is hard to come up with any general guidelines, something like 1GB per 10 minutes of recovery time – instead you would need to apply load which is typical for your application, crash MySQL in the middle and watch it to recover. Doing this several times you should be able to estimate how long recovery time take and adjust your logs apropriately. The good thing is – redo phase is close to be proportional to size of log files, so expect 1GB logs to take twice time to apply compared to 512MB logs.

Redo phase is however only one of the phases of recovery. The other important one is undo phase – after log file are applied and database is in “physically consistent” state, Innodb will need to roll back certain transactions which were not commited, but changes from which already made it to the database. Unlike “redo” phase “undo” phase can’t be reduced by sizing your log files. Even more undo phase can be slower with small log files. Undo phase takes considerable time if tranactions are long – Ie if you would delete 10000000 rows in the same transaction and crash in the middle recovery can take quite a long time. The only way you can reduce “undo” phase is size your transactions appropriately – so updates/inserts/deletes can be sized to affect limited number of rows.

Good thing about updo phase however is – it can be done in background as in MySQL 5.0. The rows affected by background rollback however might not be modified until rollback is complete.

One more thing to consider – how large log files do you need at all ? You could run benchmark with 1GB log files and 2GB and see if there is any performance benefit. After certain size increasing log file size do not dramatically increase performance, however this again depends on configuration and workload.

Note at this poing 4GB is maximum combined size allowed for innodb log files, which is however large enough limit for most onfigurations.

Q:I am a little confused by this line:
Note at this poing 4GB is maximum combined size allowed for innodb log files

My question is what is combined to get this 4GB maximum? Is it innodb_log_files_in_group * innodb_log_file_size or is there another part of equation I am missing?

A:It is combined size which is limited.

innodb_log_file_size

Command-Line Format --innodb_log_file_size=#
System Variable Name innodb_log_file_size
Variable Scope Global
Dynamic Variable No
Permitted Values (<= 5.6.2) Type numeric
Default 5242880
Min Value 1048576
Max Value 4GB / innodb_log_files_in_group
Permitted Values (>= 5.6.3, <= 5.6.7) Type numeric
Default 5242880
Min Value 1048576
Max Value 512GB / innodb_log_files_in_group
Permitted Values (>= 5.6.8) Type numeric
Default 50331648
Min Value 1048576
Max Value 512GB / innodb_log_files_in_group

The size in bytes of each log file in a log group. The combined size of log files (innodb_log_file_size *innodb_log_files_in_group) cannot exceed a maximum value that is slightly less than 512GB. A pair of 255 GB log files, for example, would allow you to approach the limit but not exceed it. The default value is 48MB. Sensible values range from 1MB to 1/N-th of the size of the buffer pool, where N is the number of log files in the group. The larger the value, the less checkpoint flush activity is needed in the buffer pool, saving disk I/O. Larger log files also make crash recovery slower, although improvements to recovery performance in MySQL 5.5 and higher make the log file size less of a consideration. For general I/O tuning advice, see Section 8.5.7, “Optimizing InnoDB Disk I/O”.

参考:

http://www.percona.com/blog/2006/07/03/choosing-proper-innodb_log_file_size/

http://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_log_file_size

Choosing proper innodb_log_file_size的更多相关文章

  1. 读李宏毅《一天看懂深度学习》——Deep Learning Tutorial

    大牛推荐的入门用深度学习导论,刚拿到有点懵,第一次接触PPT类型的学习资料,但是耐心看下来收获还是很大的,适合我这种小白入门哈哈. 原PPT链接:http://www.slideshare.net/t ...

  2. Control an LM317T with a PWM signal

    http://www.edn.com/design/analog/4363990/Control-an-LM317T-with-a-PWM-signal The LM317T from Nationa ...

  3. AI面试必备/深度学习100问1-50题答案解析

    AI面试必备/深度学习100问1-50题答案解析 2018年09月04日 15:42:07 刀客123 阅读数 2020更多 分类专栏: 机器学习   转载:https://blog.csdn.net ...

  4. 论文解读(Graphormer)《Do Transformers Really Perform Bad for Graph Representation?》

    论文信息 论文标题:Do Transformers Really Perform Bad for Graph Representation?论文作者:Chengxuan Ying, Tianle Ca ...

  5. CF219D. Choosing Capital for Treeland [树形DP]

    D. Choosing Capital for Treeland time limit per test 3 seconds memory limit per test 256 megabytes i ...

  6. 如何计算合适的InnoDB的(innodb_log_file_size)日志文件大小

    在mysql工具中如phpmyadmin中执行show engine innodb status;注意观察Log sequence number 60秒后再次执行 获取Log sequence num ...

  7. 《100种过度医疗大公开》:转译自日文版,日文版依据的是美国的“Choosing Wisely”项目。三星推荐

    本书转译自日文,日文版则是在美国的“Choosing Wisely”项目中选择了100个相对常见的过度医疗项目做解说.Choosing Wisely项目,是由美国多个专业医学组织发起的列出过度医疗项目 ...

  8. php加载xml编码错误,“Error: Input is not proper UTF-8, indicate encoding! ”

    最近在给php中解析xml的时候,抛出一个错误: "Warning: DOMDocument::load(): Input is not proper UTF-8, indicate enc ...

  9. 电脑开机黑屏,显示Reboot and Select proper boot device!

    “reboot and select proper boot device or insert boot media in selected boot device and press a key” ...

随机推荐

  1. (转) mysql的连接,创建账号,修改密码

    原文:http://blog.chinaunix.net/uid-20749043-id-1878306.html  mysql的连接,创建账号,修改密码 2008-10-13 15:31:29 分类 ...

  2. Ubuntu 升级VisualBox后无法启动 Kernel driver not installed (rc=-1908)

    VisualBox之所以在Linux上比传统的VMware快得多,关键一点就是它和Linux内核的结合比较紧密,这也是开源的优点. 不过Linux内核更新很频繁,每次更新内核后启动VirtualBox ...

  3. BZOJ 1657 奶牛的歌声

    单调栈. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm&g ...

  4. Canvas绘图API

    Canvas就是一个画布,可以进行任何的线.图形.填充等一系列的操作. Canvas的Context对象 要使用Canvas来绘制图形必须在页面中添加Canvas的标签 <canvas id=& ...

  5. OC多线程管理

    在OC中多线程管理包含GCD.NSThread.NSOperationQueue. 下面简单介绍. 进程和线程 进程:正在进行中的程序叫做进程,负责程序运行的内存分配. 每一个进程都有自己独立的虚拟内 ...

  6. HDU5534--Partial Tree (完全背包)

    点击打开链接 思路:总度数为2n-2,由于每个节点都至少要有1个度,所以可以看做把剩余n-2个点放入n个节点的背包问题.dp[i]表示放入i个度后的最大值 #include<cstdio> ...

  7. 钉子和小球_DP

    Description 有一个三角形木板,竖直立放,上面钉着n(n+1)/2颗钉子,还有(n+1)个格子(当n=5时如图1).每颗钉子和周围的钉子的距离都等于d,每个格子的宽度也都等于d,且除了最左端 ...

  8. android:windowSoftInputMode及其他部分属性用法

    本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! 今天我们来讲讲android:windoSoftInputMode的用法,许多同学会为软键盘的弹出. ...

  9. hdu 3172

    http://acm.hdu.edu.cn/showproblem.php?pid=3172 题意:输出每对朋友的关系网大小 并查集的时候维护一个数组记录根节点的大小即可,水题,这题坑在T组数据这个也 ...

  10. 使用Mysqldump 备份数据库

    使用Mysqldump 备份数据库 1.备份一个数据库 mysqldump --user [user name] --password=[password] [database name] >  ...