VMware Cloud Community
vROGeek
Contributor
Contributor

Optimizing results from PS actions

Hey guys,

I am wanting to know if this is a normal occurrence or if i need to change my strategy, since this is the first time i have done this any advice is appreciated. I know the speed wont be nearly as fast as running straight JavaScript but there are somethings i may want to select a choice based on running a powercli command. When i start a workflow with something simple as locating a cluster and choosing a host based on cluster selection the presentation box and information is available almost immediately. Where if i run a single action to get-tag information for names only and send that to the presentation screen it can take around 40-60 seconds just to appear. If i had to run several actions that use this script it could be painful (this list is about 50 names long). Is this the correct method of doing things? Am i doing something wrong that would result in much quicker results? Is there a way to cache this data and have it manually pull in increments?

One thing to note is that when I run the script before conversion at least on the .getHostOutput() it appears in around 15-20 seconds to the log screen.

I know my lack of comments in the code is bad, and i have a lot of logging. Just things i am using to verify the process and it will get cleaned up a lot before use.

Thanks guys!

0 Kudos
2 Replies
Mnemonic
Enthusiast
Enthusiast

Just to clarify what you are trying to do.

Are you trying to pull tags from vCenter and use them as an array of inputs for user presentation?

/Brian

0 Kudos
vROGeek
Contributor
Contributor

Yeah. My ultimate goal is to have the user select all the settings it needs during the presentation by use of selecting items in a array. With pulling the tags i am trying to capture all the data into an array than convert it to a string so that when the user gets to that section of the presentation they have the option of the whole list (i would rather have them put the name in and have it come back with that name if it exists - i dont know if this matters with pulling the data quicker)  than pass that choice back into the set tag PS script.

While i have the tag collection setup I am also using this as an example for finding a better way of pulling data such as this, just in case i need to pull more PS data back into a presentation. Some of the data needs to be real time but others can be cached somewhere and updated every few hours or so  ( i guess with the caching i can send it as a csv than have JS pull the data in).

I guess overall i am wanting to see if pulling real time data can be optimized enough to where when the user loads the presentation screen or selects an option that prompts the action quicker than 40ish seconds per selected question.

Since this is the first time i have done this i just wanted to make sure there wasnt some trick to get the data i want quicker if i have to execute a PS action.

Thanks for your help!

0 Kudos