Showing posts with label buffer. Show all posts
Showing posts with label buffer. Show all posts

Thursday, March 8, 2012

Child packages: Execute them all out of process?

HI, I have some parent parent packages that calls child packages. When I added a bunch of packages, I faced the buffer out of memory error. I then decided to set the child packages property ExecuteOutOfProcess to TRUE. I noticed that the execution time is longer now. Is this a good practice to set the ExecuteOutOfProcess to true? If so, is it normal that the execution time is longer?

Thank you,
Ccote

ccote wrote:

HI, I have some parent parent packages that calls child packages. When I added a bunch of packages, I faced the buffer out of memory error. I then decided to set the child packages property ExecuteOutOfProcess to TRUE. I noticed that the execution time is longer now. Is this a good practice to set the ExecuteOutOfProcess to true? If so, is it normal that the execution time is longer?

Thank you,
Ccote

I don't think there is a any best practice guidance around this. Personally I tend to think if you need to execute them out of process, then do so. otherwise, in proc is fine. I can't think of another rationale for one or the other.

-Jamie

|||

Out of process is slower, but gives you a new process (Obviously!) and this allows a new set of memory. For 32-bit this can be benefical as you get another 2Gb (/3Gb), just for the out of proc package execution host, rather than sharing the memory of the parent. So if you have a high memory requirement and the machine has enough memory to support the two processes taking their own share, then out of proc makes sense, but at the cost of speed.

So what you see is expected. It takes time to setup a new process and allocate it all that memory.

Saturday, February 25, 2012

checkpoint

Hi friends,
I came across the recommendation to do checkpoint to flush a buffer pool out
when doing massive modification in small chunks under simple recovery mode.
Can someone elaborate a bit more on it? Is it reasonable? And why?
Thanks a lot in advance.
AlexAlex,
This is my understanding...
When you execute a CHECKPOINT Statement it forces SQL Server to write
all dirty pages to Disk. (Dirty pages being Data/Log Pages that have
been modified but not written to Disk). Once the Checkpoint is issued
the Transaction Log is Truncated. SQL Server marks the transaction log
at the start of the active portion i.e Where there are still active
transactions. The rest of log is discarded as all transactions have
either had commit or rollback statement issued.
To be honest I can't really see the need to do this when you are using
Simple Recovery anyway - unless space is an issue. SQL Server issues
Checkpoint commands automatically, so the Log would return to the
minimum size anyway. I think SQL Server issues Checkpoint commands
every 10 mins - I think!
Hope this helps
Barry|||thanks Barry,
That was my understanding too, I just thought maybe I was missing
something,- such recommendation couldn't emerge out of nowhere, right?
Alex
"Barry" <barry.oconnor@.singers.co.im> wrote in message
news:1138908677.612627.55190@.g43g2000cwa.googlegroups.com...
> Alex,
> This is my understanding...
> When you execute a CHECKPOINT Statement it forces SQL Server to write
> all dirty pages to Disk. (Dirty pages being Data/Log Pages that have
> been modified but not written to Disk). Once the Checkpoint is issued
> the Transaction Log is Truncated. SQL Server marks the transaction log
> at the start of the active portion i.e Where there are still active
> transactions. The rest of log is discarded as all transactions have
> either had commit or rollback statement issued.
> To be honest I can't really see the need to do this when you are using
> Simple Recovery anyway - unless space is an issue. SQL Server issues
> Checkpoint commands automatically, so the Log would return to the
> minimum size anyway. I think SQL Server issues Checkpoint commands
> every 10 mins - I think!
> Hope this helps
> Barry
>|||Well, there's no harm in forcing checkpoints in between batches. I
think the recommendation comes from the problems around long running
transactions and large data modifications.
Even in SIMPLE recovery mode the transaction log can grow very large
when there is some long running transaction (thereby preventing the
checkpoint from occurring, because the server can't flush an open
transaction) and it's making lots of changes (thereby producing many log
records). By breaking up the single big transaction into many smaller
batches, that gives the server a chance to checkpoint in between batches
thereby keeping the transaction log under control (and not locking out
other users for long periods of time).
The server will do automatic checkpoints based on a formula (it's not
just every x seconds). It's different depending on the recovery mode.
In simple recovery mode the server will do an automatic checkpoint when
the log becomes 70% full or the number of log records is more than what
SQL Server estimates it can get through in the recovery interval period
(which ever comes sooner). So it's possible that the log is not quite
full enough to do an auto checkpoint at the time you start the next
batch. In which case the log will then continue to be filled and quite
possibly have to do an autogrow operation (at which time the 70% full
mark is even bigger). So there's no harm in doing a manual checkpoint
in between batches and possible benefit.
Personally, when I have to do this kind of stuff I always do manual
checkpoints between batches (although I do it mostly on DBs in full
recovery mode that have their logs backed up pretty regularly - like
every 15 minutes for example - so it's slightly different, but the same
concept).
*mike hodgson*
http://sqlnerd.blogspot.com
AlexM wrote:

