com.sun.grizzly.test.cachetest
Class ConcurrentCacheTester

java.lang.Object
  extended by com.sun.grizzly.test.cachetest.ConcurrentCacheTester

public class ConcurrentCacheTester
extends Object

Tests the throughput for object instance caching in a concurrent environment.
Please provide feedback, opinions.

Only test the situation where the threads do the operation of interest and no work inbetween.
Reson is that the basic mechanism we want to test is how the caching algoritm
and new Instance with its GC compares during maximal load.
its only then their strengths and weaknesses really shows,
its also worst cases that often are of interest for real life designs.
the differences between caching or new Instance converges to 0 when the workinbetween increaes,
making it a very specific result.


TODO add long lived Objects test, that will move Objects into oldgen

-showversion -server -Xms512m -Xmx512m -XX:+AggressiveOpts -XX:+UseParallelOldGC -XX:+UseParallelGC

Author:
Gustav Trede

Field Summary
protected  double calibrationTargetError
           
protected  ThreadPoolExecutor threadPool
           
 
Constructor Summary
ConcurrentCacheTester()
           
 
Method Summary
protected  void calcThreadOverhead(TestAndResult test)
           
protected  void calibrate(TestAndResult test)
           
protected  void calibrate0(TestAndResult test, int targetsec, int calibsec)
           
 void calibrateAndExecuteTest(TestAndResult test)
          calibrates and runs a single test.
protected  double executeTest(TestAndResult test)
           
static void main(String[] argv)
          performs a standard set of long running tests.
 List<TestAndResult> performRangeOfTests(int minutesPerTest, InstanceFactory factory)
           
 List<TestAndResult> performRangeOfTests(int minutesPerTest, InstanceFactory objfactory, Queue[] cacheImplementations, Integer[] threadcounts, boolean calibrationInfoToSystemErr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

threadPool

protected final ThreadPoolExecutor threadPool

calibrationTargetError

protected final double calibrationTargetError
See Also:
Constant Field Values
Constructor Detail

ConcurrentCacheTester

public ConcurrentCacheTester()
Method Detail

main

public static void main(String[] argv)
                 throws Throwable
performs a standard set of long running tests.

Parameters:
args - used for minutesPerTest, default is 3
Throws:
Throwable

performRangeOfTests

public List<TestAndResult> performRangeOfTests(int minutesPerTest,
                                               InstanceFactory factory)
                                        throws Throwable
Parameters:
factory - InstanceFactory
minutesPerTest -
Returns:
ListList TestAndResult
Throws:
Throwable

performRangeOfTests

public List<TestAndResult> performRangeOfTests(int minutesPerTest,
                                               InstanceFactory objfactory,
                                               Queue[] cacheImplementations,
                                               Integer[] threadcounts,
                                               boolean calibrationInfoToSystemErr)
                                        throws Throwable
Parameters:
minutesPerTest - int
objfactory - InstanceFactory
cacheImplementations - instances of Queue
threadcounts - int
calibrationInfoToSystemErr - boolean
Returns:
ListList TestAndResult
Throws:
Throwable

calibrateAndExecuteTest

public void calibrateAndExecuteTest(TestAndResult test)
                             throws Throwable
calibrates and runs a single test.

Parameters:
test - TestAndResult
Throws:
Throwable

calibrate

protected void calibrate(TestAndResult test)
                  throws Throwable
Throws:
Throwable

calcThreadOverhead

protected void calcThreadOverhead(TestAndResult test)
                           throws Throwable
Throws:
Throwable

calibrate0

protected void calibrate0(TestAndResult test,
                          int targetsec,
                          int calibsec)
                   throws Throwable
Throws:
Throwable

executeTest

protected double executeTest(TestAndResult test)
                      throws Throwable
Throws:
Throwable


Copyright © 2012 Oracle Corporation. All Rights Reserved.