Skip to main content

Crate folk_runtime_fork

Crate folk_runtime_fork 

Source
Expand description

§folk-runtime-fork

Fork-based PHP worker runtime for Folk: warm OPcache via prefork.

A prefork master PHP process boots the framework once, then forks per-worker children that inherit its OPcache. Worker recycling re-uses the master (no re-bootstrap).

§Platform

This crate is Unix-only (#![cfg(unix)]). SCM_RIGHTS FD passing is Linux primary, macOS experimental.

§Usage

use folk_runtime_fork::{ForkConfig, ForkRuntime};

let runtime = ForkRuntime::new(ForkConfig {
    php: "php".into(),
    script: "vendor/bin/folk-worker".into(),
    boot_timeout: std::time::Duration::from_secs(30),
}).await?;

Re-exports§

pub use runtime::ForkConfig;
pub use runtime::ForkRuntime;

Modules§

handle
ForkWorkerHandle: wraps two Framed Unix streams for a forked child.
master
Prefork master management: spawn the master PHP process and issue fork commands.
runtime
ForkRuntime: spawns PHP workers via prefork master + SCM_RIGHTS.
scm_rights
Send and receive file descriptors over a Unix socket via SCM_RIGHTS.