HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Very slow performance during backup (http://www.howtoforge.com/forums/showthread.php?t=62411)

Erjen 2nd July 2013 00:54

Very slow performance during backup
 
Hi,

I noticed it before, and now my server is really slow again during backup.
Every night, when the backup has started, as the command ps aux shows, it uses all of my CPU resources:
root 28054 4.1 0.0 18372 1284 ? D 00:32 0:24 tar pczf /var/backup/web14/web14_2013-07-01_22-32.tar.gz --exclude=backup* --directory /var/www/clients/client3/web14 .
root 28055 86.0 0.0 4092 772 ? S 00:32 8:25 gzip

The virtual server has eight cores with 8 GB memory and I am hosting about 30 not very busy websites. And during the backups the websites are really hardly visible.

Is there something I can do so the performance will not be influenced during the night backup? Maybe I can set the backup to very low priority?

Thanks!

rosehosting 2nd July 2013 01:23

you have to find if your CPU or the I/O is the issue. you can monitor your server with top and watch the columns '0.0%us' and '0.0%wa'.

then if possible, you can try lowering the cpu or io priority of the backup process and see if that will help you.

in general tar, especially when passing the compression to gzip is known to be causing high cpu spikes.

re-nicing the proccess on cpu and io may help sometimes.

check 'ionice' and 'nice'

Erjen 2nd July 2013 16:31

Hi rosehosting,

Thanks for your answer! I will try this when the backup is going on again.

Erjen 7th August 2013 01:55

Hi,

I monitored a couple of days my servers and these are my findings:
My server keeps slow in the backup session which runs from 12 am to approximately 1 am.
Monitoring my server with "top", Gzip gives a CPU-usage of about 40% and tar about 10%. The CPU-usage does not pass the 75%.
The command "nice" gives "0" and the command ionice gives "none: prio 4".

So what do I need to do now? I really need a solution.

Thanks again!

florian030 7th August 2013 07:56

You should add something like ionice -c2 to exec('tar pczf ' in the source.

Erjen 7th August 2013 09:23

Thanks Florian, I will try that and I will let you know!

florian030 7th August 2013 09:28

exec('ionice -c2 tar pczf .... in cron_daily.php should work.

Erjen 7th August 2013 21:21

Hi Florian,

Does it matter where exactly I put that line in the cron_daily.php? Because that file is rather big..

Thanks again

Croydon 8th August 2013 09:04

Hi,

yes it does indeed matter :)
You should search for the line that executes the tar command and change this line to use the ionice command.

In my installation this is line 1135.

Erjen 8th August 2013 09:24

Hi Croydon,

Thanks for your reply!
Just to be sure:
You are in the file /usr/local/ispconfig/server/cron_daily.php?
Because that file has only 954 in my case.

And these lines of codes I can find according the tar backup:
PHP Code:

//* Create a tar.gz backup as root user
                    
$web_backup_file 'web'.$web_id.'_'.date('Y-m-d_H-i').'.tar.gz';
                    
exec('tar pczf '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' --exclude=backup\* --directory '.escapeshellarg($web_path).' .'); 

So the code
PHP Code:

exec(tar pczf 

Should be changed with:
PHP Code:

exec(ionice -c2 tar pczf 

?

Thanks!


All times are GMT +2. The time now is 19:52.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.