5 Replies Latest reply on Jul 20, 2017 10:49 AM by Michael Halpin

    Orion SDK Performance Tips


      We just got a developer that will be working to develop helpful programs to aid us in administering our Orion environment.  For now though we use a lot of PowerShell scripts that I write to automate many tasks, usually those tasks are automating custom properties.  One issue I run into often is my PowerShell scripts take a long time to run.  I've gotten better at improving my code to loop through items less often and things like that, but I'm looking for some additional tips.


      - When I'm invoking verbs, specifically the Set-SwisObject verb, am I able to send multiple objects to this, or do I need to do one object at a time?  I know I can send multiple properties for a single node to it, but can I just send a whole hash table full of Node Custom Property URI's, Properties, and their desired values at it, or is looping through each node necessary?  If so how should this look?


      - Same question with other verbs?


      - Our Developer will be re-creating my PowerShell scripts into more robust .Net Programs using C# mostly.  Are there any general performance tips for interacting with the API via C#?


      - Any general performance tips for the API in general or just the API via PowerShell?


      Thanks for any assistance you may be able to offer.

        • Re: Orion SDK Performance Tips
          Michael Halpin

          Interesting question xtraspecialj! It's actually something I was thinking of doing a post on at some stage (my plan is to do some tests with a few different techniques, and then compare the efficiency of the approaches).


          If we consider the 2 approaches below for example, I know the second approach is faster than the first, because whereas the first it's handling them one at a time, in the second SWIS is handling a lot of hte overhead directly. It's not X times faster (because of auditing, etc), but still should be faster than the first. (As in the cmdlets were designed to accept URIs from the pipeline, so should be faster)


          1. 1.$uris |foreach { Set-SwisObject $swis $_ -Properties @{UnmanageFrom=$start;UnmanageUntil=$end} }
          2. 2.$uris | Set-SwisObject $swis -Properties @{UnmanageFrom=$start;UnmanageUntil=$end}


          Same should apply for remove-swisobject. As far as I'm aware C# doesn't have pipleline equivalance, so that's another hurdle to jump


          tdanner is obviously the guru on this however, I may be wrong on the above.