You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2022/03/01 20:12:00 UTC

[jira] [Updated] (SPARK-37593) Reduce default page size by LONG_ARRAY_OFFSET if G1GC and ON_HEAP are used

     [ https://issues.apache.org/jira/browse/SPARK-37593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dongjoon Hyun updated SPARK-37593:
----------------------------------
    Summary: Reduce default page size by LONG_ARRAY_OFFSET if G1GC and ON_HEAP are used  (was: Optimize HeapMemoryAllocator to avoid memory waste when using G1GC)

> Reduce default page size by LONG_ARRAY_OFFSET if G1GC and ON_HEAP are used
> --------------------------------------------------------------------------
>
>                 Key: SPARK-37593
>                 URL: https://issues.apache.org/jira/browse/SPARK-37593
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core, SQL
>    Affects Versions: 3.3.0
>            Reporter: EdisonWang
>            Assignee: EdisonWang
>            Priority: Minor
>             Fix For: 3.3.0
>
>
> Spark's tungsten memory model usually tries to allocate memory by one `page` each time and allocated by long[pageSizeBytes/8] in HeapMemoryAllocator.allocate. 
> Remember that java long array needs extra object header (usually 16 bytes in 64bit system), so the really bytes allocated is pageSize+16.
> Assume that the G1HeapRegionSize is 4M and pageSizeBytes is 4M as well. Since every time we need to allocate 4M+16byte memory, so two regions are used with one region only occupies 16byte. Then there are about 50% memory waste.
> It can happenes under different combinations of G1HeapRegionSize (varies from 1M to 32M) and pageSizeBytes (varies from 1M to 64M).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org