How to configue session timeout in Hive

This article explains how to configure the following settings in Hive:

hive.server2.session.check.interval
hive.server2.idle.operation.timeout

hive.server2.idle.session.timeout

1). hive.server2.idle.session.timeout
Session will be closed when not accessed for this duration of time, in milliseconds; disable by setting to zero or a negative value.
For example, the value of “86400000” indicate that the session will be timed out after 1 day of inactivity.

2). hive.server2.session.check.interval
The check interval for session/operation timeout, in milliseconds, which can be disabled by setting to zero or a negative value.
For example, the value of “3600000” indicate that the session will be checked every 1 hour.

3) hive.server2.idle.operation.timeout
Operation will be closed when not accessed for this duration of time, in milliseconds; disable by setting to zero. For a positive value, checked for operations in terminal state only (FINISHED, CANCELED, CLOSED, ERROR). For a negative value, checked for all of the operations regardless of state.
For example, the value of “7200000” indicate that the query/operation will be timed out after 2 hours if it is still running.

So if you combine the three settings from above examples, we can summarize the following use cases:

1) If you started a HS2 session, beeline for example, and without doing anything afterwards, HS2 will trigger 24 session checking before it determines that 24 hours has passed since last activity, then session will be closed

2) If you worked on beeline for 2 hours and then leave the beeline open without doing anything afterwards, HS2 will trigger total of 26 session checking (2 while you worked and another 24 while in idle), and the session will be closed 26 hours after initially opened.

3) If you worked on beeline for 2 hours, and you started running a query that will run for 1 hour and then returns result, the idle timer actually starts from the time when data returns, so if you don’t do anything afterwards, HS2 will kill the session after another 24 hours, so in total, the session lasted 27 hours (2+1+24)

4) If, for instance, your query takes longer than the 2 hours defined by hive.server2.idle.operation.timeout, then the query will be cancelled, hence you will lose the result all together

5) If hive.server2.session.check.interval = 0 and hive.server2.idle.session.timeout > 0, then it will have the same effect that hive.server2.idle.session.timeout = 0, because no idle timer will be triggered as check interval is disabled

6) If hive.server2.session.check.interval > hive.server2.idle.session.timeout > 0, then the actual time out will be the same as hive.server2.session.check.interval.

For example if hive.server2.session.check.interval = 20 minutes, but hive.server2.idle.session.timeout = 10 minutes, then timeout will happen when checking happens, which is 20 minutes.

The basic rule of thumb is as follows:
hive.server2.session.check.interval < hive.server2.idle.operation.timeout < hive.server2.idle.session.timeout

And the recommended values are:

hive.server2.session.check.interval = 1 hour
hive.server2.idle.operation.timeout = 1 day
hive.server2.idle.session.timeout = 3 days

This will work for most of clusters, but you can change the value depending on how your cluster behaves and how long each query run for.

时间: 2024-09-29 08:46:57

How to configue session timeout in Hive的相关文章

不知道是不是Session.Timeout的一个BUG

问题描述 大家随便建个网站项目,然后随便建个aspx页面.然后在页面中放入以下代码:protectedvoidPage_Load(objectsender,EventArgse){if(!IsPostBack){Session.Timeout=60;}} 然后在页面上放个Button控件:<asp:ButtonID="Button1"runat="server"Text="Button"/>然后对页面进行调试,监控Session.Ti

aasp入门教程:session timeout实例教程

aasp入门教程:session timeout实例教程  <% Response.Write(Session.SessionID) %> 输出你当前SessionID的值如123456456 下面我们来看看asp取得session超时时间吧. <%  response.write("<p>") response.write("默认时间: " & Session.Timeout & " minutes.&quo

Session.TimeOut的最大取值是1440,超出会报错

例如1441,那么会产生"运行时错误",报错信息类似下面: SessionID 错误 'ASP 0164 : 80004005' 超时值无效 /manage_content/检查输入的管理员名称和密码.asp,行 109 指定的超时值无效.

大数据工具篇之Hive与HBase整合完整教程

一.引言 最近的一次培训,用户特意提到Hadoop环境下HDFS中存储的文件如何才能导入到HBase,关于这部分基于HBase Java API的写入方式,之前曾经有过技术文章共享,本文就不再说明.本文基于Hive执行HDFS批量向HBase导入数据,讲解Hive与HBase的整合问题.这方面的文章已经很多,但是由于版本差异,可操作性不大,本文采用的版本均基于以下版本说明中的版本. 二.版本说明 序号 软件 版本 1 Hive  0.10.0 2 HBase 0.94.0 3 Hadoop 1.

hive Illegal Operation state transition from CLOSED to ERROR的处理

异常堆栈如下: 2015-11-24 16:49:11,495 ERROR org.apache.hive.service.cli.operation.Operation: Error running hive query: org.apache.hive.service.cli.HiveSQLException: Illegal Operation state transition from CLOSED to ERROR        at org.apache.hive.service.c

ASP防止Session丢失的方法

也许很多ASP开发者都会遇到这样的情况:在会话期间(session)无故丢失sessio n.换而言之,丢失了SessionID,同样session级的变量也会丢失. 很多session丢失的原因是因为错误的程序或者是错误的虚拟目录结构. SessionID 的改变有下面几个原因. 原因一: Netscape的浏览器会认为"/App/user.asp"跟"/app/user.asp"是两个不同的程序.它会自动地开始一个新的会话期(new session).所以,才你

如何取得所有的Session变量

session|变量|session 在程序调试中,有时候需要知道有多少Session变量在使用,她们的值如何?由于Session对象提供一个称为Contents的集合(Collection),我们可以通过For...Each循环来达到目标:Dim strName, iLoopFor Each strName in Session.ContentsResponse.Write strName & " - " & Session.Contents(strName)&

ASP中关于session的一些问题

session|问题 如何取得所有的Session变量? 在程序调试中,有时候需要知道有多少Session变量在使用,她们的值如何?由于Session对象提供一个称为Contents的集合(Collection),我们可以通过For...Each循环来达到目标: Dim strName, iLoop For Each strName in Session.Contents Response.Write strName & " - " & Session.Contents

关于session的一些问题

session|问题|session 如何取得所有的Session变量? 在程序调试中,有时候需要知道有多少Session变量在使用,她们的值如何?由于Session对象提供一个称为Contents的集合(Collection),我们可以通过For...Each循环来达到目标: Dim strName, iLoopFor Each strName in Session.ContentsResponse.Write strName & " - " & Session.Co