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

Nicolas Liochon commented on HBASE-10490:
-----------------------------------------

Nice catch. The max idle time is actually used on the server as well. But it 
does not really work, because the default are different:
server: maxIdleTime = 2*conf.getInt("ipc.client.connection.maxidletime", 1000);
client: maxIdleTime = conf.getInt("hbase.ipc.client.connection.maxidletime", 
10000); //10s

So it means that the server disconnects any client that have not spoken for 2 
seconds; while the client pings every 10 seconds.
not as well that one is prefixed by 'hbase.' while the other is not.  In 2008 
they were sharing the same name then it diverged.

I suppose the code on the server doesn't do much because of this:
{code}
  protected int thresholdIdleConnections;         // the number of idle
                                                  // connections after which we
                                                  // will start cleaning up idle
                                                  // connections
{code}

thresholdIdleConnections is defaulted to 4000. Likely it never happens, and if 
it was happening it would not work because of the difference in default values.

I suppose the best way of doing this is: "order the connection not used for at 
least x seconds, kills some of the oldest".

But, we can say as well that if we're satisfied with the way the server behaves 
today, we can remove the ping on the client without changing anything in the 
server: the behavior won't change.



> Simplify RpcClient code
> -----------------------
>
>                 Key: HBASE-10490
>                 URL: https://issues.apache.org/jira/browse/HBASE-10490
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 0.99.0
>            Reporter: Nicolas Liochon
>            Assignee: Nicolas Liochon
>             Fix For: 0.99.0
>
>         Attachments: 10490.v1.patch
>
>
> The code is complex. Here is a set of proposed changes, for trunk:
> 1) remove PingInputStream. if rpcTimeout > 0 it just rethrows the exception. 
> I expect that we always have a rpcTimeout. So we can remove the code.
> 2) remove the sendPing: instead, just close the connection if it's not used 
> for a while, instead of trying to ping the server.
> 3) remove maxIddle time: to avoid the confusion if someone has overwritten 
> the conf.
> 4) remove shouldCloseConnection: it was more or less synchronized with 
> closeException. Having a single variable instead of two avoids the synchro
> 5) remove lastActivity: instead of trying to have an exact timeout, just kill 
> the connection after some time. lastActivity could be set to wrong values if 
> the server was slow to answer.
> 6) hopefully, a better management of the exception; we don't use the close 
> exception of someone else as an input for another one.  Same goes for 
> interruption.
> I may have something wrong in the code. I will review it myself again. 
> Feedback welcome, especially on the ping removal: I hope I got all the use 
> cases. 



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to