Search in sources :

Example 1 with ThroughputController

use of org.apache.hadoop.hbase.regionserver.throttle.ThroughputController in project hbase by apache.

the class CompactSplitThread method onConfigurationChange.

/**
   * {@inheritDoc}
   */
@Override
public void onConfigurationChange(Configuration newConf) {
    // Check if number of large / small compaction threads has changed, and then
    // adjust the core pool size of the thread pools, by using the
    // setCorePoolSize() method. According to the javadocs, it is safe to
    // change the core pool size on-the-fly. We need to reset the maximum
    // pool size, as well.
    int largeThreads = Math.max(1, newConf.getInt(LARGE_COMPACTION_THREADS, LARGE_COMPACTION_THREADS_DEFAULT));
    if (this.longCompactions.getCorePoolSize() != largeThreads) {
        LOG.info("Changing the value of " + LARGE_COMPACTION_THREADS + " from " + this.longCompactions.getCorePoolSize() + " to " + largeThreads);
        if (this.longCompactions.getCorePoolSize() < largeThreads) {
            this.longCompactions.setMaximumPoolSize(largeThreads);
            this.longCompactions.setCorePoolSize(largeThreads);
        } else {
            this.longCompactions.setCorePoolSize(largeThreads);
            this.longCompactions.setMaximumPoolSize(largeThreads);
        }
    }
    int smallThreads = newConf.getInt(SMALL_COMPACTION_THREADS, SMALL_COMPACTION_THREADS_DEFAULT);
    if (this.shortCompactions.getCorePoolSize() != smallThreads) {
        LOG.info("Changing the value of " + SMALL_COMPACTION_THREADS + " from " + this.shortCompactions.getCorePoolSize() + " to " + smallThreads);
        if (this.shortCompactions.getCorePoolSize() < smallThreads) {
            this.shortCompactions.setMaximumPoolSize(smallThreads);
            this.shortCompactions.setCorePoolSize(smallThreads);
        } else {
            this.shortCompactions.setCorePoolSize(smallThreads);
            this.shortCompactions.setMaximumPoolSize(smallThreads);
        }
    }
    int splitThreads = newConf.getInt(SPLIT_THREADS, SPLIT_THREADS_DEFAULT);
    if (this.splits.getCorePoolSize() != splitThreads) {
        LOG.info("Changing the value of " + SPLIT_THREADS + " from " + this.splits.getCorePoolSize() + " to " + splitThreads);
        if (this.splits.getCorePoolSize() < splitThreads) {
            this.splits.setMaximumPoolSize(splitThreads);
            this.splits.setCorePoolSize(splitThreads);
        } else {
            this.splits.setCorePoolSize(splitThreads);
            this.splits.setMaximumPoolSize(splitThreads);
        }
    }
    int mergeThreads = newConf.getInt(MERGE_THREADS, MERGE_THREADS_DEFAULT);
    if (this.mergePool.getCorePoolSize() != mergeThreads) {
        LOG.info("Changing the value of " + MERGE_THREADS + " from " + this.mergePool.getCorePoolSize() + " to " + mergeThreads);
        if (this.mergePool.getCorePoolSize() < mergeThreads) {
            this.mergePool.setMaximumPoolSize(mergeThreads);
            this.mergePool.setCorePoolSize(mergeThreads);
        } else {
            this.mergePool.setCorePoolSize(mergeThreads);
            this.mergePool.setMaximumPoolSize(mergeThreads);
        }
    }
    ThroughputController old = this.compactionThroughputController;
    if (old != null) {
        old.stop("configuration change");
    }
    this.compactionThroughputController = CompactionThroughputControllerFactory.create(server, newConf);
    // We change this atomically here instead of reloading the config in order that upstream
    // would be the only one with the flexibility to reload the config.
    this.conf.reloadConfiguration();
}
Also used : ThroughputController(org.apache.hadoop.hbase.regionserver.throttle.ThroughputController)

Example 2 with ThroughputController

use of org.apache.hadoop.hbase.regionserver.throttle.ThroughputController in project hbase by apache.

the class HRegionServer method onConfigurationChange.

@Override
public void onConfigurationChange(Configuration newConf) {
    ThroughputController old = this.flushThroughputController;
    if (old != null) {
        old.stop("configuration change");
    }
    this.flushThroughputController = FlushThroughputControllerFactory.create(this, newConf);
}
Also used : ThroughputController(org.apache.hadoop.hbase.regionserver.throttle.ThroughputController)

Example 3 with ThroughputController

use of org.apache.hadoop.hbase.regionserver.throttle.ThroughputController in project hbase by apache.

the class HRegion method compact.

@Override
public void compact(final boolean majorCompaction) throws IOException {
    if (majorCompaction) {
        triggerMajorCompaction();
    }
    for (Store s : getStores()) {
        CompactionContext compaction = s.requestCompaction();
        if (compaction != null) {
            ThroughputController controller = null;
            if (rsServices != null) {
                controller = CompactionThroughputControllerFactory.create(rsServices, conf);
            }
            if (controller == null) {
                controller = NoLimitThroughputController.INSTANCE;
            }
            compact(compaction, s, controller, null);
        }
    }
}
Also used : CompactionContext(org.apache.hadoop.hbase.regionserver.compactions.CompactionContext) ThroughputController(org.apache.hadoop.hbase.regionserver.throttle.ThroughputController) NoLimitThroughputController(org.apache.hadoop.hbase.regionserver.throttle.NoLimitThroughputController)

Aggregations

ThroughputController (org.apache.hadoop.hbase.regionserver.throttle.ThroughputController)3 CompactionContext (org.apache.hadoop.hbase.regionserver.compactions.CompactionContext)1 NoLimitThroughputController (org.apache.hadoop.hbase.regionserver.throttle.NoLimitThroughputController)1