dbTalk Databases Forums  

Nightly backup is killing my db

comp.databases.mysql comp.databases.mysql


Discuss Nightly backup is killing my db in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simon
 
Posts: n/a

Default Nightly backup is killing my db - 02-08-2011 , 01:41 AM






Hi,

I have a medium sized site/db that does UPDATEs and SELECTs at almost
every single page load, (if you are a registered user).

When I run a nightly backup, (cron job at 3am EST), this causes a lock
on all the tables and effectively locks my database for sometime up to 3
minutes.

As you can imagine, this is unacceptable for my users, (and it causes
slow load time for anonymous users as well).

During backup, the server CPU is not doing too bad, it is a fairly good
server and I don't have that much load on the server.
So I am reluctant to get a new server simply to enable replication.

So, my questions are...

Is it possible to create a 'Slave' database on the same server that I
could use for my backup?

Would that make any real difference on the 'Master' database?

If it is possible, can you provide the link to set this up?

My logic is, if the site gets any bigger then I will setup replication
on a slaver server and do backups from that server, but in the meantime
the current database will not be locked.

Many thanks in advance

Simon

Reply With Quote
  #2  
Old   
Peter H. Coffin
 
Posts: n/a

Default Re: Nightly backup is killing my db - 02-08-2011 , 05:07 PM






On Tue, 08 Feb 2011 09:41:49 +0200, Simon wrote:
Quote:
Hi,

I have a medium sized site/db that does UPDATEs and SELECTs at almost
every single page load, (if you are a registered user).

When I run a nightly backup, (cron job at 3am EST), this causes a lock
on all the tables and effectively locks my database for sometime up to 3
minutes.

As you can imagine, this is unacceptable for my users, (and it causes
slow load time for anonymous users as well).
Ungrateful whiners.

Quote:
During backup, the server CPU is not doing too bad, it is a fairly good
server and I don't have that much load on the server.
So I am reluctant to get a new server simply to enable replication.
You shouldn't need to.

Quote:
So, my questions are...

Is it possible to create a 'Slave' database on the same server that I
could use for my backup?
Yes.

Quote:
Would that make any real difference on the 'Master' database?
No. Well, not in the long run anyway. There'll be a little more disk
used, and a little more CPU, but if you were that tight on either that
it would make a difference, you'd probably already be looking to add a
server anyway.

Quote:
If it is possible, can you provide the link to set this up?

My logic is, if the site gets any bigger then I will setup replication
on a slaver server and do backups from that server, but in the meantime
the current database will not be locked.
You should read the MySQL manual Chapters 6 and 16, paying particular
attention to section 6.2. 6.2 contains a non-exclusive list of some
backup strategies and how and when each works better than the other,
based on things like "Are you using MyIASM or InnoDB?" "Are you running
on a filesystem that supports snapshot copies?" etc. You're not wrong,
but you might be seeing only one possible solution...

--
93. If I decide to hold a double execution of the hero and an underling
who failed or betrayed me, I will see to it that the hero is
scheduled to go first.
--Peter Anspach's list of things to do as an Evil Overlord

Reply With Quote
  #3  
Old   
onedbguru
 
Posts: n/a

Default Re: Nightly backup is killing my db - 02-08-2011 , 08:29 PM



On Feb 8, 6:07*pm, "Peter H. Coffin" <hell... (AT) ninehells (DOT) com> wrote:
Quote:
On Tue, 08 Feb 2011 09:41:49 +0200, Simon wrote:
Hi,

I have a medium sized site/db that does UPDATEs and SELECTs at almost
every single page load, (if you are a registered user).

When I run a nightly backup, (cron job at 3am EST), this causes a lock
on all the tables and effectively locks my database for sometime up to 3
minutes.

As you can imagine, this is unacceptable for my users, (and it causes
slow load time for anonymous users as well).

Ungrateful whiners.

During backup, the server CPU is not doing too bad, it is a fairly good
server and I don't have that much load on the server.
So I am reluctant to get a new server simply to enable replication.

You shouldn't need to.

So, my questions are...

Is it possible to create a 'Slave' database on the same server that I
could use for my backup?

