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

Xintong Song commented on FLINK-18353:
--------------------------------------

{quote}Regarding whether to limit direct memory, we could set the limit only if 
user explicitly configures the off-heap memory.
{quote}
I'm not sure about this. The original purpose of 
`jobmanager.memory.off-heap.size` is for the users to control among the JM 
total memory, how many goes into heap and how many goes into off-heap, or to 
derive total memory from heap & off-heap size. Setting 
`-XX:MaxDirectMemorySize` only if `jobmanager.memory.off-heap.size` is 
explicitly set, this sounds very counter-intuitive to me. I can see the 
potential benefit for this proposal, but I would try to avoid such implicit 
behavior if possible.

Alternatively, if we do want to keep both options (setting the direct limit, 
and not), we may introduce another configuration option 
`jobmanager.memory.enable-direct-limit`. If this option is set to `true`, we 
set the direct limit to either the explicitly configured size of 
`jobmanager.memory.off-heap.size` or its default value if not explicitly 
configured. If this option is set to `false`, we don't set the direct limit. 
Introducing another configuration option might complicate things a bit, but 
would be better, IMO, compared to implicitly deciding setting the limit in some 
cases and not setting in others cases.

Just to clarify my opinions on the discussed approaches.
 * +0.51 for keeping the direct limit
 * +0.49 for introducing a configuration option controlling whether to set the 
direct limit
 * +0 for completely remove the direct limit
 * -1 for set the direct limit only if the off-heap configuration option is 
explicitly set

> [1.11.0] maybe document jobmanager behavior change regarding 
> -XX:MaxDirectMemorySize
> ------------------------------------------------------------------------------------
>
>                 Key: FLINK-18353
>                 URL: https://issues.apache.org/jira/browse/FLINK-18353
>             Project: Flink
>          Issue Type: Improvement
>          Components: Documentation, Runtime / Configuration
>    Affects Versions: 1.11.0
>            Reporter: Steven Zhen Wu
>            Priority: Major
>
> I know FLIP-116 (Unified Memory Configuration for Job Managers) is introduced 
> in 1.11. That does cause a small behavior change regarding 
> `-XX:MaxDirectMemorySize`. Previously, jobmanager don't set JVM arg 
> `-XX:MaxDirectMemorySize`, which means JVM can use up to -`Xmx` size for 
> direct memory. Now `-XX:MaxDirectMemorySize` is always set to 
> [jobmanager.memory.off-heap.size|https://ci.apache.org/projects/flink/flink-docs-master/ops/config.html#jobmanager-memory-off-heap-size]
>  config (default 128 mb).
>  
> {{It is possible for jobmanager to get "java.lang.OufOfMemoryError: Direct 
> Buffer Memory" without tuning 
> }}{{[jobmanager.memory.off-heap.size|https://ci.apache.org/projects/flink/flink-docs-master/ops/config.html#jobmanager-memory-off-heap-size]}}
>  especially for high-parallelism jobs. Previously, no tuning needed.
>  
> Maybe we should point out the behavior change in the migration guide?
> [https://ci.apache.org/projects/flink/flink-docs-master/ops/memory/mem_migration.html#migrate-job-manager-memory-configuration]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to