Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

AbstractBundler Class Reference

#include <coherence/net/cache/AbstractBundler.hpp>

Inherits Object.

Inherited by AbstractEntryBundler, and AbstractKeyBundler.

List of all members.


Detailed Description

An abstract base for processors that implement bundling strategy.

Assume that we receive a continuous and concurrent stream of individual operations on multiple threads in parallel. Let's also assume those individual operations have relatively high latency (network or database-related) and there are functionally analogous [bulk] operations that take a collection of arguments instead of a single one without causing the latency to grow linearly, as a function of the collection size. Examples of operations and topologies that satisfy these assumptions are:

Under these assumptions, it's quite clear that the bundler could achieve a better utilization of system resources and better throughput if slightly delays the individual execution requests with a purpose of "bundling" them together and passing int32_to a corresponding bulk operation. Additionally, the "bundled" request should be triggered if a bundle reaches a "preferred bundle size" threshold, eliminating a need to wait till a bundle timeout is reached.

Note: we assume that all bundle-able operations are idempotent and could be repeated if un-bundling is necessary due to a bundled operation failure.

Author:
gg 2007.01.28

lh 2012.06.05

Since:
Coherence 12.1.2

Public Types

typedef spec::Handle Handle
 AbstractBundler Handle definition.
typedef spec::View View
 AbstractBundler View definition.
typedef spec::Holder Holder
 AbstractBundler Holder definition.
typedef this_spec::Handle Handle
 Object Handle definition.
typedef this_spec::View View
 Object View definition.
typedef this_spec::Holder Holder
 Object Holder definition.

Public Member Functions

virtual int32_t getSizeThreshold () const
 Obtain the bundle size threshold value.
virtual void setSizeThreshold (int32_t cSize)
 Specify the bundle size threshold value.
virtual int32_t getThreadThreshold () const
 Obtains the minimum number of threads that will trigger the bundler to switch from a pass through to a bundled mode.
virtual void setThreadThreshold (int32_t cThreads)
 Specify the minimum number of threads that will trigger the bundler to switch from a pass through to a bundled mode.
virtual int64_t getDelayMillis () const
 Obtain the timeout delay value.
virtual void setDelayMillis (int64_t lDelay)
 Specify the timeout delay value.
virtual bool isAllowAutoAdjust () const
 Check whether or not auto-adjustment is allowed.
virtual void setAllowAutoAdjust (bool fAutoAdjust)
 Specify whether or not auto-adjustment is allowed.
virtual void resetStatistics ()
 Reset this Bundler statistics.
virtual void adjust ()
 Adjust this Bundler's parameters according to the available statistical information.
virtual void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
out the stream used to output the description


Static Public Attributes

static const int32_t adjustment_frequency
 Frequency of the adjustment attempts.

Protected Member Functions

 AbstractBundler ()
 Construct the bundler.
virtual void updateStatistics ()
 Update the statistics for this Bundle.
virtual void init (Bundle::Handle hBundle)
 Initialize the bundler.
virtual Bundle::Handle getOpenBundle ()
 Retrieve any Bundle that is currently in the open state.
virtual Bundle::Handle instantiateBundle ()=0
 Instantiate a new Bundle object.

Protected Attributes

bool m_fFirstAdjustment
 Indicate whether this is a first time adjustment.
double m_dPreviousSizeThreshold
 The previous bundle size threshold value.
FinalHandle< Listf_hListBundle
 A pool of Bundle objects.
FinalHandle
< AtomicCounter
f_hCountThreads
 A counter for the total number of threads that have started any bundle related execution.

Classes

class  Bundle
 Bundle represents a unit of optimized execution. More...
class  Statistics
 Statistics class contains the latest bundler statistics. More...

Constructor & Destructor Documentation

AbstractBundler (  )  [protected]

Construct the bundler.

By default, the timeout delay value is set to one millisecond and the auto-adjustment feature is turned on.


Member Function Documentation

virtual int32_t getSizeThreshold (  )  const [virtual]

Obtain the bundle size threshold value.

Returns:
the bundle size threshold value expressed in the same units as the value returned by the Bundle::getBundleSize() method

virtual void setSizeThreshold ( int32_t  cSize  )  [virtual]

Specify the bundle size threshold value.

Parameters:
cSize the bundle size threshold value; must be positive value expressed in the same units as the value returned by the Bundle::getBundleSize() method

virtual int32_t getThreadThreshold (  )  const [virtual]

Obtains the minimum number of threads that will trigger the bundler to switch from a pass through to a bundled mode.

Returns:
a the number of threads threshold

virtual void setThreadThreshold ( int32_t  cThreads  )  [virtual]

Specify the minimum number of threads that will trigger the bundler to switch from a pass through to a bundled mode.

Parameters:
cThreads the number of threads threshold

virtual int64_t getDelayMillis (  )  const [virtual]

Obtain the timeout delay value.

Returns:
the timeout delay value in milliseconds

virtual void setDelayMillis ( int64_t  lDelay  )  [virtual]

Specify the timeout delay value.

Parameters:
lDelay the timeout delay value in milliseconds

virtual bool isAllowAutoAdjust (  )  const [virtual]

Check whether or not auto-adjustment is allowed.

Returns:
true if auto-adjustment is allowed

virtual void setAllowAutoAdjust ( bool  fAutoAdjust  )  [virtual]

Specify whether or not auto-adjustment is allowed.

Parameters:
fAutoAdjust true if auto-adjustment should be allowed; false otherwise

virtual void init ( Bundle::Handle  hBundle  )  [protected, virtual]

Initialize the bundler.

Parameters:
hBundle specifies the bundle for this bundler

virtual Bundle::Handle getOpenBundle (  )  [protected, virtual]

Retrieve any Bundle that is currently in the open state.

This method does not assume any external synchronization and as a result, a caller must double check the returned bundle open state (after synchronizing on it).

Returns:
an open Bundle

virtual Bundle::Handle instantiateBundle (  )  [protected, pure virtual]

Instantiate a new Bundle object.

Returns:
a new Bundle object

Implemented in AbstractEntryBundler, and AbstractKeyBundler.


Member Data Documentation

const int32_t adjustment_frequency [static]

Frequency of the adjustment attempts.

This number represents a number of iterations of the master bundle usage after which an adjustment attempt will be performed.

FinalHandle<List> f_hListBundle [protected]

A pool of Bundle objects.

Note that this list never shrinks.

FinalHandle<AtomicCounter> f_hCountThreads [protected]

A counter for the total number of threads that have started any bundle related execution.

This counter is used by subclasses to reduce an impact of bundled execution for lightly loaded environments.


The documentation for this class was generated from the following file:
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.