这里的Interpreter 生命周期是指 Interpreter 进程的管理。默认情况下 Interpreter的生命周期是由用户来控制,用户跑interpreter的第一个paragraph的时候会启动interpreter 进程,一旦起来之后这个 interpreter 进程都会一直存在,直到用户把这个进程停掉。(点击restart)
这种方式显然不太适合生产环境,有可能会启动太多interpreter 进程浪费资源。幸运的是,Zeppelin 提供了另外一种 Interpreter 生命周期管理方式 TimeoutLifecycleManager:如果Interpreter 空闲一段时间,就会被自动释放。你只要在 zeppelin-site.xml 中配置如下几个参数就可以。
- zeppelin.interpreter.lifecyclemanager.class
- 默认情况下,这个参数是 org.apache.zeppelin.interpreter.lifecycle.NullLifecycleManager, 也就是Zeppelin不管理interpreter生命周期,交由用户手动管理。
- zeppelin.interpreter.lifecyclemanager.timeout.checkinterval
- 多少时间检查interpreter是否idle时间超threshold需要被释放
- zeppelin.interpreter.lifecyclemanager.timeout.threshold
- interpreter 空闲时间threshold,超过这个时间的interpreter将被释放
<property>
<name>zeppelin.interpreter.lifecyclemanager.class</name>
<value>org.apache.zeppelin.interpreter.lifecycle.TimeoutLifecycleManager</value>
<description>LifecycleManager class for managing the lifecycle of interpreters, by default interpreter will
be closed after timeout</description>
</property>
<property>
<name>zeppelin.interpreter.lifecyclemanager.timeout.checkinterval</name>
<value>60000</value>
<description>Milliseconds of the interval to checking whether interpreter is time out</description>
</property>
<property>
<name>zeppelin.interpreter.lifecyclemanager.timeout.threshold</name>
<value>3600000</value>
<description>Milliseconds of the interpreter timeout threshold, by default it is 1 hour</description>
</property>
公众号 钉钉群