You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@linkis.apache.org by rita <ri...@163.com> on 2022/07/19 07:42:08 UTC

[DISCUSS] Synchronous or Asynchronous

Dear:

The chat records of WeChat group“Apache linkis Community Development Group”are as follows:微信群"Apache Linkis 社区开发群"的聊天记录如下:

—————  2022-7-17  —————

海森堡  15:51

Heisenberg 15:51

@peacewong@WDS 平哥,请教一个问题,这里做成同步的好呢,还是异步的好呢? 

@peacewong@WDS Pingge, please ask me a question. Is it better to make it synchronous or asynchronous?

 

同步的话,会阻塞一些时间来读取日志中的application id 然后调用kill_yarn_job.sh。  Synchronization blocks some time to read the application ID in the log and then call kill_yarn_job.sh.如果异步的话,这里会启动一个thread来处理上述逻辑,如果kill 引擎的接口调用并发较高的话,可能会堆积较多的线程,不过,我觉得一个ecm也不会启动无限多ec,所以,这里我觉得启动单独线程来处理更好些?

If it is asynchronous, a thread will be started to handle the above logic. If the kill engine interface is called with a high number of concurrent calls, it may accumulate a large number of threads. However, I do not think that one ECM will start infinite ec, so I think it is better to start a separate thread to handle the above logic.

 

海森堡  15:51 

Heisenberg 15:51



 

peacewong@WDS  15:52

龙平兄,赞同你的异步好点。

Brother Longping, I agree with your asynchrony.

 

peacewong@WDS  15:52

不会占用太多线程的 It won't take up too many threads

海森堡  15:55

Heisenberg 15:55

本身 kill引擎的操作占用的时间已经挺多的啦,如果这里再阻塞调用的话,时间会被拉更长,体验不好,尤其是批量kill引擎的场景中,其次,这里kill yarn app的操作并不要求百分百执行并返回正确的结果, The operation of the kill engine itself takes a lot of time. If the call is blocked again, the time will be longer and the experience is not good, especially in the scenario of the batch kill engine. Secondly, the operation of the kill YARN app does not require 100% execution and correct results to be returned.所以丢给daemon线程上去执行这个逻辑,成功了也就成功了,失败了也就失败了,在日志中再输出下状态即可 [捂脸]

If it succeeds, it succeeds. If it fails, it fails. Then it outputs the status in the log.

海森堡  15:56

Heisenberg 15:56

好的 good

 

peacewong@WDS  15:57

是的,放到异步里面更好,有日志输出就好的。

Yes, it is better to put it in asynchronous, as long as there is log output.

 

海森堡 Heisenberg  15:58

OK