Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollback the metrics refactoring #804

Merged
merged 3 commits into from
May 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hystrix-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dependencies {
compile 'com.netflix.archaius:archaius-core:0.4.1'
compile 'io.reactivex:rxjava:1.0.10'
compile 'org.slf4j:slf4j-api:1.7.0'
compile 'org.hdrhistogram:HdrHistogram:2.1.4'
testCompile 'junit:junit-dep:4.10'
}


javadoc {
// the exclude isn't working, nor is there a subPackages options as docs suggest there should be
// we do not want the com.netflix.hystrix.util package include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,139 +18,140 @@
import java.util.concurrent.TimeUnit;

public class RollingPercentilePerfTest {
@State(Scope.Thread)
public static class PercentileState {
HystrixRollingPercentile percentile;

@Param({"true", "false"})
public boolean percentileEnabled;

@Setup(Level.Iteration)
public void setUp() {
percentile = new HystrixRollingPercentile(
HystrixProperty.Factory.asProperty(100),
HystrixProperty.Factory.asProperty(10),
HystrixProperty.Factory.asProperty(percentileEnabled));
}
}

@State(Scope.Thread)
public static class LatencyState {
final Random r = new Random();

int latency;

@Setup(Level.Invocation)
public void setUp() {
latency = r.nextInt(100);
}
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile writeOnly(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int readOnly(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}

@Benchmark
@Group("writeHeavy")
@GroupThreads(7)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile writeHeavyLatencyAdd(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@Group("writeHeavy")
@GroupThreads(1)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int writeHeavyReadMetrics(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}

@Benchmark
@Group("evenSplit")
@GroupThreads(4)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile evenSplitLatencyAdd(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@Group("evenSplit")
@GroupThreads(4)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int evenSplitReadMetrics(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}

@Benchmark
@Group("readHeavy")
@GroupThreads(1)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile readHeavyLatencyAdd(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@Group("readHeavy")
@GroupThreads(7)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int readHeavyReadMetrics(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}
@State(Scope.Thread)
public static class PercentileState {
HystrixRollingPercentile percentile;

@Param({"true", "false"})
public boolean percentileEnabled;

@Setup(Level.Iteration)
public void setUp() {
percentile = new HystrixRollingPercentile(
HystrixProperty.Factory.asProperty(100),
HystrixProperty.Factory.asProperty(10),
HystrixProperty.Factory.asProperty(1000),
HystrixProperty.Factory.asProperty(percentileEnabled));
}
}

@State(Scope.Thread)
public static class LatencyState {
final Random r = new Random();

int latency;

@Setup(Level.Invocation)
public void setUp() {
latency = r.nextInt(100);
}
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile writeOnly(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int readOnly(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}

@Benchmark
@Group("writeHeavy")
@GroupThreads(7)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile writeHeavyLatencyAdd(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@Group("writeHeavy")
@GroupThreads(1)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int writeHeavyReadMetrics(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}

@Benchmark
@Group("evenSplit")
@GroupThreads(4)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile evenSplitLatencyAdd(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@Group("evenSplit")
@GroupThreads(4)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int evenSplitReadMetrics(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}

@Benchmark
@Group("readHeavy")
@GroupThreads(1)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public HystrixRollingPercentile readHeavyLatencyAdd(PercentileState percentileState, LatencyState latencyState) {
percentileState.percentile.addValue(latencyState.latency);
return percentileState.percentile;
}

@Benchmark
@Group("readHeavy")
@GroupThreads(7)
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public int readHeavyReadMetrics(PercentileState percentileState) {
HystrixRollingPercentile percentile = percentileState.percentile;
return percentile.getMean() +
percentile.getPercentile(10) +
percentile.getPercentile(25) +
percentile.getPercentile(50) +
percentile.getPercentile(75) +
percentile.getPercentile(90) +
percentile.getPercentile(95) +
percentile.getPercentile(99) +
percentile.getPercentile(99.5);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public static Collection<HystrixCollapserMetrics> getInstances() {
this.key = key;
this.properties = properties;

this.percentileBatchSize = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileEnabled());
this.percentileShardSize = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileEnabled());
this.percentileBatchSize = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileBucketSize(), properties.metricsRollingPercentileEnabled());
this.percentileShardSize = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileBucketSize(), properties.metricsRollingPercentileEnabled());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public static Collection<HystrixCommandMetrics> getInstances() {
this.group = commandGroup;
this.threadPoolKey = threadPoolKey;
this.properties = properties;
this.percentileExecution = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileEnabled());
this.percentileTotal = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileEnabled());
this.percentileExecution = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileBucketSize(), properties.metricsRollingPercentileEnabled());
this.percentileTotal = new HystrixRollingPercentile(properties.metricsRollingPercentileWindowInMilliseconds(), properties.metricsRollingPercentileWindowBuckets(), properties.metricsRollingPercentileBucketSize(), properties.metricsRollingPercentileEnabled());
this.eventNotifier = eventNotifier;
}

Expand Down
Loading