Zoltán Borók-Nagy created IMPALA-15861:
------------------------------------------
Summary: Coalesce row batches in broadcast KrpcDataStreamSenders
while an RPC is in flight
Key: IMPALA-15861
URL: https://issues.apache.org/jira/browse/IMPALA-15861
Project: IMPALA
Issue Type: Improvement
Components: Backend
Reporter: Zoltán Borók-Nagy
An UNPARTITIONED (broadcast) KrpcDataStreamSender sends every input row batch
to every channel as its own TransmitData() RPC, with one RPC in flight per
channel (IMPALA-15519 would allow more). The queue from IMPALA-15080 holds
ready batches but still sends them one RPC each. At the default batch size of
1024 rows, a large broadcast is bound by network round trips rather than
bandwidth. Example on master: TPC-DS SF10000 q15 with
COMPUTE_PROCESSING_COST=true on 3 executors with 64 vCPUs each. The 3 instances
of broadcast fragment F02 sent 63,487 RPCs of 12.9 KiB each on average, and
their senders spent 19.6 of their 20.3 s waiting for in-flight RPCs, in a 28.9
s query.
Proposal: when a broadcast sender with more than one channel gets an input
batch while rows are pending or any channel is busy, append the rows to one
pending batch. Send it once every channel is idle, before it would exceed a
byte target (for example 1 MiB) or a row cap, and at end of stream. While the
network keeps up nothing is pending. A prototype with a 1 MiB target, which
sends only when an input batch finds every channel idle, was measured on the
same 3 executors. TPC-H SF1000 with COMPUTE_PROCESSING_COST=true went from
228.9 to 197.5 s (-13.7%: sum of per-query best of 3 iterations, mean of 2
runs, without q4, q9, q13 and q21; -9.8% with them). TPC-DS q6, q15, q35, q38,
q45 and q87 went from 198.0 to 87.5 s (-55.8%, 1 run); q24-1 matched master. On
12 executors with 16 vCPUs the gains were 2.5% and 7.1%.
Risk: pending rows let a busy broadcast sender's producer run ahead until the
pending batch is full, where master blocks it once both of its 2 batches are in
use. In TPC-DS q2 on 12 executors this makes the date_dim scan 3.7-4.5x faster,
and 43,008-73,049 of its rows pass before a runtime filter that arrives 12-15
ms after the scan's 1 s wait, against 11,264-14,336 rows without coalescing.
Fact-scan pruning then fails and q2's median over 10 iterations rises from 4.9
to 13.0 s; with RUNTIME_FILTER_WAIT_TIME_MS=10000 it is 5.1 s. On that cluster
q2 was fast in all 39 iterations without coalescing and slow in 21 of 22 with
it; one master iteration on 3 executors also hit the race (14.5 s). The
prototype also holds pending rows until the next input batch when the producer
stalls (1.66 s per sender instance in q24-1); sending them when the last
in-flight RPC finishes avoids that.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)