Skip to content

[optimize] Optimize spark load/broker load reading parquet format file #3877

Description

@xy720

Currently, broker load support reading parquet file from remote, and soon we will use parquet file as be's loading source in spark load.

But due to the seperated metadata (file meta/column meta/page header...) location of parquet file, broker reader need frequently seek to get data, which leads to a lot of RPCs. And large amount of RPCs will lead to huge network costs in cross-data-center scene.

You can see a big gap of cost in the parquet reading below between non-cross-data-center and cross-data-center scene.

(The rpc times means how many times per broker seeks during loading)

spark load

cross-centerrpc timesload timedata size
No1501460s560m
Yes168172h560m
No1697668min5.8G
Yes15047614h5.8G

broker load

cross-centerrpc timesload timedata size
No517802min250m
Yes5141342min250m

As a proposal, I suggest to add a cache buffer array in broker reader reading process.

Illustration:
When a broker about to seek for a position and get data from remote parquet file, try reading with this position in the cache buffer array. Once the expected data hits the cache buffer array, then we don't bother to read data from remote parquet file.

Our final purpose is to reduce the number of rpc times as much as we could, so I make some testing to validate.

Test:
The test data I used is ssb lineorder, the target table is unpartitioned with 8 buckets.

FieldTypeNullKeyDefaultExtra
lo_orderkeyBIGINTYestrueN/A
lo_linenumberBIGINTYestrueN/A
lo_custkeyINTYestrueN/A
lo_partkeyINTYestrueN/A
lo_suppkeyINTYestrueN/A
lo_orderdateINTYestrueN/A
lo_orderpriotityVARCHAR(16)YesfalseN/AREPLACE
lo_shippriotityINTYesfalseN/ASUM
lo_quantityBIGINTYesfalseN/ASUM
lo_extendedpriceBIGINTYesfalseN/ASUM
lo_ordtotalpriceBIGINTYesfalseN/ASUM
lo_discountBIGINTYesfalseN/ASUM
lo_revenueBIGINTYesfalseN/ASUM
lo_supplycostBIGINTYesfalseN/ASUM
lo_taxBIGINTYesfalseN/ASUM
lo_commitdateBIGINTYesfalseN/ASUM
lo_shipmodeVARCHAR(11)YesfalseN/AREPLACE

spark load

cross-centerrpc timesload timedata sizebuffer size
Yes168172h560mN/A
Yes6133min560m128k
Yes5293min560m512k
Yes2853min560m1m
cross-centerrpc timesload timedata sizebuffer size
No1501460s560mN/A
No63433s560m128k
No52629s560m512k
No42327s560m1m
cross-centerrpc timesload timedata sizebuffer size
Yes15047614h5.8gN/A
Yes654745min5.8g128k
Yes567037min5.8g512k
Yes559841min5.8g1m
cross-centerrpc timesload timedata sizebuffer size
No1697668min5.8gN/A
No67735min5.8g128k
No56674min5.8g512k
No58795min5.8g1m

broker load

cross-centerrpc timesload timedata sizebuffer size
Yes5141342min250mN/A
Yes187320min250m512k
cross-centerrpc timesload timedata sizebuffer size
No517802min250mN/A
No179855s250m512k

It can be seen that whether it is cross-data-center or not, adding the cache buffer array can reduce the number of RPC and improve the loading performance.

May be there still improve space in the Cache Policy, such as LRU-cache or someting else, we should try that gradually later.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stalearea/brokerIssues or PRs related to brokerarea/loadIssues or PRs related to all kinds of loadkind/improvementproposalCategorizes an issue is a proposal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions