mirror of
https://github.com/apache/impala.git
synced 2025-12-25 02:03:09 -05:00
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 <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
97 lines
3.2 KiB
Plaintext
97 lines
3.2 KiB
Plaintext
====
|
|
---- QUERY
|
|
# CTAS
|
|
create table test as select id from functional.alltypes where id > 1
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=16MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=100MB.*
|
|
row_regex: .*Cluster Memory Admitted: 132.00 MB.*
|
|
====
|
|
---- QUERY
|
|
# Truncate table to run the following inserts.
|
|
truncate table test
|
|
====
|
|
---- QUERY
|
|
# Small insert(i.e. values list, runs on coordinator only).
|
|
insert into test values (1), (2), (3)
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=10MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=100MB.*
|
|
row_regex: .*Cluster Memory Admitted: 10.00 MB.*
|
|
====
|
|
---- QUERY
|
|
# Large insert where it doesn't run on the coordinator.
|
|
insert into test select id from functional.alltypes where id > 3
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=16MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=100MB.*
|
|
row_regex: .*Cluster Memory Admitted: 132.00 MB.*
|
|
====
|
|
---- QUERY
|
|
# SELECT with merging exchange (i.e. order by).
|
|
select * from functional.alltypes order by int_col;
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=32MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=104MB.*
|
|
row_regex: .*Cluster Memory Admitted: 169.47 MB.*
|
|
====
|
|
---- QUERY
|
|
# SELECT with non-merging exchange.
|
|
select * from functional.alltypes;
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=21MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=104MB.*
|
|
row_regex: .*Cluster Memory Admitted: 146.20 MB.*
|
|
====
|
|
---- QUERY
|
|
# SELECT with a non-grouping aggregate in the coordinator fragment.
|
|
select avg(int_col) from functional.alltypes;
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=16MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=100MB.*
|
|
row_regex: .*Cluster Memory Admitted: 132.12 MB.*
|
|
====
|
|
---- QUERY
|
|
# SELECT with num_nodes=1 and a complex plan in the coordinator.
|
|
set num_nodes=1;
|
|
select
|
|
l_returnflag,
|
|
l_linestatus,
|
|
sum(l_quantity) as sum_qty,
|
|
sum(l_extendedprice) as sum_base_price,
|
|
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
|
|
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
|
|
avg(l_quantity) as avg_qty,
|
|
avg(l_extendedprice) as avg_price,
|
|
avg(l_discount) as avg_disc,
|
|
count(*) as count_order
|
|
from
|
|
tpch.lineitem
|
|
where
|
|
l_shipdate <= '1998-09-02'
|
|
group by
|
|
l_returnflag,
|
|
l_linestatus
|
|
order by
|
|
l_returnflag,
|
|
l_linestatus
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=98MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=198MB.*
|
|
row_regex: .*Cluster Memory Admitted: 198.00 MB.*
|
|
====
|
|
---- QUERY
|
|
# SELECT with multiple unpartitioned analytic functions to force the sort and analytics
|
|
# into the coordinator fragment.
|
|
select id,
|
|
min(int_col) over (order by year),
|
|
min(int_col) over (order by bigint_col),
|
|
avg(smallint_col) over (order by int_col),
|
|
max(int_col) over (order by smallint_col rows between unbounded preceding and 1 following)
|
|
from functional.alltypes;
|
|
---- RUNTIME_PROFILE
|
|
row_regex: .*Per-Host Resource Estimates: Memory=46MB.*
|
|
row_regex: .*Dedicated Coordinator Resource Estimate: Memory=124MB.*
|
|
row_regex: .*Cluster Memory Admitted: 216.00 MB.*
|
|
====
|