System.setProperty("tangosol.coherence.cacheconfig", "tx-lite-test-cache-config.xml");
System.setProperty("tangosol.coherence.distributed.localstorage", "false");
try {
final NamedCache cache = CacheFactory.getCache("t-objects");
final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator();
// final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator(100);
// final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator(400);
// cache.addIndex(new ReflectionExtractor("getA0"), false, null);
// cache.addIndex(new ReflectionExtractor("getAs"), false, null);
// System.out.println(CacheFactory.getClusterConfig().toString());
// long objectCount = 1000000;
long objectCount = 100000;
// long objectCount = 200000;
// long objectCount = 10000;
long rangeStart = 1000000;
long rangeFinish = 1000000 + objectCount;
println("Cache size: " + cache.size());
println("Loading " + objectCount + " objects ...");
loadObjects(cache, generator, rangeStart, rangeFinish);
println("Loaded " + cache.size() + " objects");
println("Key binary size: " + ExternalizableHelper.toBinary(generator.generate(1, 2).keySet().iterator().next()).length());
println("Value binary size: " + ExternalizableHelper.toBinary(generator.generate(1, 2).values().iterator().next()).length());
System.gc();
println("Mem. usage " + ManagementFactory.getMemoryMXBean().getHeapMemoryUsage());