VMware {code} Community
danielh
Contributor
Contributor

VI SDK, Heap overflow, virtualCenter.getService().retrieveProperties(...)

Hi,

we've developed a tool which automates scenarious over the vSphere Web Service SDK on a Virtual Center with 1.150 vms. In our tool we've a mechanism which polls on demand all vms from a Virtual Center. While this mechanis takes very long (~9 minutes, ok we're talking about 1150 vms g) I thought this mechanism could be improved by reducing virtual center calls. Based on this idea I build a query which requests a complete list of vms from the virtual center by only one call:

###########################################################################

//VM Collector for vSphere:

public final static String [] VC_INFO_PATH = new String { "summary.vm", "config.annotation", "config.name", "config.guestFullName", "config.extraConfig", "config.template", "config.guestId", "config.hardware", "config.uuid", "datastore", "guest.disk", "guest.net", "parent", "resourcePool",

"runtime.powerState", "runtime.maxCpuUsage", "snapshot", "summary.config.memorySizeMB", "summary.guest.hostName", "summary.quickStats.guestMemoryUsage"};

//vSphere call

ObjectContent[] objectContentArray = virtualCenter.getService().retrieveProperties(this.virtualCenter.getPropertyCollector(), propertyFilterSpecArray);

###########################################################################

Unfortunately I'll get right in the vSphere call an error "java.lang.OutOfMemoryError: Java heap space" - I assume because of the large return value based on the query.

It is possible to avoid this message by increasing heap space?

Which heap space do I have to increase, JVM Xmx, MaxPermSize?

Thx + kind regards

Daniel

See the full stack trace in the attachment.

0 Kudos
3 Replies
danielh
Contributor
Contributor

It seems this behaviour is a bug Smiley Sad

0 Kudos
Steve_Jin
Expert
Expert

You may want to try the open source vi java api. I wrote a new Web Service engine to replace AXIS there. Good luck!

Steve JIN

Author of VMware VI and vSphere SDK (Prentice Hall)

Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples)

Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API)

Twitter: @sjin2008

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
danielh
Contributor
Contributor

Thx,

I solved this issue by increasing heap, I played a little bit with the max values, minimal heap configuration is near:

-Xms2m -Xmx256m -XX:PermSize=32m -XX:MaxPermSize=96m

kind regards

Daniel

0 Kudos