Showing posts with label across. Show all posts
Showing posts with label across. Show all posts

Friday, March 23, 2012

Performance problems with Nested SCOPE statements

I'm hoping someone has run across this particular issue and/or has identified some acceptable alternatives:

In using some scope statements to alter the behavior for certain measures, I've determined that when scope statements are nested, they will impact performance dramtically. For example

Scope [Measures].[myMeasure];
Scope Leaves( [Periods] ); -- Approx 100 members
Scope Leaves( [Markets] ); -- Approx 1500 members
This = { some simple calculation }
End scope;
End scope;
End scope;

NB. A 4th dimension, Products has about 450,000 members

At connect time, this statement is re-evaluated. The result is a long connect time. If the scope statement is removed for either Periods of Markets, the connection is immeadiate, but of course the results are wrong. Order of the scope statements doesn't affect the outcome (the [Measure] scope must be first).

I understand the difference in scale (100 or 1500 vs 150,000) but so far, the results seem to be out of line with reasonable expectations. (< 1 second vs ~65 seconds).

NB. The techqiue, causes the calculation to be evaluated at the product level, then SUM'ed over the Periods and Markets. All levels of Product aggregation use / evaluate the same calculation.

Thoughts & suggestions?

It probably depends on what is in your {some simple calculation}. There may be an alternative approach which would be faster, but it's impossible to say without more details. I don't think its the nesting of scopes that is the issue, it's more related to the size of the sub cube over which you are performing the assignment.

The same thing could be expressed as a single scope statement, but I would not expect this to change the performance at all.

Scope (Leaves([Periods]) * Leaves([Markets]));

([Measures].[myMeasure]) = "some simple calculation";

End Scope;

|||

Thanks for your feedback.

First, you're right that changing the "form" of the scope statements doesn't change the performance characteritics. (Already tried that). Indeed, the problem seems to the the size / scope of the sub cube being accessed.

The performance characteritics is indeed linked to the complexity of the calculation. For example, if I use this = 1; (the simplest possible expression), the connect returns immeadiately.

In this case, my target expression is:

this = Iif( [myMeasure], 1, null)

Essentually, this "resets" the expression to 1, for every level of the product attributes / hierarchies, then aggregates the result within stores and periods.

