hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r805252 - in /hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc: HBaseClient.java HBaseServer.java
Date Tue, 18 Aug 2009 02:06:52 GMT
Author: apurtell
Date: Tue Aug 18 02:06:51 2009
New Revision: 805252

URL: http://svn.apache.org/viewvc?rev=805252&view=rev
Log:
HBASE-1754 use TCP keepalives

Modified:
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=805252&r1=805251&r2=805252&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Tue Aug 18 02:06:51
2009
@@ -77,6 +77,7 @@
                            //maxIdleTime msecs
   final protected int maxRetries; //the max. no. of retries for socket connections
   protected boolean tcpNoDelay; // if T then disable Nagle's Algorithm
+  protected boolean tcpKeepAlive; // if T then use keepalives
   protected int pingInterval; // how often sends ping to the server in msecs
 
   protected SocketFactory socketFactory;           // how to create sockets
@@ -301,6 +302,7 @@
           try {
             this.socket = socketFactory.createSocket();
             this.socket.setTcpNoDelay(tcpNoDelay);
+            this.socket.setKeepAlive(tcpKeepAlive);
             // connection time out is 20s
             NetUtils.connect(this.socket, remoteId.getAddress(), 20000);
             this.socket.setSoTimeout(pingInterval);
@@ -637,6 +639,7 @@
       conf.getInt("ipc.client.connection.maxidletime", 10000); //10s
     this.maxRetries = conf.getInt("ipc.client.connect.max.retries", 10);
     this.tcpNoDelay = conf.getBoolean("ipc.client.tcpnodelay", false);
+    this.tcpKeepAlive = conf.getBoolean("ipc.client.tcpkeepalive", true);
     this.pingInterval = getPingInterval(conf);
     if (LOG.isDebugEnabled()) {
       LOG.debug("The ping interval is" + this.pingInterval + "ms.");

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java?rev=805252&r1=805251&r2=805252&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java Tue Aug 18 02:06:51
2009
@@ -145,7 +145,8 @@
 
   private int maxQueueSize;
   protected int socketSendBufferSize;
-  protected final boolean tcpNoDelay; // if T then disable Nagle's Algorithm
+  protected final boolean tcpNoDelay;   // if T then disable Nagle's Algorithm
+  protected final boolean tcpKeepAlive; // if T then use keepalives
 
   volatile protected boolean running = true;         // true while server runs
   protected BlockingQueue<Call> callQueue; // queued calls
@@ -391,6 +392,7 @@
 
         channel.configureBlocking(false);
         channel.socket().setTcpNoDelay(tcpNoDelay);
+        channel.socket().setKeepAlive(tcpKeepAlive);
         SelectionKey readKey = channel.register(selector, SelectionKey.OP_READ);
         c = new Connection(channel, System.currentTimeMillis());
         readKey.attach(c);
@@ -998,6 +1000,7 @@
     this.rpcMetrics = new HBaseRpcMetrics(serverName,
                           Integer.toString(this.port));
     this.tcpNoDelay = conf.getBoolean("ipc.server.tcpnodelay", false);
+    this.tcpKeepAlive = conf.getBoolean("ipc.server.tcpkeepalive", true);
 
     // Create the responder here
     responder = new Responder();



Mime
View raw message