>thanks Barry,
>That was my understanding too, I just thought maybe I was missing
>something,- such recommendation couldn't emerge out of nowhere, right?
>Alex
>
>"Barry" <barry.oconnor@.singers.co.im> wrote in message
>news:1138908677.612627.55190@.g43g2000cwa.googlegroups.com...
>
>
>|||I've had some discussions with Storage engine people at MS about this. I've
had cases where forcing
a checkpoint in simple recovery with *not* long running transaction seemed t
o increate re-use of the
log. But this shouldn't happen, and the person I spoke to would consider suc
h cases a bug. The way I
interpreted it: If we can provide a repro, and provide them with that, they
will have a look at it
and "fix" it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message news:%23NPOQWGKGHA.668@.TK2MSFTNGP11.p
hx.gbl...
> Well, there's no harm in forcing checkpoints in between batches. I
> think the recommendation comes from the problems around long running
> transactions and large data modifications.
> Even in SIMPLE recovery mode the transaction log can grow very large
> when there is some long running transaction (thereby preventing the
> checkpoint from occurring, because the server can't flush an open
> transaction) and it's making lots of changes (thereby producing many log
> records). By breaking up the single big transaction into many smaller
> batches, that gives the server a chance to checkpoint in between batches
> thereby keeping the transaction log under control (and not locking out
> other users for long periods of time).
> The server will do automatic checkpoints based on a formula (it's not
> just every x seconds). It's different depending on the recovery mode.
> In simple recovery mode the server will do an automatic checkpoint when
> the log becomes 70% full or the number of log records is more than what
> SQL Server estimates it can get through in the recovery interval period
> (which ever comes sooner). So it's possible that the log is not quite
> full enough to do an auto checkpoint at the time you start the next
> batch. In which case the log will then continue to be filled and quite
> possibly have to do an autogrow operation (at which time the 70% full
> mark is even bigger). So there's no harm in doing a manual checkpoint
> in between batches and possible benefit.
> Personally, when I have to do this kind of stuff I always do manual
> checkpoints between batches (although I do it mostly on DBs in full
> recovery mode that have their logs backed up pretty regularly - like
> every 15 minutes for example - so it's slightly different, but the same
> concept).
> --
> *mike hodgson*
> http://sqlnerd.blogspot.com
>
> AlexM wrote:
>
>|||TIbor, Mike - Thanks for additional comments - further info is always
helpful.
Barry|||>> Even in SIMPLE recovery mode the transaction log can grow very large when
there is some long running transaction (thereby preventing the checkpoint f
rom occurring, because the server can't flush an open transaction)<<
I'm not sure exactly what you mean saying SQL Server can't flush an open tra
nsaction. It's true that the log space can't be reused, but that has nothing
to do with checkpoint. Checkpoint happens at regular intervals, as you sugg
est, but it will write ALL dirty pages to disk, even those that are part of
an uncommitted transaction.
The log space can't be reused, so the log can grow quite large, but the chec
kpoints DO occur.
--
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message news:%23NPOQWGKGHA.668
@.TK2MSFTNGP11.phx.gbl...
Well, there's no harm in forcing checkpoints in between batches. I think th
e recommendation comes from the problems around long running transactions an
d large data modifications.
Even in SIMPLE recovery mode the transaction log can grow very large when th
ere is some long running transaction (thereby preventing the checkpoint from
occurring, because the server can't flush an open transaction) and it's mak
ing lots of changes (thereby producing many log records). By breaking up th
e single big transaction into many smaller batches, that gives the server a
chance to checkpoint in between batches thereby keeping the transaction log
under control (and not locking out other users for long periods of time).
The server will do automatic checkpoints based on a formula (it's not just e
very x seconds). It's different depending on the recovery mode. In simple
recovery mode the server will do an automatic checkpoint when the log become
s 70% full or the number of log records is more than what SQL Server estimat
es it can get through in the recovery interval period (which ever comes soon
er). So it's possible that the log is not quite full enough to do an auto c
heckpoint at the time you start the next batch. In which case the log will
then continue to be filled and quite possibly have to do an autogrow operati
on (at which time the 70% full mark is even bigger). So there's no harm in
doing a manual checkpoint in between batches and possible benefit.
Personally, when I have to do this kind of stuff I always do manual checkpoi
nts between batches (although I do it mostly on DBs in full recovery mode th
at have their logs backed up pretty regularly - like every 15 minutes for ex
ample - so it's slightly different, but the same concept).
mike hodgson
http://sqlnerd.blogspot.com
AlexM wrote:
thanks Barry,
That was my understanding too, I just thought maybe I was missing
something,- such recommendation couldn't emerge out of nowhere, right?
Alex
"Barry" <barry.oconnor@.singers.co.im> wrote in message
news:1138908677.612627.55190@.g43g2000cwa.googlegroups.com...
Alex,
This is my understanding...
When you execute a CHECKPOINT Statement it forces SQL Server to write
all dirty pages to Disk. (Dirty pages being Data/Log Pages that have
been modified but not written to Disk). Once the Checkpoint is issued
the Transaction Log is Truncated. SQL Server marks the transaction log
at the start of the active portion i.e Where there are still active
transactions. The rest of log is discarded as all transactions have
either had commit or rollback statement issued.
To be honest I can't really see the need to do this when you are using
Simple Recovery anyway - unless space is an issue. SQL Server issues
Checkpoint commands automatically, so the Log would return to the
minimum size anyway. I think SQL Server issues Checkpoint commands
every 10 mins - I think!
Hope this helps
Barry|||Sorry, I shouldn't have used the term "flush". My bad - mixing terminology.
I guess where I was coming from was, and it may since have changed so
I'm prepared to admit I'm wrong, in the old days (with SQL 6.5 and
earlier from memory) the simple recovery model was implemented with the
"trunc. log on checkpoint" dboption (and also depended on the value of
the "bcp/bulk insert" option too). So I was thinking that in simple
recovery mode with SQL 2000 the checkpoint truncates up to the minimum
recovery LSN, but in this case the earliest open transaction represents
the minimum recovery LSN and hence the log cannot be truncated past that
point until those open transactions are complete. (In fact, I just
found the BOL page
<http://msdn.microsoft.com/library/e...ar_da2_8y3y.asp>
that confirms the checkpoint process is responsible for truncating log
records before the MinLSN when the DB is in SIMPLE recovery mode and it
also confirms what I'm trying to say in the "Long-Running Transaction"
section.) And so, while the checkpoint still occurs and flushes all
dirty pages from memory to disk, as far as the size of the physical log
goes, the checkpoint effectively does nothing. I wasn't focused on
memory to disk operations but rather on log truncation operations.
I stand corrected in saying the checkpoint doesn't occur. My point was
that the open transaction would prevent the log from getting truncated
and therefore increased the likelihood of the log needing an autogrow
operation, but you're right (as always) - the checkpoint still occurs.
(I guess I really should have said "thereby preventing the checkpoint
from /truncating the physical log/, because the server can't /truncate
the log record associated with/ an open transaction".)
*mike hodgson*
http://sqlnerd.blogspot.com
Kalen Delaney wrote:
> large when there is some long running transaction (thereby preventing
> the checkpoint from occurring, because the server can't flush an open
> transaction)<<
> I'm not sure exactly what you mean saying SQL Server can't flush an
> open transaction. It's true that the log space can't be reused, but
> that has nothing to do with checkpoint. Checkpoint happens at regular
> intervals, as you suggest, but it will write ALL dirty pages to disk,
> even those that are part of an uncommitted transaction.
> The log space can't be reused, so the log can grow quite large, but
> the checkpoints DO occur.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> www.solidqualitylearning.com <http://www.solidqualitylearning.com>
>
> "Mike Hodgson" <e1minst3r@.gmail.com <mailto:e1minst3r@.gmail.com>>
> wrote in message news:%23NPOQWGKGHA.668@.TK2MSFTNGP11.phx.gbl...
> Well, there's no harm in forcing checkpoints in between batches.
> I think the recommendation comes from the problems around long
> running transactions and large data modifications.
> Even in SIMPLE recovery mode the transaction log can grow very
> large when there is some long running transaction (thereby
> preventing the checkpoint from occurring, because the server can't
> flush an open transaction) and it's making lots of changes
> (thereby producing many log records). By breaking up the single
> big transaction into many smaller batches, that gives the server a
> chance to checkpoint in between batches thereby keeping the
> transaction log under control (and not locking out other users for
> long periods of time).
> The server will do automatic checkpoints based on a formula (it's
> not just every x seconds). It's different depending on the
> recovery mode. In simple recovery mode the server will do an
> automatic checkpoint when the log becomes 70% full or the number
> of log records is more than what SQL Server estimates it can get
> through in the recovery interval period (which ever comes
> sooner). So it's possible that the log is not quite full enough
> to do an auto checkpoint at the time you start the next batch. In
> which case the log will then continue to be filled and quite
> possibly have to do an autogrow operation (at which time the 70%
> full mark is even bigger). So there's no harm in doing a manual
> checkpoint in between batches and possible benefit.
> Personally, when I have to do this kind of stuff I always do
> manual checkpoints between batches (although I do it mostly on DBs
> in full recovery mode that have their logs backed up pretty
> regularly - like every 15 minutes for example - so it's slightly
> different, but the same concept).
> --
> *mike hodgson*
> http://sqlnerd.blogspot.com
>
> AlexM wrote:
>

CHECKPOINT

wonder if data modified in the buffer data cache
are written to disk in the database file only at the end of the transaction
(commit/rollback) or if portion are written at each checkpoint ?
and next eventually rollback
example:
checkpoint1 checkpoint2 checkpoint3
T1 --!--!--!--commit
does data modified by T1 are partially written to disk at each checkpoint
or only when it is committed ?
In the doc i read
"A SQL Server 2000 checkpoint performs these processes in the current
database:
. Writes to the log file a record marking the start of the checkpoint.
...
Writes to disk all dirty log and data pages."
AT
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/2003When you issue a COMMIT, the log buffer is flushed and this guarantees
modified data are permanently persisted. The associated data pages may or
may not have been written to disk at the time of the commit because these
are written asynchronously by worker threads, the lazy writer and the
checkpoint process. A checkpoint writes all dirty pages to disk so, in your
example, any data modified by T1 is written during each of the 3
checkpoints.
If the server were to crash immediately after the commit in your example,
SQL Server would start forward recovery from the log at checkpoint 3 until
the end of the log was reached and them rollback any uncommitted
transactions. The end result is that the data modified by T1 after the last
checkpoint would be in the database and no committed data are lost.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Alan" <t@.t.fr> wrote in message
news:3fe26d7c$0$22334$626a54ce@.news.free.fr...
> wonder if data modified in the buffer data cache
> are written to disk in the database file only at the end of the
transaction
> (commit/rollback) or if portion are written at each checkpoint ?
> and next eventually rollback
> example:
>
> checkpoint1 checkpoint2 checkpoint3
> T1 --!--!--!--commit
>
> does data modified by T1 are partially written to disk at each checkpoint
> or only when it is committed ?
>
> In the doc i read
> "A SQL Server 2000 checkpoint performs these processes in the current
> database:
> . Writes to the log file a record marking the start of the checkpoint.
> ...
> Writes to disk all dirty log and data pages."
>
> AT
>
> --
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/2003
>|||Alan
You also posted this in .setup, where I provided an answer, although not
quite as detailed as Dan's.
In the future, please do not post the same question to multiple groups, in
order to only have one thread of responses to follow,
and so people who see your question will know it has been aswered and won't
waste time answering it again.
One comment to Dan... you say that 'any data modified by T1 is written
during EACH of the the 3 checkpoints'. This is not true.
Once the data is written at the first checkpoint, it is no longer dirty, and
will not be written again at subsequent checkpoints. As you say,
only the dirty data is written to disk, but the process of writing to disk
during checkpoint makes that data no longer dirty.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:eypIt4exDHA.4060@.TK2MSFTNGP11.phx.gbl...
> When you issue a COMMIT, the log buffer is flushed and this guarantees
> modified data are permanently persisted. The associated data pages may or
> may not have been written to disk at the time of the commit because these
> are written asynchronously by worker threads, the lazy writer and the
> checkpoint process. A checkpoint writes all dirty pages to disk so, in
your
> example, any data modified by T1 is written during each of the 3
> checkpoints.
> If the server were to crash immediately after the commit in your example,
> SQL Server would start forward recovery from the log at checkpoint 3 until
> the end of the log was reached and them rollback any uncommitted
> transactions. The end result is that the data modified by T1 after the
last
> checkpoint would be in the database and no committed data are lost.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
>
> "Alan" <t@.t.fr> wrote in message
> news:3fe26d7c$0$22334$626a54ce@.news.free.fr...
> > wonder if data modified in the buffer data cache
> > are written to disk in the database file only at the end of the
> transaction
> > (commit/rollback) or if portion are written at each checkpoint ?
> > and next eventually rollback
> >
> > example:
> >
> >
> > checkpoint1 checkpoint2 checkpoint3
> >
> > T1 --!--!--!--commit
> >
> >
> >
> > does data modified by T1 are partially written to disk at each
checkpoint
> > or only when it is committed ?
> >
> >
> > In the doc i read
> > "A SQL Server 2000 checkpoint performs these processes in the current
> > database:
> > . Writes to the log file a record marking the start of the checkpoint.
> > ...
> >
> > Writes to disk all dirty log and data pages."
> >
> >
> >
> > AT
> >
> >
> >
> > --
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/2003
> >
> >
>|||> Once the data is written at the first checkpoint, it is no longer dirty,
and
> will not be written again at subsequent checkpoints. As you say,
> only the dirty data is written to disk, but the process of writing to disk
> during checkpoint makes that data no longer dirty.
Thanks for the clarification, Kalen. I should have made that point clearer
in my response.
--
Dan Guzman
SQL Server MVP
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%239BALRfxDHA.2064@.TK2MSFTNGP10.phx.gbl...
> Alan
> You also posted this in .setup, where I provided an answer, although not
> quite as detailed as Dan's.
> In the future, please do not post the same question to multiple groups, in
> order to only have one thread of responses to follow,
> and so people who see your question will know it has been aswered and
won't
> waste time answering it again.
> One comment to Dan... you say that 'any data modified by T1 is written
> during EACH of the the 3 checkpoints'. This is not true.
> Once the data is written at the first checkpoint, it is no longer dirty,
and
> will not be written again at subsequent checkpoints. As you say,
> only the dirty data is written to disk, but the process of writing to disk
> during checkpoint makes that data no longer dirty.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:eypIt4exDHA.4060@.TK2MSFTNGP11.phx.gbl...
> > When you issue a COMMIT, the log buffer is flushed and this guarantees
> > modified data are permanently persisted. The associated data pages may
or
> > may not have been written to disk at the time of the commit because
these
> > are written asynchronously by worker threads, the lazy writer and the
> > checkpoint process. A checkpoint writes all dirty pages to disk so, in
> your
> > example, any data modified by T1 is written during each of the 3
> > checkpoints.
> >
> > If the server were to crash immediately after the commit in your
example,
> > SQL Server would start forward recovery from the log at checkpoint 3
until
> > the end of the log was reached and them rollback any uncommitted
> > transactions. The end result is that the data modified by T1 after the
> last
> > checkpoint would be in the database and no committed data are lost.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> >
> > "Alan" <t@.t.fr> wrote in message
> > news:3fe26d7c$0$22334$626a54ce@.news.free.fr...
> > > wonder if data modified in the buffer data cache
> > > are written to disk in the database file only at the end of the
> > transaction
> > > (commit/rollback) or if portion are written at each checkpoint ?
> > > and next eventually rollback
> > >
> > > example:
> > >
> > >
> > > checkpoint1 checkpoint2 checkpoint3
> > >
> > > T1 --!--!--!--commit
> > >
> > >
> > >
> > > does data modified by T1 are partially written to disk at each
> checkpoint
> > > or only when it is committed ?
> > >
> > >
> > > In the doc i read
> > > "A SQL Server 2000 checkpoint performs these processes in the current
> > > database:
> > > . Writes to the log file a record marking the start of the checkpoint.
> > > ...
> > >
> > > Writes to disk all dirty log and data pages."
> > >
> > >
> > >
> > > AT
> > >
> > >
> > >
> > > --
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/2003
> > >
> > >
> >
> >
>