[ 
https://issues.apache.org/jira/browse/IMPALA-6684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626378#comment-17626378
 ] 

ASF subversion and git services commented on IMPALA-6684:
---------------------------------------------------------

Commit e327a28757ee0540d89f5a4baaa43cf8ded2eaee in impala's branch 
refs/heads/dependabot/maven/fe/org.eclipse.jetty-jetty-server-9.4.41.v20210516 
from TheOmid
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=e327a2875 ]

IMPALA-6684: Fix untracked memory in KRPC

During serialization of a row batch header, a tuple_data_ is created
which will hold the compressed tuple data for an outbound row batch.
We would like this tuple data to be trackable as it is responsible for
a significant portion of untrackable memory from the krpc data stream
sender. By using MemTrackerAllocator, we can allocate tuple data and
compression scratch and account for it in the memory tracker of the
KrpcDataStreamSender. This solution replaces the type for tuple data
and compression scratch from std::string to TrackedString, an
std:basic_string with MemTrackerAllocator as the custom allocator.

This patch adds memory estimation in DataStreamSink.java to account
for OutboundRowBatch memory allocation. This patch also removes the
thrift-based serialization because the thrift RPC has been removed
in the prior commit.

Testing:
 - Passed core tests.
 - Ran a single node benchmark which shows no regression.
 - Updated row-batch-serialize-test and row-batch-serialize-benchmark
   to test the row-batch serialization used by KRPC.
 - Manually collected query-profile, heap growth, and memory usage log
   showing untracked memory decreased by 1/2.
 - Add test_datastream_sender.py to verify the peak memory of EXCHANGE
   SENDER node.
 - Raise mem_limit in two of test_spilling_large_rows test case.
 - Print test line number in PlannerTestBase.java

New row-batch serialization benchmark:

Machine Info: Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz
serialize:            10%   50%   90%     10%     50%     90%
                                        (rel)   (rel)   (rel)
-------------------------------------------------------------
   ser_no_dups_base  18.6  18.8  18.9      1X      1X      1X
        ser_no_dups  18.5  18.5  18.8  0.998X  0.988X  0.991X
   ser_no_dups_full  14.7  14.8  14.8  0.793X   0.79X  0.783X

  ser_adj_dups_base  28.2  28.4  28.8      1X      1X      1X
       ser_adj_dups  68.9  69.1  69.8   2.44X   2.43X   2.43X
  ser_adj_dups_full  56.2  56.7  57.1   1.99X      2X   1.99X

      ser_dups_base  20.7  20.9  20.9      1X      1X      1X
           ser_dups  20.6  20.8  20.9  0.994X  0.995X      1X
      ser_dups_full  39.8    40  40.5   1.93X   1.92X   1.94X

deserialize:          10%   50%   90%     10%     50%     90%
                                        (rel)   (rel)   (rel)
-------------------------------------------------------------
 deser_no_dups_base  75.9  76.6    77      1X      1X      1X
      deser_no_dups  74.9  75.6    76  0.987X  0.987X  0.987X

deser_adj_dups_base   127   128   129      1X      1X      1X
     deser_adj_dups   179   193   195   1.41X   1.51X   1.51X

    deser_dups_base   128   128   129      1X      1X      1X
         deser_dups   165   190   193   1.29X   1.48X   1.49X

