[ 
https://issues.apache.org/jira/browse/HADOOP-6287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12760335#action_12760335
 ] 

Doug Cutting commented on HADOOP-6287:
--------------------------------------

> Configuration.getStorage("io.file.buffer.size", KB);

What would be in the config?  "128" or "128KB"?  Would the specified units just 
be the default, or would it always multiple the value by 1024?

If a parameter is always in kilobytes, then its name should perhaps state that, 
e.g., "io.file.buffer.kb" or somesuch.  Otherwise it seems wise to include 
multipliers in the text of the value, e.g., "128k".

So we could leave off the "B" and add this to getInt() and getLong().  The 
documentation for a parameter can then indicate whether its bits or bytes or 
milliseconds.  The value is just a number, and we permit multipliers for 
numbers, k=1024, m=k*k, etc.

Alternately, we might require the "B" and use a 'long getBytes(String)' method, 
e.g. "1024", "1kB", "10GB".

For bandwidth we could then use a separate method, "float 
getBytesPerSecond(String)" that accepts things like "10MB/s", "100Mb/s", and 
"1Gbps".

For time we could have Configuration#getMilliseconds().  If no units are spec'd 
or "ms" is spec'd then it would return the same value as getLong(), but if it 
ended in in "s", "m", or "h" or it had colons then it could be treated 
differently.  Example values might be "10ms", "2.5h", "2:30:00", "1d".

Thoughts?

> Support units for configuration knobs
> -------------------------------------
>
>                 Key: HADOOP-6287
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6287
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: conf
>            Reporter: Arun C Murthy
>            Assignee: Eli Collins
>         Attachments: hadoop-6287-1.patch
>
>
> We should add support for units in our Configuration system so that we can 
> specify values to be *1GB* or *1MB* rather than forcing every component which 
> consumes such values to be aware of these.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to