# xtrabackup --prepare is VERY slow

**URL:** <https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982>\
**Category:** Percona XtraBackup\
**Created:** [July 20, 2016, 12:14pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982 "2016-07-20T12:14:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlbyrd](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rlbyrd](https://forums.percona.com/u/rlbyrd)\
**Post date:** [July 20, 2016, 12:14pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/1 "2016-07-20T12:14:21Z")

</div>

We’ve been using xtrabackup for several years with no issues at all. Recently, it became necessary for a rather large instance – 4.4TB – to begin backups. The instance is relatively busy, but not ridiculously so.

The base backup takes about 1.5 hours, which is fine. However, the ensuing apply-logs section (I always opt to do the prepare bit before deeming the full backup complete) is taking a whopping 20 hours, which seems a bit excessive to me.

I really only have one burning, painful question:

What could I do via xtrabackup or innobackupex magick to speed this part of the backup along?

Any input would be appreciated.

Kind regards,  
Richard

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [July 20, 2016, 1:03pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/2 "2016-07-20T13:03:58Z")

</div>

You should use --prepare with --use-memory option  
[url][The xtrabackup Option Reference](https://www.percona.com/doc/percona-xtrabackup/2.3/xtrabackup_bin/xbk_option_reference.html#cmdoption-xtrabackup--use-memory%5B/url%5D)

​Try to allocate to --use-memory as much memory as possible.

---

<div class="post-metadata">

**Author:** ![rlbyrd](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rlbyrd](https://forums.percona.com/u/rlbyrd)\
**Post date:** [July 20, 2016, 5:16pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/3 "2016-07-20T17:16:55Z")

</div>

As soon as our systems team finishes building a couple of slaves for this instance, I will absolutely utilize the --use-memory flag. However, at the moment, I’m having to take backups from the production instance, so I am reluctant to get too jiggy with it. Are there any other possible ways to speed up the log processing?

---

<div class="post-metadata">

**Author:** ![dbcarl](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dbcarl](https://forums.percona.com/u/dbcarl)\
**Post date:** [May 19, 2017, 12:07pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/4 "2017-05-19T12:07:28Z")

</div>

Any luck with increasing the preparation time? I have a Zabbix instance which takes a week to prepare even with a lot of RAM. Can the number of Buffer pool instances be increased beyond 1?

---

<div class="post-metadata">

**Author:** ![oldgarey](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@oldgarey](https://forums.percona.com/u/oldgarey)\
**Post date:** [June 5, 2017, 11:10pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/5 "2017-06-05T23:10:11Z")

</div>

same here , 500G database restore, prepare will take few hours, thats crazy man.

---

<div class="post-metadata">

**Author:** ![philschroeder](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@philschroeder](https://forums.percona.com/u/philschroeder)\
**Post date:** [November 7, 2017, 8:37pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/6 "2017-11-07T20:37:34Z")

</div>

Similar issue here…Percona Server 5.6.37-82.2-log, Xtrabackup 2.3.9. 1.4TB dataset, incremental backup takes 20 minutes to complete, but apply-logs/prepare takes sometimes more than 24 hours. I give it 48GB of RAM to use, can’t give it much more (400GB dedicated to innodb-buffer-pool).

---

<div class="post-metadata">

**Author:** ![kalyankumar\_taple](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kalyankumar_taple/32/3514_2.png) [@kalyankumar\_taple](https://forums.percona.com/u/kalyankumar_taple)\
**Post date:** [May 9, 2021, 4:44pm UTC](https://forums.percona.com/t/xtrabackup-prepare-is-very-slow/4982/7 "2021-05-09T16:44:36Z")

</div>

@rlbyrd i have same problem with our zabbix mysql db with 500 GB data xtrabackup --prepare took almost 50 hours its a full backup that i had and restoring …  
Any luck on speeding up ?