My basic problem is how to stop this calculation from occuring "during the connect" and instead have it invoked / calculated when the measure is actually used (when I'm willing to take the performance hit). It's easy to see / test, since in VS, I simply browse the cube and reconnect and watch Task Manager on the server. (It jumps to 100% for 60 seconds or so).

NB. The server in question is a x64, 4 way, dual core Opteron (2.6 Ghz) with 20 Gig of memory, running Enterprise edition (SP2). Everything is running 64 bit code.

|||

Found the answer, so I thought I'd post it for other people who might trip across this issue:

The problem actually exists in the front end "tool", not in Analysis Services. In this case, I was testing / debugging with Visual Studio, making small modifications to the calculation, then quickly browsing.

Turns out VS issues the following statement shortly after connecting:

select filter([Measures].members, [Measures].currentmember.member_caption = [Measures].currentmember.member_caption) on columns from [myCube]

This statement causes all of the facts to be referenced / resolved, including the measure in question. Therefore, a full bottom up calculation is performed. The query only ends after 60 seconds, because VS uses a 60 second timeout. (No wonder all of my tests came out the same!)

I can only speculate, that the reason VS does this, is to "warm" the cache, to make the subsequent queries faster. Results (and error messages) are discarded.

NB. For the record, this particular expression isn't intended to be used at the "higher levels". But, since I've isolated the key performance issue, at least alternatives can no be developed.

|||Glad you found the issue. I tend to test more complicated stuff with queries in SSMS, rather than using the browser, so I have not hit this issue myself. The OWC browser in VS does not really have a reputation for sending the "best" MDX.

Wednesday, March 7, 2012

Performance of backup across network

I am hoping someone with experience can help me with this.
I have been doing differential and log backups across a network to a device
specified by a UNC path for some time. The backup sizes have been small
enough that performance was no issue. Full backups, which total about 250
GB, I have been doing to a RAID set on the local machine, then doing a copy
(literally the command line copy from a batch script) to the same UNC path
as the diff and logs. The backup itself takes about 2.5 hours, and the copy
another 4 hours. The network is dedicated gigabit. The target machine uses
RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
sustain 30 MB/s with an app that has a clue about the network. xcopy can
sometimes hit that pace, but it and copy more typically do 17 MB/s.
Because I want to use the disk space on the SQL Server box for something
other than backups, I now want to do full backups directly across the
network, using the UNC path as for diff and log. My problem is that this is
dog slow (no insult to dogs, most of which run much faster than I,
intended). I am getting about 7 MB/s, which means the full backup is about
10 hours! Considering that the performance from copy (17 MB/s) is hardly
exemplary, I find SQL Server performance pretty embarassing.
The only useful tip I found on the net was to backup to multiple devices.
When I do this, my network throughput actually *drops* to about 6.5 MB/s
(for 2, 3 or 4 devices). The same tip suggested that multiple devices might
not help if max worker threads is not bumped up. I have not had a chance to
restart SQL Server (this is a 24x7 public database), but we typically have
100-120 connections, so I am not sure that bumping this up will do anything,
anyway.
Does anyone have experience with network backups and is getting better
throughput? I have considered forcing opportunistic locking in the
redirector, but this seems like blind hope.
Do I need to use something with a clue about networks, like the Veritas SQL
Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2 years
ago when we could not get it to work.
Help with backing up directly over the network would be much appreciated.
Comments from SQL Agent users are also welcome.
TIA
--
Scott NicholHi Scott
Have you looked at SQL Litespeed? It's all about optimising backup
performance.
http://www.imceda.com/LiteSpeed_Description.htm
Regards,
Greg Linwood
SQL Server MVP
"Scott Nichol" <reply_to_newsgroup@.scottnichol.com> wrote in message
news:u%23NuPnBaEHA.3596@.tk2msftngp13.phx.gbl...
> I am hoping someone with experience can help me with this.
> I have been doing differential and log backups across a network to a
device
> specified by a UNC path for some time. The backup sizes have been small
> enough that performance was no issue. Full backups, which total about 250
> GB, I have been doing to a RAID set on the local machine, then doing a
copy
> (literally the command line copy from a batch script) to the same UNC path
> as the diff and logs. The backup itself takes about 2.5 hours, and the
copy
> another 4 hours. The network is dedicated gigabit. The target machine
uses
> RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
> sustain 30 MB/s with an app that has a clue about the network. xcopy can
> sometimes hit that pace, but it and copy more typically do 17 MB/s.
> Because I want to use the disk space on the SQL Server box for something
> other than backups, I now want to do full backups directly across the
> network, using the UNC path as for diff and log. My problem is that this
is
> dog slow (no insult to dogs, most of which run much faster than I,
> intended). I am getting about 7 MB/s, which means the full backup is
about
> 10 hours! Considering that the performance from copy (17 MB/s) is hardly
> exemplary, I find SQL Server performance pretty embarassing.
> The only useful tip I found on the net was to backup to multiple devices.
> When I do this, my network throughput actually *drops* to about 6.5 MB/s
> (for 2, 3 or 4 devices). The same tip suggested that multiple devices
might
> not help if max worker threads is not bumped up. I have not had a chance
to
> restart SQL Server (this is a 24x7 public database), but we typically have
> 100-120 connections, so I am not sure that bumping this up will do
anything,
> anyway.
> Does anyone have experience with network backups and is getting better
> throughput? I have considered forcing opportunistic locking in the
> redirector, but this seems like blind hope.
> Do I need to use something with a clue about networks, like the Veritas
SQL
> Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2
years
> ago when we could not get it to work.
> Help with backing up directly over the network would be much appreciated.
> Comments from SQL Agent users are also welcome.
> TIA
> --
> Scott Nichol
>

Performance of backup across network

I am hoping someone with experience can help me with this.
I have been doing differential and log backups across a network to a device
specified by a UNC path for some time. The backup sizes have been small
enough that performance was no issue. Full backups, which total about 250
GB, I have been doing to a RAID set on the local machine, then doing a copy
(literally the command line copy from a batch script) to the same UNC path
as the diff and logs. The backup itself takes about 2.5 hours, and the copy
another 4 hours. The network is dedicated gigabit. The target machine uses
RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
sustain 30 MB/s with an app that has a clue about the network. xcopy can
sometimes hit that pace, but it and copy more typically do 17 MB/s.
Because I want to use the disk space on the SQL Server box for something
other than backups, I now want to do full backups directly across the
network, using the UNC path as for diff and log. My problem is that this is
dog slow (no insult to dogs, most of which run much faster than I,
intended). I am getting about 7 MB/s, which means the full backup is about
10 hours! Considering that the performance from copy (17 MB/s) is hardly
exemplary, I find SQL Server performance pretty embarassing.
The only useful tip I found on the net was to backup to multiple devices.
When I do this, my network throughput actually *drops* to about 6.5 MB/s
(for 2, 3 or 4 devices). The same tip suggested that multiple devices might
not help if max worker threads is not bumped up. I have not had a chance to
restart SQL Server (this is a 24x7 public database), but we typically have
100-120 connections, so I am not sure that bumping this up will do anything,
anyway.
Does anyone have experience with network backups and is getting better
throughput? I have considered forcing opportunistic locking in the
redirector, but this seems like blind hope.
Do I need to use something with a clue about networks, like the Veritas SQL
Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2 years
ago when we could not get it to work.
Help with backing up directly over the network would be much appreciated.
Comments from SQL Agent users are also welcome.
TIA
Scott Nichol
Hi Scott
Have you looked at SQL Litespeed? It's all about optimising backup
performance.
http://www.imceda.com/LiteSpeed_Description.htm
Regards,
Greg Linwood
SQL Server MVP
"Scott Nichol" <reply_to_newsgroup@.scottnichol.com> wrote in message
news:u%23NuPnBaEHA.3596@.tk2msftngp13.phx.gbl...
> I am hoping someone with experience can help me with this.
> I have been doing differential and log backups across a network to a
device
> specified by a UNC path for some time. The backup sizes have been small
> enough that performance was no issue. Full backups, which total about 250
> GB, I have been doing to a RAID set on the local machine, then doing a
copy
> (literally the command line copy from a batch script) to the same UNC path
> as the diff and logs. The backup itself takes about 2.5 hours, and the
copy
> another 4 hours. The network is dedicated gigabit. The target machine
uses
> RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
> sustain 30 MB/s with an app that has a clue about the network. xcopy can
> sometimes hit that pace, but it and copy more typically do 17 MB/s.
> Because I want to use the disk space on the SQL Server box for something
> other than backups, I now want to do full backups directly across the
> network, using the UNC path as for diff and log. My problem is that this
is
> dog slow (no insult to dogs, most of which run much faster than I,
> intended). I am getting about 7 MB/s, which means the full backup is
about
> 10 hours! Considering that the performance from copy (17 MB/s) is hardly
> exemplary, I find SQL Server performance pretty embarassing.
> The only useful tip I found on the net was to backup to multiple devices.
> When I do this, my network throughput actually *drops* to about 6.5 MB/s
> (for 2, 3 or 4 devices). The same tip suggested that multiple devices
might
> not help if max worker threads is not bumped up. I have not had a chance
to
> restart SQL Server (this is a 24x7 public database), but we typically have
> 100-120 connections, so I am not sure that bumping this up will do
anything,
> anyway.
> Does anyone have experience with network backups and is getting better
> throughput? I have considered forcing opportunistic locking in the
> redirector, but this seems like blind hope.
> Do I need to use something with a clue about networks, like the Veritas
SQL
> Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2
years
> ago when we could not get it to work.
> Help with backing up directly over the network would be much appreciated.
> Comments from SQL Agent users are also welcome.
> TIA
> --
> Scott Nichol
>

Performance of backup across network

I am hoping someone with experience can help me with this.
I have been doing differential and log backups across a network to a device
specified by a UNC path for some time. The backup sizes have been small
enough that performance was no issue. Full backups, which total about 250
GB, I have been doing to a RAID set on the local machine, then doing a copy
(literally the command line copy from a batch script) to the same UNC path
as the diff and logs. The backup itself takes about 2.5 hours, and the copy
another 4 hours. The network is dedicated gigabit. The target machine uses
RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
sustain 30 MB/s with an app that has a clue about the network. xcopy can
sometimes hit that pace, but it and copy more typically do 17 MB/s.
Because I want to use the disk space on the SQL Server box for something
other than backups, I now want to do full backups directly across the
network, using the UNC path as for diff and log. My problem is that this is
dog slow (no insult to dogs, most of which run much faster than I,
intended). I am getting about 7 MB/s, which means the full backup is about
10 hours! Considering that the performance from copy (17 MB/s) is hardly
exemplary, I find SQL Server performance pretty embarassing.
The only useful tip I found on the net was to backup to multiple devices.
When I do this, my network throughput actually *drops* to about 6.5 MB/s
(for 2, 3 or 4 devices). The same tip suggested that multiple devices might
not help if max worker threads is not bumped up. I have not had a chance to
restart SQL Server (this is a 24x7 public database), but we typically have
100-120 connections, so I am not sure that bumping this up will do anything,
anyway.
Does anyone have experience with network backups and is getting better
throughput? I have considered forcing opportunistic locking in the
redirector, but this seems like blind hope.
Do I need to use something with a clue about networks, like the Veritas SQL
Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2 years
ago when we could not get it to work.
Help with backing up directly over the network would be much appreciated.
Comments from SQL Agent users are also welcome.
TIA
--
Scott NicholHi Scott
Have you looked at SQL Litespeed? It's all about optimising backup
performance.
http://www.imceda.com/LiteSpeed_Description.htm
Regards,
Greg Linwood
SQL Server MVP
"Scott Nichol" <reply_to_newsgroup@.scottnichol.com> wrote in message
news:u%23NuPnBaEHA.3596@.tk2msftngp13.phx.gbl...
> I am hoping someone with experience can help me with this.
> I have been doing differential and log backups across a network to a
device
> specified by a UNC path for some time. The backup sizes have been small
> enough that performance was no issue. Full backups, which total about 250
> GB, I have been doing to a RAID set on the local machine, then doing a
copy
> (literally the command line copy from a batch script) to the same UNC path
> as the diff and logs. The backup itself takes about 2.5 hours, and the
copy
> another 4 hours. The network is dedicated gigabit. The target machine
uses
> RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
> sustain 30 MB/s with an app that has a clue about the network. xcopy can
> sometimes hit that pace, but it and copy more typically do 17 MB/s.
> Because I want to use the disk space on the SQL Server box for something
> other than backups, I now want to do full backups directly across the
> network, using the UNC path as for diff and log. My problem is that this
is
> dog slow (no insult to dogs, most of which run much faster than I,
> intended). I am getting about 7 MB/s, which means the full backup is
about
> 10 hours! Considering that the performance from copy (17 MB/s) is hardly
> exemplary, I find SQL Server performance pretty embarassing.
> The only useful tip I found on the net was to backup to multiple devices.
> When I do this, my network throughput actually *drops* to about 6.5 MB/s
> (for 2, 3 or 4 devices). The same tip suggested that multiple devices
might
> not help if max worker threads is not bumped up. I have not had a chance
to
> restart SQL Server (this is a 24x7 public database), but we typically have
> 100-120 connections, so I am not sure that bumping this up will do
anything,
> anyway.
> Does anyone have experience with network backups and is getting better
> throughput? I have considered forcing opportunistic locking in the
> redirector, but this seems like blind hope.
> Do I need to use something with a clue about networks, like the Veritas
SQL
> Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2
years
> ago when we could not get it to work.
> Help with backing up directly over the network would be much appreciated.
> Comments from SQL Agent users are also welcome.
> TIA
> --
> Scott Nichol
>