public class SampleDecimationThrottlingProperties extends Object
Configuration properties that control throttling of the sample decimation
process. Throttling is needed in order to avoid exhausting system resources
or overloading the Cassandra database cluster. This object is injected with
properties that have the throttling.sampleDecimation.*
prefix.
When adding a decimation level to a lot of channels that already have a lot
of raw samples, generating the decimated samples can consume a lot of
resources because this process involves reading all the source (raw) samples.
In particular, due to the fact that samples are read from the database in
pages, a lot of memory might be consumed for samples that have been read from
the database, but have not been processed yet. This can lead to a situation
in which the decimation process consumes all available heap memory and
triggers an OutOfMemoryError
. By limiting the number of samples
that may be kept in memory and delaying the reading of samples for other
channels until some of the samples in memory have been processed, the amount
of memory used can be limited.
Instances of this class are safe for concurrent read access but are not safe for concurrent write access. Typically, this should not be a problem because an instance of this class is initialized once at application startup and then only used for read access.
ThrottlingProperties
Constructor and Description |
---|
SampleDecimationThrottlingProperties()
Creates new sample decimation throttling properties initialized with the
respective default values.
|
SampleDecimationThrottlingProperties(String str)
Creates new sample decimation throttling properties initialized with the
respective default values.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxFetchedSamplesInMemory()
Returns the maximum number of samples that may be concurrently fetched
into memory when generating decimated samples.
|
int |
getMaxRunningFetchOperations()
Returns the maximum number of sample fetch operation that may run
concurrently when generating decimated samples.
|
void |
setMaxFetchedSamplesInMemory(int maxFetchedSamplesInMemory)
Sets the maximum number of samples that may be concurrently fetched into
memory when generating decimated samples.
|
void |
setMaxRunningFetchOperations(int maxRunningFetchOperations)
Sets the maximum number of sample fetch operation that may run
concurrently when generating decimated samples.
|
public SampleDecimationThrottlingProperties()
public SampleDecimationThrottlingProperties(String str)
str
- empty string or null
.IllegalArgumentException
- if str
is a non-empty string.public int getMaxFetchedSamplesInMemory()
Returns the maximum number of samples that may be concurrently fetched into memory when generating decimated samples. When this threshold is exceeded, further fetch operations are postponed. These postponed fetch operations are started when the number of samples in memory drops below this threshold again.
As the exact number of samples returned by a fetch operation cannot be
known in advance, this threshold might actually be exceeded slightly. The
number returned by the getMaxRunningFetchOperations()
method
effectively controls by how much the threshold may be exceeded.
This option only controls how samples are fetched when generating decimated samples. It does not affecting fetching samples for regular archive access operations.
The default value is 1000000 samples.
public void setMaxFetchedSamplesInMemory(int maxFetchedSamplesInMemory)
Sets the maximum number of samples that may be concurrently fetched into memory when generating decimated samples. When this threshold is exceeded, further fetch operations are postponed. These postponed fetch operations are started when the number of samples in memory drops below this threshold again.
As the exact number of samples returned by a fetch operation cannot be
known in advance, this threshold might actually be exceeded slightly. The
number set through the setMaxRunningFetchOperations(int)
method
effectively controls by how much the threshold may be exceeded.
This option only controls how samples are fetched when generating decimated samples. It does not affecting fetching samples for regular archive access operations.
The default value is 1000000 samples.
maxFetchedSamplesInMemory
- max. number of samples that may be fetched into memory
concurrently. Must be greater than zero.IllegalArgumentException
- if maxFetchedSamplesInMemory
is less than one.public int getMaxRunningFetchOperations()
Returns the maximum number of sample fetch operation that may run concurrently when generating decimated samples. When this threshold is exceeded, further fetch operations are postponed. These postponed fetch operations are started when a previously running fetch operation completes.
This options is needed to control by how much the threshold returned by
the getMaxFetchedSamplesInMemory()
method may be exceeded. As
the exact number of samples returned by a fetch operation cannot be known
in advance, the threshold for the number of samples in memory might be
exceeded by the fetch size multiplied by the number of fetch operations
that may run concurrently. For example, if the fetch size is 5000 and the
max. number of running fetch operations is 20, there might be up to
100000 samples more in memory than specified by
getMaxFetchedSamplesInMemory()
.
This option only controls how samples are fetched when generating decimated samples. It does not affecting fetching samples for regular archive access operations.
The default value is 20 fetch operations.
public void setMaxRunningFetchOperations(int maxRunningFetchOperations)
Sets the maximum number of sample fetch operation that may run concurrently when generating decimated samples. When this threshold is exceeded, further fetch operations are postponed. These postponed fetch operations are started when a previously running fetch operation completes.
This options controls by how much the threshold set through the
setMaxFetchedSamplesInMemory(int)
method may be exceeded. As the
exact number of samples returned by a fetch operation cannot be known in
advance, the threshold for the number of samples in memory might be
exceeded by the fetch size multiplied by the number of fetch operations
that may run concurrently. For example, if the fetch size is 5000 and the
max. number of running fetch operations is 20, there might be up to
100000 samples more in memory than specified through
setMaxFetchedSamplesInMemory(int)
.
This option only controls how samples are fetched when generating decimated samples. It does not affecting fetching samples for regular archive access operations.
The default value is 20 fetch operations.
maxRunningFetchOperations
- max. number of sample fetch operations that may run
concurrently.IllegalArgumentException
- if maxRunningFetchOperations
is less than one.Copyright © 2011–2017 aquenos GmbH. All rights reserved.