Search in sources :

Example 6 with Configuration

use of org.neo4j.unsafe.impl.batchimport.Configuration in project neo4j by neo4j.

the class DynamicProcessorAssignerTest method shouldAssignAdditionalCPUToBottleNeckStep.

@Test
public void shouldAssignAdditionalCPUToBottleNeckStep() throws Exception {
    // GIVEN
    Configuration config = movingAverageConfig(10);
    DynamicProcessorAssigner assigner = new DynamicProcessorAssigner(config, 5);
    ControlledStep<?> slowStep = stepWithStats("slow", 0, avg_processing_time, 10L, done_batches, 10L);
    ControlledStep<?> fastStep = stepWithStats("fast", 0, avg_processing_time, 2L, done_batches, 10L);
    StageExecution execution = executionOf(config, slowStep, fastStep);
    assigner.start(execution);
    // WHEN
    assigner.check(execution);
    // THEN
    assertEquals(5, slowStep.processors(0));
    assertEquals(1, fastStep.processors(0));
}
Also used : Configuration(org.neo4j.unsafe.impl.batchimport.Configuration) Test(org.junit.Test)

Example 7 with Configuration

use of org.neo4j.unsafe.impl.batchimport.Configuration in project neo4j by neo4j.

the class DynamicProcessorAssignerTest method shouldHandleZeroAverage.

@Test
public void shouldHandleZeroAverage() throws Exception {
    // GIVEN
    Configuration config = movingAverageConfig(10);
    DynamicProcessorAssigner assigner = new DynamicProcessorAssigner(config, 5);
    ControlledStep<?> aStep = stepWithStats("slow", 0, avg_processing_time, 0L, done_batches, 0L);
    ControlledStep<?> anotherStep = stepWithStats("fast", 0, avg_processing_time, 0L, done_batches, 0L);
    StageExecution execution = executionOf(config, aStep, anotherStep);
    assigner.start(execution);
    // WHEN
    assigner.check(execution);
    // THEN
    assertEquals(1, aStep.processors(0));
    assertEquals(1, anotherStep.processors(0));
}
Also used : Configuration(org.neo4j.unsafe.impl.batchimport.Configuration) Test(org.junit.Test)

Aggregations

Configuration (org.neo4j.unsafe.impl.batchimport.Configuration)7 Test (org.junit.Test)5 BufferedOutputStream (java.io.BufferedOutputStream)2 File (java.io.File)2 OutputStream (java.io.OutputStream)2 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)2 BufferedReader (java.io.BufferedReader)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 Writer (java.io.Writer)1 StandardCharsets (java.nio.charset.StandardCharsets)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 StandardCopyOption (java.nio.file.StandardCopyOption)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 List (java.util.List)1 Optional (java.util.Optional)1