Search in sources :

Example 11 with SupervisorTaskAutoScaler

use of org.apache.druid.indexing.overlord.supervisor.autoscaler.SupervisorTaskAutoScaler in project druid by druid-io.

the class SeekableStreamSupervisorSpecTest method testDefaultAutoScalerConfigCreatedWithDefault.

@Test
public void testDefaultAutoScalerConfigCreatedWithDefault() {
    EasyMock.expect(ingestionSchema.getIOConfig()).andReturn(seekableStreamSupervisorIOConfig).anyTimes();
    EasyMock.expect(ingestionSchema.getDataSchema()).andReturn(dataSchema).anyTimes();
    EasyMock.expect(ingestionSchema.getTuningConfig()).andReturn(seekableStreamSupervisorTuningConfig).anyTimes();
    EasyMock.replay(ingestionSchema);
    EasyMock.expect(seekableStreamSupervisorIOConfig.getAutoscalerConfig()).andReturn(mapper.convertValue(ImmutableMap.of("lagCollectionIntervalMillis", "1", "enableTaskAutoScaler", true, "taskCountMax", "4", "taskCountMin", "1"), AutoScalerConfig.class)).anyTimes();
    EasyMock.replay(seekableStreamSupervisorIOConfig);
    EasyMock.expect(supervisor4.getActiveTaskGroupsCount()).andReturn(0).anyTimes();
    EasyMock.replay(supervisor4);
    TestSeekableStreamSupervisorSpec spec = new TestSeekableStreamSupervisorSpec(ingestionSchema, null, false, taskStorage, taskMaster, indexerMetadataStorageCoordinator, indexTaskClientFactory, mapper, emitter, monitorSchedulerConfig, rowIngestionMetersFactory, supervisorStateManagerConfig, supervisor4, "id1");
    SupervisorTaskAutoScaler autoscaler = spec.createAutoscaler(supervisor4);
    Assert.assertTrue(autoscaler instanceof LagBasedAutoScaler);
    LagBasedAutoScaler lagBasedAutoScaler = (LagBasedAutoScaler) autoscaler;
    LagBasedAutoScalerConfig lagBasedAutoScalerConfig = lagBasedAutoScaler.getAutoScalerConfig();
    Assert.assertEquals(lagBasedAutoScalerConfig.getLagCollectionIntervalMillis(), 1);
    Assert.assertEquals(lagBasedAutoScalerConfig.getLagCollectionRangeMillis(), 600000);
    Assert.assertEquals(lagBasedAutoScalerConfig.getScaleActionStartDelayMillis(), 300000);
    Assert.assertEquals(lagBasedAutoScalerConfig.getScaleActionPeriodMillis(), 60000);
    Assert.assertEquals(lagBasedAutoScalerConfig.getScaleOutThreshold(), 6000000);
    Assert.assertEquals(lagBasedAutoScalerConfig.getScaleInThreshold(), 1000000);
    Assert.assertEquals(lagBasedAutoScalerConfig.getTaskCountMax(), 4);
    Assert.assertEquals(lagBasedAutoScalerConfig.getTaskCountMin(), 1);
    Assert.assertEquals(lagBasedAutoScalerConfig.getScaleInStep(), 1);
    Assert.assertEquals(lagBasedAutoScalerConfig.getScaleOutStep(), 2);
    Assert.assertEquals(lagBasedAutoScalerConfig.getMinTriggerScaleActionFrequencyMillis(), 600000);
}
Also used : SupervisorTaskAutoScaler(org.apache.druid.indexing.overlord.supervisor.autoscaler.SupervisorTaskAutoScaler) LagBasedAutoScaler(org.apache.druid.indexing.seekablestream.supervisor.autoscaler.LagBasedAutoScaler) LagBasedAutoScalerConfig(org.apache.druid.indexing.seekablestream.supervisor.autoscaler.LagBasedAutoScalerConfig) Test(org.junit.Test)

Aggregations

SupervisorTaskAutoScaler (org.apache.druid.indexing.overlord.supervisor.autoscaler.SupervisorTaskAutoScaler)11 Test (org.junit.Test)7 HashMap (java.util.HashMap)4 LagBasedAutoScalerConfig (org.apache.druid.indexing.seekablestream.supervisor.autoscaler.LagBasedAutoScalerConfig)4 Callable (java.util.concurrent.Callable)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Executor (java.util.concurrent.Executor)2 KinesisDataSourceMetadata (org.apache.druid.indexing.kinesis.KinesisDataSourceMetadata)2 KinesisIndexTask (org.apache.druid.indexing.kinesis.KinesisIndexTask)2 TaskRunnerListener (org.apache.druid.indexing.overlord.TaskRunnerListener)2 Supervisor (org.apache.druid.indexing.overlord.supervisor.Supervisor)2 SupervisorStateManagerConfig (org.apache.druid.indexing.overlord.supervisor.SupervisorStateManagerConfig)2 AutoScalerConfig (org.apache.druid.indexing.seekablestream.supervisor.autoscaler.AutoScalerConfig)2 LagBasedAutoScaler (org.apache.druid.indexing.seekablestream.supervisor.autoscaler.LagBasedAutoScaler)2 File (java.io.File)1 IOException (java.io.IOException)1 DimensionsSpec (org.apache.druid.data.input.impl.DimensionsSpec)1 StringDimensionSchema (org.apache.druid.data.input.impl.StringDimensionSchema)1 TaskInfoProvider (org.apache.druid.indexing.common.TaskInfoProvider)1 KafkaDataSourceMetadata (org.apache.druid.indexing.kafka.KafkaDataSourceMetadata)1