Change-Id: I2ba2b907ce4f275a7a1fb8cf75453c7003eb4b82
Reviewed-on: http://gerrit.cloudera.org:8080/18798
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Large payload going through exchange results in lots of untracked memory in 
> the form of a string
> ------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-6684
>                 URL: https://issues.apache.org/jira/browse/IMPALA-6684
>             Project: IMPALA
>          Issue Type: Sub-task
>          Components: Distributed Exec
>    Affects Versions: Impala 2.11.0
>            Reporter: Mostafa Mokhtar
>            Assignee: Omid Shahidi
>            Priority: Major
>             Fix For: Impala 4.2.0
>
>         Attachments: Untracked memory profile.txt, 
> heap_profile_growth_40GB.pdf
>
>
> While running a query that shuffles 1GB rows noticed that there is a large 
> amount of untracked memory in the form of a string, this issue repros 
> with/without KRPC.
> [~tgar] identified that the memory is from *tuple_data_* and that the while 
> the payload is transient much of the memory untracked. 
> [https://github.com/apache/impala/blob/master/be/src/runtime/row-batch.h#L88]
> {code:java}
> Process: Limit=200.00 GB Total=22.85 GB Peak=201.03 GB
>   Buffer Pool: Free Buffers: Total=4.13 GB
>   Buffer Pool: Clean Pages: Total=0
>   Buffer Pool: Unused Reservation: Total=-2.00 GB
>   Data Stream Service Queue: Limit=10.00 GB Total=0 Peak=1.00 GB
>   Data Stream Manager Deferred RPCs: Total=0 Peak=27.70 KB
>   TCMalloc Overhead: Total=206.90 MB
>   Free Disk IO Buffers: Total=1.15 GB Peak=1.89 GB
>   RequestPool=root.jenkins: Total=0 Peak=13.32 GB
>   RequestPool=root.mmokhtar: Total=13.67 GB Peak=117.15 GB
>     Query(ec4cab0940313fdd:d6196e4800000000): Reservation=72.00 MB 
> ReservationLimit=160.00 GB OtherMemory=13.60 GB Total=13.67 GB Peak=13.67 GB
>       Unclaimed reservations: Reservation=2.00 MB OtherMemory=0 Total=2.00 MB 
> Peak=176.00 MB
>       Fragment ec4cab0940313fdd:d6196e480000002b: Reservation=34.00 MB 
> OtherMemory=4.00 GB Total=4.03 GB Peak=4.03 GB
>         AGGREGATION_NODE (id=11): Total=24.00 KB Peak=24.00 KB
>           Exprs: Total=4.00 KB Peak=4.00 KB
>         HASH_JOIN_NODE (id=10): Reservation=34.00 MB OtherMemory=34.25 KB 
> Total=34.03 MB Peak=34.05 MB
>           Exprs: Total=13.12 KB Peak=13.12 KB
>           Hash Join Builder (join_node_id=10): Total=13.12 KB Peak=21.12 KB
>             Hash Join Builder (join_node_id=10) Exprs: Total=13.12 KB 
> Peak=13.12 KB
>         EXCHANGE_NODE (id=20): Reservation=4.00 GB OtherMemory=0 Total=4.00 
> GB Peak=4.00 GB
>           KrpcDeferredRpcs: Total=0 Peak=0
>         EXCHANGE_NODE (id=21): Reservation=0 OtherMemory=0 Total=0 Peak=16.00 
> KB
>           KrpcDeferredRpcs: Total=0 Peak=0
>         KrpcDataStreamSender (dst_id=22): Total=5.12 KB Peak=5.12 KB
>         CodeGen: Total=7.79 KB Peak=1.46 MB
>       Fragment ec4cab0940313fdd:d6196e480000000f: Reservation=36.00 MB 
> OtherMemory=9.60 GB Total=9.63 GB Peak=9.63 GB
>         UNION_NODE (id=0): Total=2.09 GB Peak=2.09 GB
>           Exprs: Total=2.07 GB Peak=2.07 GB
>         AGGREGATION_NODE (id=13): Reservation=36.00 MB OtherMemory=5.44 GB 
> Total=5.48 GB Peak=5.48 GB
>           Exprs: Total=5.44 GB Peak=5.44 GB
>         EXCHANGE_NODE (id=12): Reservation=0 OtherMemory=0 Total=0 Peak=57.54 
> MB
>           KrpcDeferredRpcs: Total=0 Peak=8.30 MB
>         AGGREGATION_NODE (id=15): Total=17.12 KB Peak=17.12 KB
>           Exprs: Total=17.12 KB Peak=17.12 KB
>         EXCHANGE_NODE (id=14): Reservation=16.00 KB OtherMemory=0 Total=16.00 
> KB Peak=16.00 KB
>           KrpcDeferredRpcs: Total=0 Peak=0
>         KrpcDataStreamSender (dst_id=20): Total=1.03 GB Peak=1.03 GB
>         CodeGen: Total=8.04 KB Peak=1.02 MB
>       Fragment ec4cab0940313fdd:d6196e4800000007: Reservation=0 OtherMemory=0 
> Total=0 Peak=6.36 GB
>         AGGREGATION_NODE (id=2): Reservation=0 OtherMemory=0 Total=0 
> Peak=5.92 GB
>         HDFS_SCAN_NODE (id=1): Total=0 Peak=535.01 MB
>         KrpcDataStreamSender (dst_id=12): Total=0 Peak=84.57 MB
>         CodeGen: Total=0 Peak=592.00 KB
>       Fragment ec4cab0940313fdd:d6196e480000000e: Reservation=0 OtherMemory=0 
> Total=0 Peak=2.34 MB
>         AGGREGATION_NODE (id=4): Reservation=0 OtherMemory=0 Total=0 
> Peak=2.02 MB
>         HDFS_SCAN_NODE (id=3): Total=0 Peak=280.00 KB
>         KrpcDataStreamSender (dst_id=14): Total=0 Peak=35.82 KB
>         CodeGen: Total=0 Peak=622.00 KB
>       Fragment ec4cab0940313fdd:d6196e4800000024: Reservation=0 OtherMemory=0 
> Total=0 Peak=34.22 MB
>         UNION_NODE (id=5): Total=0 Peak=0
>         AGGREGATION_NODE (id=17): Reservation=0 OtherMemory=0 Total=0 
> Peak=34.02 MB
>         EXCHANGE_NODE (id=16): Reservation=0 OtherMemory=0 Total=0 Peak=64.00 
> KB
>           KrpcDeferredRpcs: Total=0 Peak=0
>         AGGREGATION_NODE (id=19): Reservation=0 OtherMemory=0 Total=0 
> Peak=1.96 MB
>         EXCHANGE_NODE (id=18): Reservation=0 OtherMemory=0 Total=0 Peak=16.00 
> KB
>           KrpcDeferredRpcs: Total=0 Peak=0
>         KrpcDataStreamSender (dst_id=21): Total=0 Peak=103.53 KB
>         CodeGen: Total=0 Peak=491.50 KB
>       Fragment ec4cab0940313fdd:d6196e4800000023: Reservation=0 OtherMemory=0 
> Total=0 Peak=2.67 MB
>         AGGREGATION_NODE (id=9): Reservation=0 OtherMemory=0 Total=0 
> Peak=2.02 MB
>         HDFS_SCAN_NODE (id=8): Total=0 Peak=552.00 KB
>         KrpcDataStreamSender (dst_id=18): Total=0 Peak=99.53 KB
>         CodeGen: Total=0 Peak=504.50 KB
>       Fragment ec4cab0940313fdd:d6196e480000001c: Reservation=0 OtherMemory=0 
> Total=0 Peak=280.68 MB
>         AGGREGATION_NODE (id=7): Reservation=0 OtherMemory=0 Total=0 
> Peak=34.05 MB
>         HDFS_SCAN_NODE (id=6): Total=0 Peak=246.54 MB
>         KrpcDataStreamSender (dst_id=16): Total=0 Peak=127.53 KB
>         CodeGen: Total=0 Peak=474.50 KB
>   Untracked Memory: Total=5.70 GB
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to