previously, i ran all this stuff including the shadow trader presentation from a single instance and was getting pesky long pauses when the garbage collector ran. my observations of the task manager during these gc-pauses revealed that one of my dual cpu's was running flat-out while the other one was idle - giving the misimpression of a non-constrained cpu resource (50% idle.) research on oracle's website revealed some interesting facts about the java garbage collecter that led me to this dual- instance experiment:
- the java heap does not maintain a linked-list of free memory blocks. free memory is one contiguous block that is doled out as requested.
- the more objects in use the longer the gc takes to run. this is because there is no freelist. instead, the gc performs a tree-search of live objects, marking them as it sweeps through the list, then, infers that anything not marked as 'alive' is trash. the more live objects there are, the longer this takes.
- trash compaction is part of every gc run. again, because there is no free-list, all live objects are moved around so that the free memory is one contiguous space at the end of a gc run. this might put a write-load on the page-file but that is why i went with the solid state disk.
- the garbage collector is single threaded. no matter how many concurrent threads the application codes for, the gc is mostly a single threaded affair that puts all application threads into suspension while it runs. this explains why i see one cpu pinned-out while the other is idle.
so now, with the dual tos instances, i have two heaps and the possibility of dual garbage collection with fuller cpu utilization. each heap has fewer live objects to contend with, so the gc-pauses are much smaller - and at least i can listen to brad agunas while i am waiting.