add parameter for benchmarking host

This commit is contained in:
xvrl 2012-12-17 16:44:02 -08:00
parent 2118252ef2
commit 54d8aff4d5
1 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,8 @@ public class MemcachedCacheBrokerBenchmark extends SimpleBenchmark
private Cache cache; private Cache cache;
private static byte[] randBytes; private static byte[] randBytes;
@Param({"localhost:11211"}) String hosts;
// object size in kB // object size in kB
@Param({"1", "5", "10", "40"}) int objectSize; @Param({"1", "5", "10", "40"}) int objectSize;
@Param({"100", "1000"}) int objectCount; @Param({"100", "1000"}) int objectCount;
@ -37,6 +39,8 @@ public class MemcachedCacheBrokerBenchmark extends SimpleBenchmark
// disable compression // disable compression
transcoder.setCompressionThreshold(Integer.MAX_VALUE); transcoder.setCompressionThreshold(Integer.MAX_VALUE);
System.out.println(String.format("Using memcached hosts [%s]", hosts));
client = new MemcachedClient( client = new MemcachedClient(
new ConnectionFactoryBuilder().setProtocol(ConnectionFactoryBuilder.Protocol.BINARY) new ConnectionFactoryBuilder().setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
.setHashAlg(DefaultHashAlgorithm.FNV1A_64_HASH) .setHashAlg(DefaultHashAlgorithm.FNV1A_64_HASH)
@ -46,7 +50,7 @@ public class MemcachedCacheBrokerBenchmark extends SimpleBenchmark
.setTranscoder(transcoder) .setTranscoder(transcoder)
.setShouldOptimize(true) .setShouldOptimize(true)
.build(), .build(),
AddrUtil.getAddresses(System.getProperty("druid.bard.cache.hosts", "localhost:11211")) AddrUtil.getAddresses(hosts)
); );
broker = new MemcachedCacheBroker( broker = new MemcachedCacheBroker(