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

Rename JMH tests for easier execution by regex #1035

Merged
merged 1 commit into from
Jan 4, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import java.util.concurrent.TimeUnit;

public class MultiThreadedMetricsTest {
public class CommandExecutionAndConcurrentMetricsReadPerfTest {
@State(Scope.Thread)
public static class CommandState {
HystrixCommand<Integer> command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.infra.Blackhole;
import rx.Observable;
import rx.schedulers.Schedulers;

Expand All @@ -41,38 +42,52 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class CommandSetterExecutionPerfTest {
public class CommandExecutionPerfTest {

static HystrixCommandProperties.Setter threadIsolatedCommandDefaults = HystrixCommandProperties.Setter()
.withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD)
.withRequestCacheEnabled(true)
.withRequestLogEnabled(true)
.withCircuitBreakerEnabled(true)
.withCircuitBreakerForceOpen(false);

static HystrixCommandProperties.Setter semaphoreIsolatedCommandDefaults = HystrixCommandProperties.Setter()
.withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE)
.withRequestCacheEnabled(true)
.withRequestLogEnabled(true)
.withCircuitBreakerEnabled(true)
.withCircuitBreakerForceOpen(false);

static HystrixThreadPoolProperties.Setter threadPoolDefaults = HystrixThreadPoolProperties.Setter()
.withCoreSize(100);

private static HystrixCommandProperties.Setter getCommandSetter(HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy) {
switch (isolationStrategy) {
case THREAD: return threadIsolatedCommandDefaults;
default: return semaphoreIsolatedCommandDefaults;
}
}

@State(Scope.Thread)
public static class CommandState {
HystrixCommand<Integer> command;

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

@Param({"THREAD", "SEMAPHORE"})
public HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy;

@Param({"1", "100", "10000"})
public int blackholeConsumption;

@Setup(Level.Invocation)
public void setUp() {
command = new HystrixCommand<Integer>(
HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("PERF"))
.andCommandPropertiesDefaults(
HystrixCommandProperties.Setter()
.withExecutionIsolationStrategy(isolationStrategy)
.withRequestCacheEnabled(true)
.withRequestLogEnabled(true)
.withCircuitBreakerEnabled(true)
.withCircuitBreakerForceOpen(forceCircuitOpen)
)
.andThreadPoolPropertiesDefaults(
HystrixThreadPoolProperties.Setter()
.withCoreSize(100)
)
.andCommandPropertiesDefaults(getCommandSetter(isolationStrategy))
.andThreadPoolPropertiesDefaults(threadPoolDefaults)
) {
@Override
protected Integer run() throws Exception {
Blackhole.consumeCPU(blackholeConsumption);
return 1;
}

Expand Down

This file was deleted.