How to determine a good partition plan to ensure CPU balance in JSR 352?

JSR 352 - Packaged applications for the Java platform provide a parallelism function using partitions. Batch runtime can perform a step in different sections to speed things up. JSR 352 also introduces a definition threads: we can determine the number of threads used, for example

<step id="Step1">
    <chunk .../>
        <partition>
            <plan partitions="3" threads="2"/>
        </partition>
    </chunk>
</step>

Then I feel embarrassed: how do I give an estimated partition plan so that each thread is busy and ensures CPU balance?

For example, there is a table A, B, C, and their rows are respectively 1 billion, 1 million, 1 thousand. The goal is to process these objects in documents, one organization moved to one document. The procedure for producing documents is not important. The CPU time for these objects is 1 s, 2 s, 5 s, respectively. The number of threads is 4.

If there are 3 sections, one for the table type, then the step will take 1 * 10^9seconds, because:

  • Section A will take 1 * 10^9 * 1s = 1 * 10^9s, run in thread 2
  • Section B will take 1 * 10^6 * 2s = 2 * 10^6s, start in thread 3
  • Section C will take 1 * 10^3 * 5s = 5 * 10^3s, run in stream 4

However, although thread 2 is busy, thread 3 is free, since 2 * 10^6sthread 4 is free as well 5 * 10^3s. Obviously, this is not a good partition plan.

My questions:

  • ?
  • : - , ?
  • , / ? ?
  • , , ?
+4
1

...

?

, . . 4...

: - , ?

!

, / ? ?

. ... JSR-352, "threads" :

   . , ; , , . . .

, , , ( !).

Runtime Runtime ( JSR352). . , N, , , N .

JBeret - JSR352, wildfly ( , ). Wildfly , 10 . , . , 2 , 2 . , , ... , , 2 , 3! ( , )... () !

, : , JSR325 , .

. ( ) "threads" .

, . (, ) , , . , "theads".

"threads" , CPU. , ; , . , , , .

, , ?

( , ). Partition Mapper. Partition Mapper - , javax.batch.api.partition.PartitionMapper ( , , ). (A, B, C) N ( N = 1000)... . C (): C0, B0, A0, B1, A1,..., B999, A999, A1000,..., A999999... , C , , A B. B , , A.

, ...

+2

Source: https://habr.com/ru/post/1649635/


All Articles