question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow performance towards vSphere/VMWare when using `kcli list ...` related cmds

See original GitHub issue

Hi @karmab,

We’ve already chatted about this on Slack. Now, I just wanted to create an issue about. To make it more official and to at some point hopefully get it fixed. If possible.

SEEING

Slow performance when listing vm’s, disks and so forth with kcli list ... related cmds. We’re talking about up to and + 1min at times.

I have access to a quite big VMWare environment and can therefore help you troubleshoot this as well as try out different approaches.

LOOKING FOR

That kcli list ... related cmds are reasonably fast. I would say 5-10 secs.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
prziborowskicommented, Mar 11, 2022

Just wanted to comment here as this was linked to the pyvmomi entry. Each time you make a “vm.<something” statement, it is making a request to the server to fetch that “<something>”.

So for example:

        yamlinfo['cpus'] = vm.config.hardware.numCPU
        yamlinfo['memory'] = vm.config.hardware.memoryMB
        yamlinfo['status'] = translation[vm.runtime.powerState]
        yamlinfo['nets'] = []
        yamlinfo['disks'] = []
        if vm.runtime.powerState == "poweredOn":
            yamlinfo['host'] = vm.runtime.host.name
            for nic in vm.guest.net:
                if 'ip' not in yamlinfo and nic.ipAddress:
                    yamlinfo['ip'] = nic.ipAddress[0]
        for entry in vm.config.extraConfig:

This will make 6 requests (vm.config 3 times, vm.runtime 2 times, vm.guest) for VM properties, and depending on the distance between client and server, it could take some time.

This is also why the find function will be much slower than the findvm function because find is fetching the ‘name’ property in a loop as individual requests and findvm is getting the name property when it collects the VM object references.

You could use the property collector’s RetrievePropertiesEx to fetch config, runtime, guest in 1 call. Similarly for list, you could collect additional properties than name to reduce roundtrips:

        vmlist = collectproperties(si, view=view, objtype=vim.VirtualMachine, pathset=['name'], includemors=True)
        for o in vmlist:
            vm = o['obj']
            if vm.summary.runtime.connectionState != 'orphaned' and not vm.config.template:
                if self.filtervms and 'plan' not in [x.key for x in vm.config.extraConfig]:
                    continue
                vms.append(self.info(o['name'], vm=vm))

2 vm.config calls and 1 vm.summary call, for each vm in the list. And then goes into the info function, which does 6 more requests.

1reaction
karmabcommented, Feb 19, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

About — Kcli 99.0 documentation
This tool is meant to ease interaction with virtualization providers: libvirt; kubevirt; ovirt; vsphere; openstack; gcp; aws; packet; ibmcloud. You can: manage ...
Read more >
Pyvmomi documentation - Para Erboristeria Ruocco
pyVmomi is the Python language binding for the Virtualization Management Object We hope to provide pyVmomi specific documentation in time but the 14...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found