You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/08/18 04:05:39 UTC

svn commit: r805250 - in /hadoop/hbase/branches/0.20: CHANGES.txt src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java

Author: apurtell
Date: Tue Aug 18 02:05:39 2009
New Revision: 805250

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

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=805250&r1=805249&r2=805250&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Tue Aug 18 02:05:39 2009
@@ -569,6 +569,7 @@
    HBASE-1771  PE sequentialWrite is 7x slower because of
                MemStoreFlusher#checkStoreFileCount
    HBASE-1772  Up the default ZK session timeout from 30seconds to 60seconds
+   HBASE-1754  Use TCP keepalives
 
   OPTIMIZATIONS
    HBASE-1412  Change values for delete column and column family in KeyValue

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=805250&r1=805249&r2=805250&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Tue Aug 18 02:05:39 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/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java?rev=805250&r1=805249&r2=805250&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ipc/HBaseServer.java Tue Aug 18 02:05:39 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();