Search in sources :

Example 6 with OperatorFixture

use of org.apache.drill.test.OperatorFixture in project drill by axbaretto.

the class TestQueryMemoryAlloc method testCustomFloor.

@Test
public void testCustomFloor() throws Exception {
    OperatorFixture.Builder builder = OperatorFixture.builder();
    builder.systemOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.05);
    builder.systemOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 3 * ONE_GB);
    try (OperatorFixture fixture = builder.build()) {
        final OptionManager optionManager = fixture.getOptionManager();
        optionManager.setLocalOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.05);
        optionManager.setLocalOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 3 * ONE_GB);
        // Out-of-box memory, use query memory per node as floor.
        long mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 8 * ONE_GB);
        assertEquals(3 * ONE_GB, mem);
        // Up to 60 GB, query memory dominates.
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 60 * ONE_GB);
        assertEquals(3 * ONE_GB, mem);
        // After 60 GB, the percent dominates
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 100 * ONE_GB);
        assertEquals(5 * ONE_GB, mem);
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture) OptionManager(org.apache.drill.exec.server.options.OptionManager) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 7 with OperatorFixture

use of org.apache.drill.test.OperatorFixture in project drill by axbaretto.

the class TestQueryMemoryAlloc method testOpMemory.

/**
 * Test with default options, various memory configs.
 * Since we can't change the actual CPUs on this node, use an
 * option to specify the number (rather than the usual 70% of
 * actual cores.)
 *
 * @throws Exception
 */
@Test
public void testOpMemory() throws Exception {
    OperatorFixture.Builder builder = OperatorFixture.builder();
    builder.systemOption(ExecConstants.CPU_LOAD_AVERAGE_KEY, 0.7);
    builder.systemOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 10);
    builder.systemOption(ExecConstants.MIN_MEMORY_PER_BUFFERED_OP_KEY, 40 * ONE_MB);
    try (OperatorFixture fixture = builder.build()) {
        final OptionManager optionManager = fixture.getOptionManager();
        optionManager.setLocalOption(ExecConstants.CPU_LOAD_AVERAGE_KEY, 0.7);
        optionManager.setLocalOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 10);
        optionManager.setLocalOption(ExecConstants.MIN_MEMORY_PER_BUFFERED_OP_KEY, 40 * ONE_MB);
        // Enough memory to go above configured minimum.
        long opMinMem = MemoryAllocationUtilities.computeOperatorMemory(optionManager, 4 * ONE_GB, 2);
        assertEquals(4 * ONE_GB / 10 / 2, opMinMem);
        // Too little memory per operator. Use configured minimum.
        opMinMem = MemoryAllocationUtilities.computeOperatorMemory(optionManager, ONE_GB, 100);
        assertEquals(40 * ONE_MB, opMinMem);
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture) OptionManager(org.apache.drill.exec.server.options.OptionManager) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 8 with OperatorFixture

use of org.apache.drill.test.OperatorFixture in project drill by axbaretto.

the class PerformanceTool method main.

public static void main(String[] args) {
    try (OperatorFixture fixture = OperatorFixture.standardFixture()) {
        for (int i = 0; i < 2; i++) {
            System.out.println((i == 0) ? "Warmup" : "Test run");
            new RequiredVectorTester(fixture).runTest();
            new RequiredWriterTester(fixture).runTest();
            new NullableVectorTester(fixture).runTest();
            new NullableWriterTester(fixture).runTest();
            new RepeatedVectorTester(fixture).runTest();
            new ArrayWriterTester(fixture).runTest();
        }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture)

Example 9 with OperatorFixture

use of org.apache.drill.test.OperatorFixture in project drill by apache.

the class TestQueryMemoryAlloc method testDefaultOptions.

@Test
public void testDefaultOptions() throws Exception {
    OperatorFixture.Builder builder = OperatorFixture.builder(dirTestWatcher);
    builder.systemOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.05);
    builder.systemOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 2 * ONE_GB);
    try (OperatorFixture fixture = builder.build()) {
        final OptionManager optionManager = fixture.getOptionManager();
        optionManager.setLocalOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.05);
        optionManager.setLocalOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 2 * ONE_GB);
        // Out-of-box memory, use query memory per node as floor.
        long mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 8 * ONE_GB);
        assertEquals(2 * ONE_GB, mem);
        // Up to 40 GB, query memory dominates.
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 40 * ONE_GB);
        assertEquals(2 * ONE_GB, mem);
        // After 40 GB, the percent dominates
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 100 * ONE_GB);
        assertEquals(5 * ONE_GB, mem);
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture) OptionManager(org.apache.drill.exec.server.options.OptionManager) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 10 with OperatorFixture

use of org.apache.drill.test.OperatorFixture in project drill by apache.

the class TestQueryMemoryAlloc method testCustomPercent.

@Test
public void testCustomPercent() throws Exception {
    OperatorFixture.Builder builder = OperatorFixture.builder(dirTestWatcher);
    builder.systemOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.10);
    builder.systemOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 2 * ONE_GB);
    try (OperatorFixture fixture = builder.build()) {
        final OptionManager optionManager = fixture.getOptionManager();
        optionManager.setLocalOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.10);
        optionManager.setLocalOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 2 * ONE_GB);
        // Out-of-box memory, use query memory per node as floor.
        long mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 8 * ONE_GB);
        assertEquals(2 * ONE_GB, mem);
        // Up to 20 GB, query memory dominates.
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 20 * ONE_GB);
        assertEquals(2 * ONE_GB, mem);
        // After 20 GB, the percent dominates
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 30 * ONE_GB);
        assertEquals(3 * ONE_GB, mem);
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture) OptionManager(org.apache.drill.exec.server.options.OptionManager) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Aggregations

OperatorFixture (org.apache.drill.test.OperatorFixture)39 Test (org.junit.Test)36 DrillTest (org.apache.drill.test.DrillTest)20 OperatorTest (org.apache.drill.categories.OperatorTest)14 OptionManager (org.apache.drill.exec.server.options.OptionManager)8 StoragePlugins (org.apache.drill.exec.planner.logical.StoragePlugins)7 BatchSchema (org.apache.drill.exec.record.BatchSchema)7 StoragePluginConfig (org.apache.drill.common.logical.StoragePluginConfig)6 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)5 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)5 MockRecordBatch (org.apache.drill.exec.physical.impl.MockRecordBatch)4 RowSet (org.apache.drill.exec.physical.rowSet.RowSet)4 IOException (java.io.IOException)2 AbstractSecuredStoragePluginConfig (org.apache.drill.common.logical.AbstractSecuredStoragePluginConfig)2 BufferAllocator (org.apache.drill.exec.memory.BufferAllocator)2 OperatorContext (org.apache.drill.exec.ops.OperatorContext)2 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)2 DirectRowSet (org.apache.drill.exec.physical.rowSet.DirectRowSet)2 VectorContainer (org.apache.drill.exec.record.VectorContainer)2 MockStorePOP (org.apache.drill.exec.store.mock.MockStorePOP)2