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

Chris Nauroth commented on HDFS-5175:
-------------------------------------

Hi Lohit,

{{DFSClient}} currently allows configuration to specify the name of a 
{{SocketFactory}} class.  It will create an instance of this factory and use it 
to create the sockets used for reading by {{DFSInputStream}} and writing by 
{{DFSOutputStream}}.

{code}
  public DFSClient(URI nameNodeUri, ClientProtocol rpcNamenode,
      Configuration conf, FileSystem.Statistics stats)
    throws IOException {
    // Copy only the required DFSClient configuration
    this.dfsClientConf = new Conf(conf);
    this.shouldUseLegacyBlockReaderLocal = 
        this.dfsClientConf.useLegacyBlockReaderLocal;
    if (this.dfsClientConf.useLegacyBlockReaderLocal) {
      LOG.debug("Using legacy short-circuit local reads.");
    }
    this.conf = conf;
    this.stats = stats;
    this.socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
{code}

>From {{NetUtils}}:

{code}
  public static SocketFactory getSocketFactory(Configuration conf,
      Class<?> clazz) {

    SocketFactory factory = null;

    String propValue =
        conf.get("hadoop.rpc.socket.factory.class." + clazz.getSimpleName());
    if ((propValue != null) && (propValue.length() > 0))
      factory = getSocketFactoryFromProperty(conf, propValue);

    if (factory == null)
      factory = getDefaultSocketFactory(conf);

    return factory;
  }
{code}

I think you could potentially implement your requirement by writing a custom 
subclass of {{SocketFactory}} that calls {{Socket#setTrafficClass}}.  Then, in 
your configuration, set {{hadoop.rpc.socket.factory.class.ClientProtocol}} to 
the fully-qualified name of your class.

Does this help?

                
> Provide clients a way to set IP header bits on connections
> ----------------------------------------------------------
>
>                 Key: HDFS-5175
>                 URL: https://issues.apache.org/jira/browse/HDFS-5175
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.0.5-alpha
>            Reporter: Lohit Vijayarenu
>
> It would be very helpful if we had ability for clients to set IP headers when 
> they make socket connections for data transfers. We were looking into setting 
> up QoS using DSCP bit and saw that there is no easy way to let clients pass 
> down a specific value when clients make connection to DataNode.
> As a quick fix we did something similar to io.file.buffer.size where client 
> could pass down DSCP integer value and when DFSClient opens a stream, it 
> could set the value on socket using setTrafficClass
> Opening this JIRA to get more inputs from others who have had experience and 
> might have already thought about this. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to