deniskuzZ opened a new pull request, #6974:
URL: https://github.com/apache/hive/pull/6974

   ### What changes were proposed in this pull request?
   HiveSplitGenerator serializes the splits of a vertex into their event 
payloads on a pool of
   `hive.tez.input.split.serialization.threads` threads (default 8, capped at 
the number of processors available to the
   JVM). Each thread serializes a few contiguous ranges of splits into their 
own slots, so the events keep the split
   order. With 1, Tez serializes the splits on the input initializer's thread, 
as before.
   
   ### Why are the changes needed?
   Tez's `InputSplitInfoMem.getSplitsProto()` serializes the splits one by one 
on the input initializer's thread before
   the events are created. An Iceberg split carries the delete files of its 
data files, so this single-threaded step can
   take seconds of the vertex's initialization.
   
   On a 40-node cluster (r5d.4xlarge), with every measured query on the same 
Tez AM and the settings interleaved:
   
   | scan | split groups | serialization, 1 / 4 / 8 threads | Map 1 
initialization, 1 / 4 / 8 threads |
   |---|---|---|---|
   | V2 table with partition-scoped position deletes | 581 | 7.31-7.52 / 
2.23-2.34 / 1.32-1.60 s | 7.86-8.08 / 2.74-2.86 / 1.88-2.20 s |
   | 1TRC aggregate, snapshot 1 | 19,460 | 1.88-1.92 / 0.58-0.64 / 0.41-0.45 s 
| 3.23-3.33 / 1.94-1.97 / 1.93-1.95 s |
   | 1TRC aggregate, snapshot 2 | 19,467 | 2.56-2.57 / 0.97-1.03 / 0.68-0.69 s 
| 4.37-4.42 / 2.65-2.81 / 2.38-2.40 s |
   | 1TRC aggregate, snapshot 3 | 19,474 | 2.40-2.42 / 0.92-0.93 / 0.66-0.68 s 
| 3.96-4.11 / 2.55-2.57 / 2.38 s |
   
   The first query's execution time went from 9.7-10.2 s to 3.7-4.2 s with 8 
threads. Results were identical for every
   setting.
   
   ### Does this PR introduce _any_ user-facing change?
   - New setting `hive.tez.input.split.serialization.threads`.
   - The time in the "Finished creating events" log line now includes the 
serialization of the splits, which it
     previously excluded, and the line logs the serialization time separately.
   
   The splits of a vertex are now serialized concurrently, so a split's 
`write()` must not change state it shares with
   other splits. The Iceberg, ORC, `HiveInputSplit`, `FileSplit` and 
`TezGroupedSplit` serializers were checked; the
   splits of other storage handlers were not. Setting the threads to 1 restores 
the sequential path.
   
   ### How was this patch tested?
   - `TestHiveSplitGenerator`: the events of 100 splits have the same order and 
payloads with 1 and 8 threads; a split
     that fails to serialize fails the split generation with its `IOException`.
   - The cluster runs above used a build of this patch before the processor cap 
was added, with a default of 4 and
     explicit settings of 1, 4 and 8 threads. The Tez AM pod has no CPU limit, 
so the JVM sees all 16 processors of the
     node and the cap would not have applied.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to