public TunableConfig(IConfiguration configuration) { this.readRateLimit = configuration.getReadRateLimit(); this.writeRateLimit = configuration.getWriteRateLimit(); }
@Override public Integer getRandomIntegerValue() { return vRandom.nextInt(config.getNumValues()); }
private int getValueSize() { if (config.isUseVariableDataSize()) { return vvRandom.nextInt( Math.abs(config.getDataSizeUpperBound() - config.getDataSizeLowerBound())) + config.getDataSizeLowerBound(); } return config.getDataSize(); }
@Test public void testInvokingProcessMethodOnWriteOperationSetsNewRateLimit() throws Exception { Assert.assertEquals(777, config.getNumKeys()); } }
/** * Creates an injector using modules obtained from the following sources: (1) the hard coded list of modules * specified in the {@link GuiceInjectorProvider #getModulesList()} method of this class, (2) the 'modules' * list passed as the first and only argument to this method * * @param modules - any additional Guice binding modules which will supplement the list of those added by default */ public Injector getInjector(AbstractModule ... modules) { List<Module> moduleList = getModuleList(modules); Injector injector = Guice.createInjector(moduleList); injector.getInstance(IConfiguration.class).initialize(); return injector; } }
public void onWriteRateLimitChange() { checkAndInitRateLimit(writeLimiter, config.getWriteRateLimit(), "writeLimiter"); }
private void checkAndInitTimer() { /** CODE TO PERIODICALLY RESET Histograms */ ScheduledExecutorService timer = timerRef.get(); if (timer == null) { timer = Executors.newScheduledThreadPool(1); logger.info(String.format("Initializing NdBenchMonitor with timing counter reset frequency %d seconds", config.getStatsResetFreqSeconds())); timer.scheduleAtFixedRate(this::setReadWriteHistograms, 1, config.getStatsResetFreqSeconds(), TimeUnit.SECONDS); timerRef.set(timer); } }
public void onReadRateLimitChange() { checkAndInitRateLimit(readLimiter, config.getReadRateLimit(), "readLimiter"); }
private int getValueSize() { if (config.isUseVariableDataSize()) { return vvRandom.nextInt( Math.abs(config.getDataSizeUpperBound() - config.getDataSizeLowerBound())) + config.getDataSizeLowerBound(); } return config.getDataSize(); }
public TunableConfig(IConfiguration configuration) { this.readRateLimit = configuration.getReadRateLimit(); this.writeRateLimit = configuration.getWriteRateLimit(); }
/** * Creates an injector using modules obtained from the following sources: (1) the hard coded list of modules * specified in the {@link GuiceInjectorProvider #getModulesList()} method of this class, (2) the 'modules' * list passed as the first and only argument to this method * * @param modules - any additional Guice binding modules which will supplement the list of those added by default */ public Injector getInjector(AbstractModule ... modules) { List<Module> moduleList = getModuleList(modules); Injector injector = Guice.createInjector(moduleList); injector.getInstance(IConfiguration.class).initialize(); return injector; } }
@Override public Integer getRandomIntegerValue() { return vRandom.nextInt(config.getNumValues()); }
public void onWriteRateLimitChange() { checkAndInitRateLimit(writeLimiter, config.getWriteRateLimit(), "writeLimiter"); }
private Histogram createHistogramFromConfig() { return new Histogram(new SlidingTimeWindowReservoir(config.getStatsResetFreqSeconds(), TimeUnit.SECONDS)); } }
public void onReadRateLimitChange() { checkAndInitRateLimit(readLimiter, config.getReadRateLimit(), "readLimiter"); }
@Override public String getRandomValue() { int randomValueIndex = vRandom.nextInt(config.getNumValues()); return values.get(randomValueIndex); }
private Histogram createHistogramFromConfig() { return new Histogram(new SlidingTimeWindowReservoir(config.getStatsResetFreqSeconds(), TimeUnit.SECONDS)); } }
@Override public String getRandomValue() { int randomValueIndex = vRandom.nextInt(config.getNumValues()); return values.get(randomValueIndex); }
private void upsertRandomString() { values.set(vRandom.nextInt(config.getNumValues()), generateRandomString(getValueSize())); }
private void upsertRandomString() { values.set(vRandom.nextInt(config.getNumValues()), generateRandomString(getValueSize())); }