Confluence restore from zip takes long time
Asked by Kavirajacholan Selvaraj:

**Importing Data**

|---------------------|----------------------------------------------|
| **Time Elapsed:**   | 31 minutes, 44 seconds                       |
| **Time Remaining:** | 12 hours, 41 minutes, 54 seconds (estimated) |
| **Completion:**     | 4% complete                                  |

Is there any were I can get it soon? It will be affect during Prod Migration. Please advise.


Answers:
author: Juho It?
body: I was restoring a 14 GB XML zip backup with attachments to a new Linux virtual machine and the estimated restore time was multiple hours.  

I realized by checking monitoring stats of the VM that it's doing nothing - no disk or CPU usage. Then in **\<confluence-home\>/logs/atlassian-confluence.log** I saw error:

```
2020-08-26 11:23:59,087 ERROR [Long running task: Importing data] [confluence.util.longrunning.ConfluenceAbstractLongRunningTask] run Long running task "Importing data" failed to run. -- referer: http://192.168.0.29:8090/setup/setup-restore-local.action | url: /setup/longrunningtaskxml.action | userName: anonymous | action: longrunningtaskxmljava.lang.OutOfMemoryError: Java heap space
```

<br />

I increased system memory reserved for JVM by editing **setenv.sh:**

```
# Original line
CATALINA_OPTS="$CATALINA_OPTS -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:+UseG1GC"
# Edited lineCATALINA_OPTS="$CATALINA_OPTS -Xms1024m -Xmx4096m -XX:MaxPermSize=256m -XX:+UseG1GC"
```

\* Source: <https://confluence.atlassian.com/confkb/cannot-create-or-restore-xml-backup-due-to-outofmemory-errors-128843918.html>  

Now the restore went through in 36 minutes. My VM had 2 CPU and 8 GB memory.


author: Jacob Peters
body: If it's possible to restore via the cli you could use a ram disk. you're essentially sectioning off a portion of the hosts memory and mounting it as a file system for reads/writes.

<https://www.techrepublic.com/article/how-to-use-a-ramdisk-on-linux/>


author: Kavirajacholan Selvaraj
body: [@Mark Lang](/t5/user/viewprofilepage/user-id/671093) [@Nic Brough -Adaptavist-](/t5/user/viewprofilepage/user-id/781454) Any idea on this? Please advise me.

Right now I am doing test environment migration. But when it comes to production we cant expect this many hours downtime.

comments: author: Mark Lang
body: Can I have a bit more detail about what you are doing? Based on the image/text, I'm assuming this is a space import? Where are you importing the zip from (NFS, your computer, directly on the Confluence Server)?

I may need some additional info about the space as well, like size of the zip and how many attachments?


author: Kavirajacholan Selvaraj
body: Hi Mark,

I am doing the backup import from datacenter to AWS Server using the zip file of entity.xml which will import all the data.

When I build a server on AWS, using URL I am setting up the confluence. After providing confluence license it has options to "restore from backup". there I am importing the data.

If you need any more infromation. Please let me know. this import is full entity.xml file not space or attachment.


author: Mark Lang
body: Okay that is better for what I wanted to suggest. Can you consider a DB Dump and Tar/Zip of Confluence Home and then restore the data back in the database and rsync/copy the Confluence Home back into place? That is going to be much faster and if i remember correctly what Atlassian is going to advise as you get larger.

It goes without saying but make sure to back up your current production before you do any of this.