mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-10-14 18:36:39 +08:00
Every enabled host plugin kept a process running on every node, about 10 MB for a Go plugin and 16 MB for a Python one, though most of them (connectors, parsers) are called now and then. With WEKNORA_PLUGIN_IDLE_TIMEOUT set (e.g. 10m), the host stops a plugin that has had no calls for that long and starts it again on the next one. The process record stays, in a new idle state: routing, the plugin hosts' announcements (idle counts as running) and the node status are unchanged. A call to an idle plugin wakes it and waits for it, bounded by the caller's context; callers arriving together share one start. Calls are counted in the plugin client's transport from the request until the answer's body is closed, streams included; health and manifest checks do not count, and handing out a client counts as use, so a plugin is not stopped between a caller getting its client and sending the call. A stop signal left over from before a crash and restart is ignored. Off by default; the desktop app sets 10 minutes. Plugins that work between calls declare runtime.keepAlive (singleton plugins are resident too). Upgrades still start the new version to check it before it idles. Measured on the examples: a cold call to a Go plugin took about 11 ms, a Python plugin reaches its handshake in about 70 ms.