Search in sources :

Example 1 with GaussianWithHiccupResponseTimeDistribution

use of com.linkedin.d2.backuprequests.GaussianWithHiccupResponseTimeDistribution 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");
}
Also used : BoundedCostBackupRequestsStrategy(com.linkedin.d2.backuprequests.BoundedCostBackupRequestsStrategy) Test(org.testng.annotations.Test)

Example 2 with GaussianWithHiccupResponseTimeDistribution

use of com.linkedin.d2.backuprequests.GaussianWithHiccupResponseTimeDistribution 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);
}
Also used : GaussianWithHiccupResponseTimeDistribution(com.linkedin.d2.backuprequests.GaussianWithHiccupResponseTimeDistribution) GaussianWithHiccupResponseTimeDistribution(com.linkedin.d2.backuprequests.GaussianWithHiccupResponseTimeDistribution) ResponseTimeDistribution(com.linkedin.d2.backuprequests.ResponseTimeDistribution) ConstantResponseTimeDistribution(com.linkedin.d2.backuprequests.ConstantResponseTimeDistribution) GaussianResponseTimeDistribution(com.linkedin.d2.backuprequests.GaussianResponseTimeDistribution) GaussianResponseTimeDistribution(com.linkedin.d2.backuprequests.GaussianResponseTimeDistribution)

Aggregations

BoundedCostBackupRequestsStrategy (com.linkedin.d2.backuprequests.BoundedCostBackupRequestsStrategy)1 ConstantResponseTimeDistribution (com.linkedin.d2.backuprequests.ConstantResponseTimeDistribution)1 GaussianResponseTimeDistribution (com.linkedin.d2.backuprequests.GaussianResponseTimeDistribution)1 GaussianWithHiccupResponseTimeDistribution (com.linkedin.d2.backuprequests.GaussianWithHiccupResponseTimeDistribution)1 ResponseTimeDistribution (com.linkedin.d2.backuprequests.ResponseTimeDistribution)1 Test (org.testng.annotations.Test)1