Watchdogs in OpenFaaS
Classic Watchdog OpenFaaS 的 Classic Watchdog 是一个用于处理无服务器(Serverless)函数请求的核心组件。它是 OpenFaaS 的默认函数执行器,用于在容器内运行用户定义的函数代码,并通过 HTTP 请求与外部进行通信。 工作原理 Classic Watchdog 主要负责以下任务: 启动函数: 当容器启动时,Classic Watchdog 会启动并监听 HTTP 端口。 它会执行用户提供的函数代码,通过 exec 启动一个新的进程运行函数。 处理请求: Classic Watchdog 监听指定端口上的 HTTP 请求。 当收到请求时,它会将请求的内容传递给函数进程,并等待函数的响应。 返回响应: 函数进程处理请求后,将结果返回给 Classic Watchdog。 Classic Watchdog 将函数的响应封装成 HTTP 响应,并返回给调用方。 A tiny web-server or shim that forks your desired process for every incoming HTTP request Every function needs to embed this binary and use it as its ENTRYPOINT or CMD, in effect it is the init process for your container. Once your process is forked the watchdog passses in the HTTP request via stdin and reads a HTTP response via stdout. This means your process does not need to know anything about the web or HTTP. ...