net.sourceforge.domian.test.benchmark
Class QueenPuzzleTestRunner

java.lang.Object
  extended by net.sourceforge.domian.test.benchmark.QueenPuzzleTestRunner

public class QueenPuzzleTestRunner
extends java.lang.Object

An amusing little computing task involving (possible) vast numbers of repository inserts, updates, and search.

In detail, it consists of:

  1. Generating random chess piece constellations consisting of 8 pieces, disguised as entity objects; adding them to a repository
  2. A batch processing task, iterating through all constellations, doing a little check, with a conditional update
  3. If the repository supports asynchronous persistence, all entities are persisted
  4. A search task for all constellations solving the queen puzzle
  5. A completion control search task for all constellations not processed (should be none)

The batch processing task tries to solve the infamous "Queen Puzzle" which seeks to find all possible chess queen piece constellations where none of the queens are threatened by one of the other queens. A standard 8 x 8 chess board and 8 queen pieces are hard-coded. Possible sequences of queens are staggering 64^8 = 281.474.976.710.656 (over 280 trillions!)

The JVM flag -Xms should not be set when using this class. it seems to screw up the garbage collectioning...

Usage example:

 java net.sourceforge.domian.test.benchmark.QueenPuzzleTestRunner seq [repo type] [#executions] [#constellations]                   [#log interval]
 java net.sourceforge.domian.test.benchmark.QueenPuzzleTestRunner con [repo type] [#executions] [#constellations] [#worker threads] [#log interval]
seq means sequential execution (one thread only), and con means concurrent execution by a given number of worker threads.
The available repo types are: #executions is the number of iterating executions, always sequential.
#constellations is the number of queen puzzle constellations, and thus the total number of entities the repository is to handle.
#log interval is the number of generated/processed queen puzzle constellations between every emitted log message.

Usage example:

 java -cp ... net.sourceforge.domian.test.benchmark.QueenPuzzleTestRunner con inmemory 1 100000 4 10000
Process 100000 queen puzzle constellations, using 4 threads. Use the InMemoryRepository. Run the benchmark only once, and show status messages every for 10000 constellations.

Author:
Eirik Torske

Constructor Summary
QueenPuzzleTestRunner()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueenPuzzleTestRunner

public QueenPuzzleTestRunner()
Method Detail

main

public static void main(java.lang.String[] args)


Copyright © 2006-2010. All Rights Reserved.