[转]如何减少InnoDB的关闭的时间

原文:  http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/

作者: Baron Schwartz

 

How to decrease InnoDB shutdown times
如何减少InnoDB的关闭的时间

Sometimes a MySQL server running InnoDB takes a long time to shut down. The usual culprit is flushing dirty pages from the buffer pool. These are pages that have been modified in memory, but not on disk.
有时关闭一个运行着InnoDB的MySQL服务需要很长的时间,通常的罪魁祸首是(MySQL)正在刷新缓冲池上的Dirty pages.

If you kill the server before it finishes this process, it will just go through the recovery phase on startup, which can be even slower in stock InnoDB than the shutdown process, for a variety of reasons.
如果你在结束这个进程之前杀死服务,MySQL将在启动的时候运行恢复过程,因为各种原因,对于InnoDB可能比关闭进程更慢。

One way to decrease the shutdown time is to pre-flush the dirty pages, like this:
一种减少这个关闭时间的方式是像这样先刷新dirty pages:
PLAIN TEXT
CODE:

   1.
      mysql> set global innodb_max_dirty_pages_pct = 0;

Now run the following command:
现在可以运行如下的
PLAIN TEXT
CODE:

   1.
      $ mysqladmin ext -i10 | grep dirty
   2.
      | Innodb_buffer_pool_pages_dirty    | 1823484        |
   3.
      | Innodb_buffer_pool_pages_dirty    | 1821293        |
   4.
      | Innodb_buffer_pool_pages_dirty    | 1818938        |

And wait until it approaches zero. (If the server is being actively used, it won't get to zero.)
等待,直到接近0(如果server一直在运行的话,不会变成0)

Once it's pretty low, you can perform the shutdown and there'll be a lot less unfinished work to do, so the server should shut down more quickly.

一旦它相当的低,你就可以关闭服务,没有完成的工作就很少了 ,所以服务可以关闭的更快了。

This article is posted by on , link is .

Leave a reply