Wakanda Server脚本彻底关闭 [英] Wakanda Server scripted clean shutdown

查看:108
本文介绍了Wakanda Server脚本彻底关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过OS X Shell脚本完全关闭Wakanda服务器的最佳实践是什么?

What is best practice to perform a clean shutdown of a Wakanda server via OS X shell scripting?

这将是当前已加载并正在运行的解决方案.

This would be with a solution currently loaded and operating.

推荐答案

即将发布的版本1.1.0的最佳做法:

The best practice for the upcoming release 1.1.0 :

  • applicationWillStop事件.200-951540.en.html"rel =" nofollow>服务来处理应用程序特定的关闭逻辑
  • service wakanda stop(对于Ubuntu)和普通的kill(对于Mac OS)(kill -9应该始终是某种超时后的最后手段,但这不再是必须的)
  • Handle the applicationWillStop event on a service to handle app specific closing logic
  • service wakanda stop for Ubuntu and a normal kill for Mac OS ( kill -9 should always be the last resort after some kind of timeout but this should not be necessary anymore)

当前版本1.0.x的最佳做法:

The best practice for the current release 1.0.x :

  • 使用HTTP Request Handler或其他方法来准备服务器停止(确保很好地保护此安全性,并仅接受来自本地主机的连接)
  • service wakanda stop(对于Ubuntu)和普通的kill(对于Mac OS)(kill -9应该始终是某种超时后的最后手段,但这不再是必须的)
  • Prepare server stop by using an HTTP Request Handler or another method (make sure to secure this very well and accept connections only from localhost)
  • service wakanda stop for Ubuntu and a normal kill for Mac OS ( kill -9 should always be the last resort after some kind of timeout but this should not be necessary anymore)

更多详细信息:

我们应该区分HTTP服务器(如Apache)和应用程序服务器(如Wakanda Server).

We should make a distinction between an HTTP Server like Apache and an application server like Wakanda Server.

例如,在Wakanda中使用SharedWorker时,您正在创建一个单独的线程,该线程将运行一些代码.假设工作人员正在执行某种关键数据操作.如果让服务器为您关闭该工作程序,则可能导致应用程序中的数据不一致.因此,您应该在服务器停止应用程序之前处理所有特定于业务逻辑的清除"操作.

For example, when you are using a SharedWorker in Wakanda, your are creating a separate thread that is going to run some code. Suppose that worker is doing some kind of critical data manipulation. If you let the server close that worker for you, it might cause data incoherence in your application. You should therefore handle any business logic specific "clean" close before the server stops the app.

从版本1.1.0开始,您可以使用处理事件applicationWillStop的服务来代替创建可调用的特殊HTTP Request Handler来准备服务器的停止.

Starting from version 1.1.0, instead of creating a special HTTP Request Handler that you can call to prepare the server's stop, you can use a service that handles the event applicationWillStop.

当服务器收到可阻止的终止信号(TERM,QUIT,INT)时,它将启动停止过程(Wakanda Digital App Factory版本1.1.x符合以下条件):

When the server receives a blockable kill signal ( TERM, QUIT, INT ), it will start the stopping process ( The following is true for version 1.1.x of Wakanda Digital App Factory ) :

  • 通知事件applicationWillStop
  • 的每项服务
  • 通知每个服务事件httpServerWillStop
  • 等待所有服务代码执行完成-一次调用一个服务(服务器在调用下一个服务之前等待处理事件的代码结束其执行)-
  • 拒绝任何新的传入HTTP请求
  • 处理HTTP服务器队列中的所有HTTP请求
  • 询问所有执行JS代码的工作程序和线程以停止执行(包括请求处理程序代码).
  • 检查是否有任何线程/JS上下文仍处于活动状态,如果是这种情况,则等待最多5秒钟.
  • 服务器强制所有JavaScript上下文停止执行,并 杀死所有剩余的线程
  • 服务器等待线程关闭
  • 服务器停止
  • Notify every service of the event applicationWillStop
  • Notify every service of the event httpServerWillStop
  • Wait for all services code execution to be done - Services are called one at a time (the server waits for the code handling the event to end its execution before calling the next service) -
  • Refuse any new incoming HTTP Requests
  • Process all HTTP requests in the HTTP Server's queue
  • Ask all the workers and threads executing JS code to stop the execution (including request handlers code).
  • Check if there are any threads/JS Contexts still active, if it is the case wait maximum 5 seconds.
  • The server forces all JavaScript contexts to stop the execution and kills all the remaining threads
  • The server waits for the threads to be closed
  • The server stops

在1.1.0之前的版本中,服务器要求工作人员关闭,然后才将关闭事件通知服务.这就是为什么我们不能依靠这些服务来完全关闭SharedWorkers的原因.

In the versions prior to 1.1.0 the server asks the workers to close before notifying the services about the closing events. That is why we couldn't rely on the services to do a clean close of the SharedWorkers.

这篇关于Wakanda Server脚本彻底关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