这里的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将被释放
  1. <property>
  2. <name>zeppelin.interpreter.lifecyclemanager.class</name>
  3. <value>org.apache.zeppelin.interpreter.lifecycle.TimeoutLifecycleManager</value>
  4. <description>LifecycleManager class for managing the lifecycle of interpreters, by default interpreter will
  5. be closed after timeout</description>
  6. </property>
  7. <property>
  8. <name>zeppelin.interpreter.lifecyclemanager.timeout.checkinterval</name>
  9. <value>60000</value>
  10. <description>Milliseconds of the interval to checking whether interpreter is time out</description>
  11. </property>
  12. <property>
  13. <name>zeppelin.interpreter.lifecyclemanager.timeout.threshold</name>
  14. <value>3600000</value>
  15. <description>Milliseconds of the interpreter timeout threshold, by default it is 1 hour</description>
  16. </property>

公众号 钉钉群

image.png image.png