Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The system is running CENTOS 5.8, Apache 2.2.3, MySQL 5.0.95, PHP 5.3.3

We run mysqldump daily for a few databases. It's run via a php script called in crontab.

They are run at the same time and cause a spike in the server load. So I'm going to stagger the times that the dumps are called.

I was wondering if calling the commands directly in crontab:

0 3 * * * /usr/bin/mysqldump -u XXX -p XXX params db_name | gzip params > /var/www/backups/database/daily/daily-db_name-`date +\%d`.tar.gz

Or through a shell script to set variables.

Would be less of a load than calling a php script that uses exec():

exec( "/usr/bin/mysqldump -u XXX -p XXX params db_name | gzip params > /var/www/backups/database/daily/daily-db_name-`date +\%d`.tar.gz" );

I'm considering running a test, but wanted to check if this is a "no-brainer".

Result

Ran some tests and the load with the different methods wasn't noticeably different. I guess it could make a difference for a different type of operation where there are a lot of processes involved.

The php file being used is tracked in our svn repository, so best to stay with that approach.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The first example would be less of a load - it has fewer processes to spawn / start. Realistically, it may not be a visible lesser of a load, but in absolute terms, it is less.

share|improve this answer
    
I ran some tests after reading your answer. As you indicated, the difference wasn't notable. –  codewaggle Dec 17 '12 at 18:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.