Script too slow, looking for optimisation

PowerShell script exchange

Re: Script too slow, looking for optimisation

Veeam Logoby tdewin » Wed Dec 21, 2016 2:29 pm

There is no official "fixed release date". We release when we consider it is ready to run in production. But do consider this post:
vmware-vsphere-f24/esxi-and-vcenter-6-5-out-t38850.html#p216329
tdewin
Veeam Software
 
Posts: 1106
Liked: 389 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: Script too slow, looking for optimisation

Veeam Logoby Ctek » Mon Jan 30, 2017 7:51 pm

v.Eremin wrote:Currently, we're planning to provide a fix for it in Update 2.
It seems that we will be able to make it into Update 1. It's turned out the fix is not that hard to implement. Thanks.


Hi Vladimir, it appears that this issue is not fixed in 9.5 Update 1. We tested it in several DEV environment and there is no change in the behavior.

We are still running on Tom's proposed fix in this thread in the meantime, which is running very well and performance is great.

Support case : 01999855
Do you know if you have a planned private hotfix or if the fix has been pushed to Update 2?

Thanks
VMCE 9 Certified - Systems Administrator
Ctek
Service Provider
 
Posts: 42
Liked: 4 times
Joined: Wed Nov 11, 2015 3:50 pm
Location: Canada

Re: Script too slow, looking for optimisation

Veeam Logoby v.Eremin » Tue Jan 31, 2017 11:41 am

We've removed additional db call that supposedly was making cmdlet crawl. However, it's been reported by several customers including yourself, the fix does make any difference. So, we keep investigating it further. Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Script too slow, looking for optimisation

Veeam Logoby cromero » Thu Feb 09, 2017 9:17 am

Hi guys,

I'm having same issue with this line of my script (It's taking 2h after 9.5 upgrade)


Code: Select all
$vbrtasksessions = (Get-VBRBackupSession |
    Where-Object {$_.JobType -eq "Backup" -and $_.EndTime -ge (Get-Date).addhours(-$HourstoCheck)}) |
    Get-VBRTaskSession | Where-Object {$_.Status -ne "Failed"}


Do you know how can I improve it?

Thanks!
cromero
Novice
 
Posts: 9
Liked: never
Joined: Wed May 04, 2016 6:39 pm
Full Name: Carlos Romero

Re: Script too slow, looking for optimisation

Veeam Logoby v.Eremin » Thu Feb 09, 2017 11:40 am

Kindly, take a look at the workaround proposed by Tom. Based on what I know, it works significantly faster than the cmdlet in question does.

In the meantime, we're about to conduct an internal cmdlet performance review to find and address week spots.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Script too slow, looking for optimisation

Veeam Logoby cromero » Thu Feb 09, 2017 2:05 pm

Thanks!

Don't know how to exactly query the DB here. Maybe Tom can help me?

Thanks!
cromero
Novice
 
Posts: 9
Liked: never
Joined: Wed May 04, 2016 6:39 pm
Full Name: Carlos Romero

Re: Script too slow, looking for optimisation

Veeam Logoby tsightler » Fri Feb 10, 2017 4:57 pm

The code below looks quite ugly, but I believe it will give you the same result in significantly less time, however, you'll definitely want to test it for accuracy in case I missed something, but I tried to keep the overall logic exactly the same it's just using some internal functions to get around the performance issues:

Code: Select all
$vbrtasksessions =
    foreach ($bsession in ([Veeam.Backup.DBManager.CDBManager]::Instance.BackupJobsSessions.GetAll() | Where-Object {$_.JobType -eq "Backup" -and $_.EndTime -ge (Get-Date).addhours(-$HourstoCheck)}))
    {
        Get-VBRTaskSession ([Veeam.Backup.Core.CBackupSession]::Create($bsession, $null)) | Where-Object {$_.Status -ne "Failed"}
    }
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Script too slow, looking for optimisation

Veeam Logoby cromero » Mon Feb 13, 2017 12:09 pm

Thanks! but it's failing :(

Code: Select all
Exception calling "Create" with "2" argument(s): "Object reference not set to an instance of an object."
At line:4 char:9
+         Get-VBRTaskSession ([Veeam.Backup.Core.CBackupSession]::Creat ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceExceptio
cromero
Novice
 
Posts: 9
Liked: never
Joined: Wed May 04, 2016 6:39 pm
Full Name: Carlos Romero

Re: Script too slow, looking for optimisation

Veeam Logoby tsightler » Mon Feb 13, 2017 2:02 pm

My guess is this is due to the fact that the initial script I posted had a small typo. I'm not really sure how that happened as I copied and pasted the script, but regardless, it was there, so I have corrected it in the post above.

If you look in the code you posted, near the very start of the second line, the $bsession variable is misspelled as $bsessison. That's most likely causing the error. Sorry about that.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Script too slow, looking for optimisation

Veeam Logoby cromero » Mon Feb 13, 2017 3:39 pm

Thanks!!!! Didn't notice!!! :( Monday... hehe

Now it works fine!
cromero
Novice
 
Posts: 9
Liked: never
Joined: Wed May 04, 2016 6:39 pm
Full Name: Carlos Romero

Re: Script too slow, looking for optimisation

Veeam Logoby tsightler » Mon Feb 13, 2017 3:56 pm

OK, let me know what kind of speedup you see. If it's still too slow there may be other things we can do.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Script too slow, looking for optimisation

Veeam Logoby cromero » Tue Feb 14, 2017 11:15 am

tsightler wrote:OK, let me know what kind of speedup you see. If it's still too slow there may be other things we can do.


Now it's perfect! It was taking 2.30h before. Now 10 min :)
cromero
Novice
 
Posts: 9
Liked: never
Joined: Wed May 04, 2016 6:39 pm
Full Name: Carlos Romero

Re: Script too slow, looking for optimisation

Veeam Logoby v.Eremin » Mon Mar 06, 2017 12:14 pm

Update to everyone experiencing this issue. We've implemented a hot fix and started distributing among our clients.

If you'd like to try it out, create a ticket and refer to case number 02046581.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Script too slow, looking for optimisation

Veeam Logoby masonit » Thu Apr 27, 2017 7:04 am

Hi

Will permanent fix be included in 9.5 update 2?

\Masonit
masonit
Service Provider
 
Posts: 141
Liked: 10 times
Joined: Tue Oct 09, 2012 2:30 pm
Full Name: Magnus Andersson

Re: Script too slow, looking for optimisation

Veeam Logoby v.Eremin » Thu Apr 27, 2017 10:00 am

Correct.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest