-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#8372] Replace HTableMultiplexer with BufferedMutator
- Loading branch information
Showing
14 changed files
with
500 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
collector/src/main/java/com/navercorp/pinpoint/collector/monitor/BufferedMutatorMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.navercorp.pinpoint.collector.monitor; | ||
|
||
import com.codahale.metrics.Gauge; | ||
import com.codahale.metrics.Metric; | ||
import com.codahale.metrics.MetricSet; | ||
import com.navercorp.pinpoint.common.hbase.BufferedMutatorWriter; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
public class BufferedMutatorMetrics implements MetricSet { | ||
private static final String HBASE_ASYNC_OPS = "hbase.bufferedmutator.ops"; | ||
|
||
private static final String COUNT = HBASE_ASYNC_OPS + ".success.count"; | ||
private static final String REJECTED_COUNT = HBASE_ASYNC_OPS + ".rejected.count"; | ||
|
||
private final BufferedMutatorWriter writer; | ||
|
||
public BufferedMutatorMetrics(BufferedMutatorWriter writer) { | ||
this.writer = Objects.requireNonNull(writer, "writer"); | ||
} | ||
|
||
@Override | ||
public Map<String, Metric> getMetrics() { | ||
|
||
final Map<String, Metric> gauges = new HashMap<>(3); | ||
gauges.put(COUNT, new Gauge<Long>() { | ||
@Override | ||
public Long getValue() { | ||
return writer.getSuccessCount(); | ||
} | ||
}); | ||
gauges.put(REJECTED_COUNT, new Gauge<Long>() { | ||
@Override | ||
public Long getValue() { | ||
return writer.getErrorCount(); | ||
} | ||
}); | ||
|
||
return gauges; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...hbase/src/main/java/com/navercorp/pinpoint/common/hbase/BufferedMutatorConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.navercorp.pinpoint.common.hbase; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.util.unit.DataSize; | ||
|
||
public class BufferedMutatorConfiguration { | ||
|
||
@Value("${collector.batchwrite.enable:true}") | ||
private boolean batchWriter = true; | ||
|
||
@Value("${collector.batchwrite.timertick:100}") | ||
private long writeBufferPeriodicFlushTimerTickMs = 100; | ||
|
||
@Value("${collector.batchwrite.writebuffer.size:5012}") | ||
private long writeBufferSize = 1024 * 5; | ||
|
||
// for OOM prevent | ||
@Value("${collector.batchwrite.writebuffer.limit:100MB}") | ||
private DataSize writeBufferLimit = DataSize.ofMegabytes(100); | ||
|
||
public boolean isBatchWriter() { | ||
return batchWriter; | ||
} | ||
|
||
public long getWriteBufferPeriodicFlushTimerTickMs() { | ||
return writeBufferPeriodicFlushTimerTickMs; | ||
} | ||
|
||
public long getWriteBufferSize() { | ||
return writeBufferSize; | ||
} | ||
|
||
public long getWriteBufferLimit() { | ||
return writeBufferLimit.toBytes(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "BufferedMutatorConfiguration{" + | ||
"batchWriter=" + batchWriter + | ||
", writeBufferPeriodicFlushTimerTickMs=" + writeBufferPeriodicFlushTimerTickMs + | ||
", writeBufferSize=" + writeBufferSize + | ||
", writeBufferLimit=" + writeBufferLimit + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.