Java Code Examples for org.apache.cassandra.config.DatabaseDescriptor#getCompactionThroughputMbPerSec()

The following examples show how to use org.apache.cassandra.config.DatabaseDescriptor#getCompactionThroughputMbPerSec() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompactionManager.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
/**
 * Gets compaction rate limiter. When compaction_throughput_mb_per_sec is 0 or node is bootstrapping,
 * this returns rate limiter with the rate of Double.MAX_VALUE bytes per second.
 * Rate unit is bytes per sec.
 *
 * @return RateLimiter with rate limit set
 */
public RateLimiter getRateLimiter()
{
    double currentThroughput = DatabaseDescriptor.getCompactionThroughputMbPerSec() * 1024.0 * 1024.0;
    // if throughput is set to 0, throttling is disabled
    if (currentThroughput == 0 || StorageService.instance.isBootstrapMode())
        currentThroughput = Double.MAX_VALUE;
    if (compactionRateLimiter.getRate() != currentThroughput)
        compactionRateLimiter.setRate(currentThroughput);
    return compactionRateLimiter;
}
 
Example 2
Source File: StorageService.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public int getCompactionThroughputMbPerSec()
{
    return DatabaseDescriptor.getCompactionThroughputMbPerSec();
}