[HUE-6090] Hue to do a keep alive on idle sessions to HiveServer2

Review Request #9874 - Created March 20, 2017 and updated

Prakash Ranade
cconner, enricoberti, jennykim, johan, krish, ranade, romain, subrata, weixia
commit 5162053e7d8d6a19823745129af8c3274c816883
Author: Chris Conner <cconner@cloudera.com>
Date:   Mon Mar 20 16:30:35 2017 -0500

    [HUE-6090] Hue to do a keep alive on idle sessions to HiveServer2
    This patch has been contributed by Christopher Conner.
    In this patch we are adding socket.SO_KEEPALIVE attribute to the establish socket.
    SO_KEEPALIVE will keep idle connection active such that firewall in between does not kill the connection. This fix enables Hue do keep alive on the thrift sessions to HS2 and Impala.

:100644 100644 81e0984... acf51c6... M	desktop/core/ext-py/thrift-0.9.1/src/transport/TSSLSocket.py
:100644 100644 0175bdc... 05b6427... M	desktop/core/ext-py/thrift-0.9.1/src/transport/TSocket.py

Romain Rigaux

Sounds good overall.

How often are the keep alive packet sent?
No need to have a on/off flag? (this will apply to all Hue Thrift in general, not just HS2)

  1. The keepalive is default setting e.g. on our nightly following are the settings.
    [root@nightly-1 ~]# hostname
    [root@nightly-1 ~]# cat /etc/redhat-release
    CentOS release 6.4 (Final)
    [root@nightly-1 ~]# sysctl net.ipv4.tcp_keepalive_time net.ipv4.tcp_keepalive_intvl net.ipv4.tcp_keepalive_probes
    net.ipv4.tcp_keepalive_time = 3600
    net.ipv4.tcp_keepalive_intvl = 60
    net.ipv4.tcp_keepalive_probes = 5

    In HUE code we are just enabling OS level KEEPALIVE feature. And yes it applies to all Hue thrift in general. We should test it and validate it.