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);
}
}
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);
}
}
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();
}
}
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);
}
}
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);
}
}
Aggregations