views:

533

answers:

3

Has anyone experienced issues with Java's default garbage collector while running apps on VmWare instances?

I am experiencing issues where full garbage collections are not running as often as I would expect and am curious if the VmWare variable has anything to do with it.

+1  A: 

In general, the garbage collector will only run a full GC when it really needs to. The reason is that it takes a lot of time. It will try to do more smaller GCs that take a lot less time. Fo the most part, this seems to be a good strategy.

There are some extra GC flags you can add to the VM if you want to try to tweek things. See this Addtionally you probably want to make sure you're running the server vm and not the client vm.

I guess the real question is what you're trying to acheive. If you're running out of memory its probably not because of the GC. Its probably because of Memory leaks, and yes you can create them in memory managed environments. They are just a little different.

Steve g
A: 

Haven't seen this myself, but depending on which version of VMware you're running, and your type of processor, the virtual machine clock may run significantly faster (or slower) than real-time, which can of course impact the interval garbage collection runs at.

For a high-level overview of timekeeping issues, along with suggestions on how to keep VM time as close to real time as possible, see the VMware paper Timekeeping in VMware Virtual Machines.

mdb
+1  A: 

I haven't noticed any obvious issues with the garbage collection in Java on a VmWare instance. I would recommend that you profile your application with a good profiler like the Netbeans 6 profiler, or YourKit to make sure you don't have any memory leaks. We haven't needed to worry about the garbage collection so much once we eliminated the leaks we had. Some garbage collectors are dependent on CPU usage I believe. At any rate, you can read about tuning the garbage collection for Java 6 here. Similar documents exist for older VM versions.

Jay R.