Show / Hide Table of Contents

Class AbstractBundler

An abstract base for processors that implement bundling strategy.

Inheritance
object
AbstractBundler
AbstractEntryBundler
AbstractKeyBundler
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Tangosol.Net.Cache
Assembly: Coherence.dll
Syntax
public abstract class AbstractBundler
Remarks

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:

  • Get() and GetAll() methods for the INamedCache API for the partitioned cache service topology;
  • Insert() and InsertAll() methods for the INamedCache API for the partitioned cache service topology;
  • Remove() method for the INamedCache API for the partitioned cache service topology;

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 into 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.

Constructors

AbstractBundler()

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

Declaration
public AbstractBundler()

Fields

ADJUSTMENT_FREQUENCY

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.

Declaration
public const int ADJUSTMENT_FREQUENCY = 128
Field Value
Type Description
int

m_countThreads

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.

Declaration
protected AtomicCounter m_countThreads
Field Value
Type Description
AtomicCounter

m_listBundle

A pool of Bundle objects. Note that this list never shrinks.

Declaration
protected IList m_listBundle
Field Value
Type Description
IList

m_previousSizeThreshold

The previous bundle size threshold value.

Declaration
protected double m_previousSizeThreshold
Field Value
Type Description
double

Properties

AllowAutoAdjust

Specifies whether or not auto-adjustment is on. Default value is "true".

Declaration
public bool AllowAutoAdjust { get; set; }
Property Value
Type Description
bool

DelayMillis

The timeout delay value.

Declaration
public long DelayMillis { get; set; }
Property Value
Type Description
long

The timeout delay value in milliseconds. Default value is one millisecond.

SizeThreshold

The bundle size threshold value.

Declaration
public int SizeThreshold { get; set; }
Property Value
Type Description
int

The bundle size threshold, a positive value expressed in the same units as the value returned by the BundleSize property.

SyncRoot

Gets an object that can be used to synchronize access to the ICollection.

Declaration
public virtual object SyncRoot { get; }
Property Value
Type Description
object

An object that can be used to synchronize access to the ICollection.

ThreadThreshold

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

Declaration
public int ThreadThreshold { get; set; }
Property Value
Type Description
int

The number of threads threshold.

Methods

Adjust()

Adjust this Bundler's parameters according to the available statistical information.

Declaration
public void Adjust()

InstantiateBundle()

Instantiate a new Bundle object.

Declaration
protected abstract AbstractBundler.Bundle InstantiateBundle()
Returns
Type Description
AbstractBundler.Bundle

A new Bundle object.

ResetStatistics()

Reset this Bundler statistics.

Declaration
public void ResetStatistics()

ToString()

Provide a human readable description for the Bundler object (for debugging).

Declaration
public string ToString()
Returns
Type Description
string

A human readable description for the Bundler object.

UpdateStatistics()

Update the statistics for this Bundle.

Declaration
public void UpdateStatistics()

getOpenBundle()

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).

Declaration
protected AbstractBundler.Bundle getOpenBundle()
Returns
Type Description
AbstractBundler.Bundle

An open Bundle.

In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.