use of com.linkedin.d2.backuprequests.ResponseTimeDistribution in project rest.li by linkedin.
the class TestBoundedCostBackupRequestsStrategy method testLongTailEffectOfBackupRequests.
@Test
public void testLongTailEffectOfBackupRequests() {
BoundedCostBackupRequestsStrategy strategy = new BoundedCostBackupRequestsStrategy(5, 64, 1024, 128, 0);
ResponseTimeDistribution hiccupDistribution = new GaussianResponseTimeDistribution(500, 1000, 500, TimeUnit.MILLISECONDS);
BackupRequestsSimulator simulator = new BackupRequestsSimulator(new PoissonEventsArrival(200, TimeUnit.SECONDS), new GaussianWithHiccupResponseTimeDistribution(2, 10, 5, TimeUnit.MILLISECONDS, hiccupDistribution, 0.02), strategy);
simulator.simulate(ITERATIONS);
double withoutBackup99 = simulator.getResponseTimeWithoutBackupRequestsHistogram().getValueAtPercentile(99);
double withBackup99 = simulator.getResponseTimeWithBackupRequestsHistogram().getValueAtPercentile(99);
assertTrue(withBackup99 * 10 < withoutBackup99, "99th percentile is expected to be improved 10x, with backup: " + withBackup99 / 1000000 + "ms, without backup: " + withoutBackup99 / 1000000 + "ms");
}
use of com.linkedin.d2.backuprequests.ResponseTimeDistribution in project rest.li by linkedin.
the class TestBackupRequestsClient method createClient.
private BackupRequestsClient createClient(Supplier<ServiceProperties> servicePropertiesSupplier, TestBackupRequestsStrategyStatsConsumer statsConsumer, boolean isD2Async) {
ResponseTimeDistribution hiccupDistribution = new GaussianResponseTimeDistribution(500, 1000, 500, TimeUnit.MILLISECONDS);
ResponseTimeDistribution responseTime = new GaussianWithHiccupResponseTimeDistribution(2, 10, 5, TimeUnit.MILLISECONDS, hiccupDistribution, 0.02);
return createClient(servicePropertiesSupplier, statsConsumer, responseTime, isD2Async);
}
Aggregations