Kieker 1.2

kieker.monitoring.writer.database
Class AsyncDbWriter

java.lang.Object
  extended by kieker.monitoring.writer.database.AsyncDbWriter
All Implemented Interfaces:
IMonitoringRecordReceiver, IMonitoringLogWriter

public final class AsyncDbWriter
extends Object
implements IMonitoringLogWriter

Stores monitoring data into a database. Warning ! This class is an academic prototype and not intended for reliability or availability critical systems. The insertMonitoringData methods are thread-save (also in combination with experimentId changes), so that they may be used by multiple threads at the same time. We have tested this in various applications, in combination with the standard mysql-Jconnector database driver. Our experience shows that it is not a major bottleneck if not too many measurement points are used (e.g., 30/second). However, there are much performance tuning possible in this class. For instance, performance optimization should be possible by using a connection pool instead of a single database connection. The current version uses prepared statements. Alternatively, it could be tuned by collecting multiple database commands before sending it to the database.

Author:
Matthias Rohr History (Build) (change the String BUILD when this file is changed): 2008/05/29: Changed vmid to vmname (defaults to hostname), which may be changed during runtime 2007/07/30: Initial Prototype

Constructor Summary
AsyncDbWriter()
           
AsyncDbWriter(String dbDriverClassname, String dbConnectionAddress, String dbTableName, boolean setInitialExperimentIdBasedOnLastId, int asyncRecordQueueSize, boolean blockOnFullQueue)
           
 
Method Summary
 String getInfoString()
          Returns a human-readable information string about the writer's configuration and state.
 Vector<AbstractWorkerThread> getWorkers()
          Returns a vector of workers, or null if none.
 boolean init()
          Returns false if an error occurs.
 boolean init(String initString)
          Initialize instance from passed initialization string which is typically a list of separated parameter/values pairs.
 boolean newMonitoringRecord(IMonitoringRecord monitoringRecord)
          This method is not synchronized, in contrast to the insert method of the Dbconnector.java.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncDbWriter

public AsyncDbWriter()

AsyncDbWriter

public AsyncDbWriter(String dbDriverClassname,
                     String dbConnectionAddress,
                     String dbTableName,
                     boolean setInitialExperimentIdBasedOnLastId,
                     int asyncRecordQueueSize,
                     boolean blockOnFullQueue)
Method Detail

init

public boolean init(String initString)
Description copied from interface: IMonitoringLogWriter
Initialize instance from passed initialization string which is typically a list of separated parameter/values pairs. The implementing class AbstractMonitoringLogWriter includes convenient methods to extract configuration values from an initString.

Specified by:
init in interface IMonitoringLogWriter
Parameters:
initString - the initialization string
Returns:
true iff the initialiation was successful

getWorkers

public Vector<AbstractWorkerThread> getWorkers()
Description copied from interface: IMonitoringLogWriter
Returns a vector of workers, or null if none.

Specified by:
getWorkers in interface IMonitoringLogWriter

init

public boolean init()
Returns false if an error occurs. Errors are printed to stdout (e.g., App-server logfiles), even if debug = false.


newMonitoringRecord

public boolean newMonitoringRecord(IMonitoringRecord monitoringRecord)
This method is not synchronized, in contrast to the insert method of the Dbconnector.java. It uses several dbconnections in parallel using the consumer, producer pattern.

Specified by:
newMonitoringRecord in interface IMonitoringRecordReceiver
Parameters:
monitoringRecord - the record.
Returns:
true on success; false in case of an error.

getInfoString

public String getInfoString()
Description copied from interface: IMonitoringLogWriter
Returns a human-readable information string about the writer's configuration and state.

Specified by:
getInfoString in interface IMonitoringLogWriter
Returns:
the information string.

Kieker 1.2

Copyright 2010 the Kieker Project, http://kieker.sourceforge.net