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

ASF GitHub Bot commented on FLINK-6469:
---------------------------------------

Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5448#discussion_r191199370
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServicesConfiguration.java
 ---
    @@ -223,9 +224,17 @@ public static TaskManagerServicesConfiguration 
fromConfiguration(
                                parseQueryableStateConfiguration(configuration);
     
                // extract memory settings
    -           long configuredMemory = 
configuration.getLong(TaskManagerOptions.MANAGED_MEMORY_SIZE);
    +           long configuredMemory = 
Long.valueOf(TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue());
    +           if 
(!configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE).equals(TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue()))
 {
    +                   try {
    +                           configuredMemory = 
MemorySize.parse(configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE)).getMebiBytes();
    +                   } catch (IllegalArgumentException e) {
    +
    +                   }
    +           }
    --- End diff --
    
    Same comments as before.  How about code like this:
    
        long configuredMemory;
        String managedMemorySizeDefaultVal = 
TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue();
        if 
(!config.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE).equals(managedMemorySizeDefaultVal))
 {
                try {
                        configuredMemory = 
MemorySize.parse(config.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE))
                                .getMebiBytes();
                } catch (IllegalArgumentException e) {
                        throw new IllegalConfigurationException(
                                "Could not read " + 
TaskManagerOptions.MANAGED_MEMORY_SIZE.key(), e);
                }
        } else {
                configuredMemory = Long.valueOf(managedMemorySizeDefaultVal);
        }


> Configure Memory Sizes with units
> ---------------------------------
>
>                 Key: FLINK-6469
>                 URL: https://issues.apache.org/jira/browse/FLINK-6469
>             Project: Flink
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Stephan Ewen
>            Assignee: vinoyang
>            Priority: Major
>
> Currently, memory sizes are configured by pure numbers, the interpretation is 
> different from configuration parameter to parameter.
> For example, heap sizes are configured in megabytes, network buffer memory is 
> configured in bytes, alignment thresholds are configured in bytes.
> I propose to configure all memory parameters the same way, with units similar 
> to time. The JVM itself configured heap size similarly: {{Xmx5g}} or 
> {{Xmx2000m}}.
> {code}
> 10000  -> bytes
> 10 kb
> 64 mb
> 1 gb
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to