Yes.

Would that make any real difference on the 'Master' database?

No. Well, not in the long run anyway. There'll be a little more disk
used, and a little more CPU, but if you were that tight on either that
it would make a difference, you'd probably already be looking to add a
server anyway.

If it is possible, can you provide the link to set this up?

My logic is, if the site gets any bigger then I will setup replication
on a slaver server and do backups from that server, but in the meantime
the current database will not be locked.

You should read the MySQL manual Chapters 6 and 16, paying particular
attention to section 6.2. 6.2 contains a non-exclusive list of some
backup strategies and how and when each works better than the other,
based on things like "Are you using MyIASM or InnoDB?" "Are you running
on a filesystem that supports snapshot copies?" etc. You're not wrong,
but you might be seeing only one possible solution...

--
93. If I decide to hold a double execution of the hero and an underling
* * who failed or betrayed me, I will see to it that the hero is
* * scheduled to go first.
* * * * --Peter Anspach's list of things to do as an Evil Overlord

Enterprise backup or mysqldump?

and who needs to be online at 3AM any way...

Reply With Quote
  #4  
Old   
Brian Cryer
 
Posts: n/a

Default Re: Nightly backup is killing my db - 02-09-2011 , 04:51 AM



"onedbguru" <onedbguru (AT) yahoo (DOT) com> wrote

<snip>

Quote:
and who needs to be online at 3AM any way...
Europe is wide awake when its 3AM in the US.
When its 3AM in London, Singapore is wide awake.

If the site is only used by locals then I'd agree, but if its used by people
from all over the world then 3AM might even turn out to be the busiest time
of day ...
--
Brian Cryer
http://www.cryer.co.uk/brian

Reply With Quote
  #5  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: Nightly backup is killing my db - 02-09-2011 , 05:57 AM



onedbguru wrote:
Quote:
On Feb 8, 6:07 pm, "Peter H. Coffin" <hell... (AT) ninehells (DOT) com> wrote:
On Tue, 08 Feb 2011 09:41:49 +0200, Simon wrote:
Hi,
I have a medium sized site/db that does UPDATEs and SELECTs at almost
every single page load, (if you are a registered user).
When I run a nightly backup, (cron job at 3am EST), this causes a lock
on all the tables and effectively locks my database for sometime up to 3
minutes.
As you can imagine, this is unacceptable for my users, (and it causes
slow load time for anonymous users as well).
Ungrateful whiners.

During backup, the server CPU is not doing too bad, it is a fairly good
server and I don't have that much load on the server.
So I am reluctant to get a new server simply to enable replication.
You shouldn't need to.

So, my questions are...
Is it possible to create a 'Slave' database on the same server that I
could use for my backup?
Yes.

Would that make any real difference on the 'Master' database?
No. Well, not in the long run anyway. There'll be a little more disk
used, and a little more CPU, but if you were that tight on either that
it would make a difference, you'd probably already be looking to add a
server anyway.

If it is possible, can you provide the link to set this up?
My logic is, if the site gets any bigger then I will setup replication
on a slaver server and do backups from that server, but in the meantime
the current database will not be locked.
You should read the MySQL manual Chapters 6 and 16, paying particular
attention to section 6.2. 6.2 contains a non-exclusive list of some
backup strategies and how and when each works better than the other,
based on things like "Are you using MyIASM or InnoDB?" "Are you running
on a filesystem that supports snapshot copies?" etc. You're not wrong,
but you might be seeing only one possible solution...

--
93. If I decide to hold a double execution of the hero and an underling
who failed or betrayed me, I will see to it that the hero is
scheduled to go first.
--Peter Anspach's list of things to do as an Evil Overlord


Enterprise backup or mysqldump?

and who needs to be online at 3AM any way...
People whose working day may not coincide with YOUR timezone.

In my case, most of the western USA and Australasia..

Here in GB the Australian working day starts at about 2 am. Asian
Working day starts at about 3 a.m..and then the day rolls around through
India and Europe, and onwards to the east coast 5 hours behind, the west
coast 8 hours behind, and finally Hawaii, which I don't know cos don't
deal with Hawaiians much. :-)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.