Csaba Ringhofer has posted comments on this change. ( 
https://gerrit.cloudera.org/24784 )

Change subject: IMPALA-15324: Size exchange memory on input rows
......................................................................


Patch Set 4: Code-Review+2

(2 comments)

thx for improving this, just sharing some more thoughts around the area, feel 
free to ignore them for now

https://gerrit.cloudera.org/#/c/24784/4//COMMIT_MSG
Commit Message:

https://gerrit.cloudera.org/#/c/24784/4//COMMIT_MSG@9
PS4, Line 9: ExchangeNode sized both parts of its memory estimate, the row 
batch queues
           : and the deferred RPC payloads, from its own cardinality, which
           : computeStats() has already reduced by the offset. The senders 
never apply
           : that offset: DistributedPlanner clears it on the sender-side sort 
and
           : raises that sort's limit to limit + offset. So every row before 
the offset
           : still reaches the receiver's queues, and both parts were short by 
that many
           : rows.
Just some brain dump:
a way I see to decrease merging exchange mem usage / estimate is to decrease 
sent batch sizes when offset + limit are near instance_num * batch_size. For 
example for 100 hosts, mt_dop=8, batch_size=1024 offset 2000 limit 4000 we 
would allocate memory for 800K rows, while allowing 100 rows per sender would 
be more than enough to reach offset and limit quickly without sending and 
buffering unnecessary rows.


https://gerrit.cloudera.org/#/c/24784/4/fe/src/main/java/org/apache/impala/planner/ExchangeNode.java
File fe/src/main/java/org/apache/impala/planner/ExchangeNode.java:

https://gerrit.cloudera.org/#/c/24784/4/fe/src/main/java/org/apache/impala/planner/ExchangeNode.java@354
PS4, Line 354:     long maxQueueByteSize = 
BackendConfig.INSTANCE.getBackendCfg().
             :         exchg_node_buffer_size_bytes;
             :     // TODO: Should we set a better default size here? This 
might be alot for
             :     // queries without stats.
             :     long estimatedTotalQueueByteSize = numQueues * 
maxQueueByteSize;
A todo could be added for IMPALA-15326 or it could be solved here.

This overestimates actual usage, as now exchg_node_buffer_size_bytes is shared 
by all queues as a soft limit (each sender can have 1 row batch in queue, even 
if the total quota is reached).



--
To view, visit https://gerrit.cloudera.org/24784
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4ab880549e63267f97b2c193cf76aa92bbfc581c
Gerrit-Change-Number: 24784
Gerrit-PatchSet: 4
Gerrit-Owner: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Comment-Date: Tue, 17 Nov 2026 13:54:20 +0000
Gerrit-HasComments: Yes

Reply via email to