绕过主管讨厌的回调堆栈,让它快速!

supervisor-quick的Python项目详细描述


绕过主管讨厌的回调堆栈,让它快速

用法

$ pip install supervisor-quick

并将以下配置添加到supervisord.conf中

[ctlplugin:quick]supervisor.ctl_factory=supervisor_quick:make_quick_controllerplugin

然后启动supervisortl并使用quickstart、quickstop和 快速重新启动以启动/停止/重新启动进程

> quickstart app:0
> quickstart app:
> quickstart ap*
> quickstart all

> quickstop app:1
> quickstop app:
> quickstop ap*
> quickstop all

> quickrestart app:2
> quickrestart app:
> quickrestart ap*
> quickrestart all

它会影响到supervisortl,因此您不必重新启动整个 监督工作

为什么

我写这个插件是因为主管太慢了 在我们的prod服务器中启动/停止/重新启动app server。

我检查了源代码,发现是因为 讨厌的回调堆栈,这是来自源代码的引用 主管/rpcinterface.py

# XXX the above implementation has a weakness inasmuch as the
# first call into each individual process callback will always
# return NOT_DONE_YET, so they need to be called twice. The
# symptom of this is that calling this method causes the
# client to block for much longer than it actually requires to
# kill all of the running processes. After the first call to
# the killit callback, the process is actually dead, but the
# above killall method processes the callbacks one at a time
# during the select loop, which, because there is no output
# from child processes after e.g. stopAllProcesses is called,
# is not busy, so hits the timeout for each callback. I
# attempted to make this better, but the only way to make it
# better assumes totally synchronous reaping of child
# processes, which requires infrastructure changes to
# supervisord that are scary at the moment as it could take a
# while to pin down all of the platform differences and might
# require a C extension to the Python signal module to allow
# the setting of ignore flags to signals.

这个插件将执行一个绕过 所有的回拨检查,让它闪电般的快。

它还支持通配符并发执行,使其保持快速 不管进程数量。(此功能的灵感来自 supervisor-wildcards

示例

numprocs设置为32的应用服务器的示例时间演示 主管可以使用quick命令。

$ supervisorctl status
app:0                            STOPPED
app:1                            STOPPED
app:10                           STOPPED
......
app:7                            STOPPED
app:8                            STOPPED
app:9                            STOPPED

$ time supervisorctl start app:
24: started
25: started
26: started
......
18: started
31: started
30: started
supervisorctl start app:  0.06s user 0.02s system 0% cpu 48.442 total

$ time supervisorctl stop app:
24: stopped
25: stopped
26: stopped
......
18: stopped
31: stopped
30: stopped
supervisorctl stop app:  0.06s user 0.03s system 0% cpu 36.278 total

$ time supervisorctl quickstart app:
app:25: started
app:24: started
app:27: started
......
app:1: started
app:8: started
app:9: started
supervisorctl quickstart app:  0.09s user 0.03s system 19% cpu 0.618 total

$ time supervisorctl quickstop app:
app:26: stoped
app:27: stoped
app:22: stoped
......
app:0: stoped
app:9: stoped
app:8: stoped
supervisorctl quickstop app:  0.09s user 0.04s system 68% cpu 0.196 total

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java有可能让Glassfish JAAS领域与一个已安装的应用程序共享一些类吗?   卸载weblogic时发生java log4j错误   java如何读取信息并将这些信息放入对象数组中   java线程池执行器。创建新线程时执行(Runnable命令)   java无法将project facet动态Web模块的版本更改为2.5   未添加到ArrayList Java Android的元素   javajavax。xml。绑定UnmarshaleException:意外元素(uri:,local:“ProcessCreditApplication”)。预期的元素是   java如何通过youtube API获取已删除视频的列表   如何在JavaBean验证中停止级联   java为什么我的ListView使我的应用程序崩溃,而不是列出我的条目?   java Guice多数据库自动切换   java(JDA)Mute命令在代码的第四行中断   推荐一种可通过Java中的随机访问进行更新的索引文件格式   java将arrayList添加到2x2 arrayList   java json对象数据发生变化,有时没有值   java使用Jedis库在redis中一次存储字符串列表   java快速排序分区   java setDaemon(false)是冗余的吗?   Java中的itext格式pdf