A language-independent shared socket manager that runs and keeps alive multiple copies of long-lived processes with seamless upgrades.
Einhorn is a language-independent shared socket manager that runs and keeps alive multiple copies of a long-lived process, such as a server. It manages shared sockets in a master process, passes them to worker processes, and supports seamless code upgrades and dynamic reconfiguration. It solves the problem of maintaining robust, restartable server processes with minimal application changes.
Developers and operations engineers running long-lived server processes (e.g., API workers, TCP servers) who need zero-downtime deployments, process supervision, and shared socket management across multiple languages.
Einhorn provides the proven master/worker process model of servers like Unicorn, but generalized to work with any language or framework. Its minimal dependencies, simple configuration, and support for seamless upgrades make it a lightweight yet powerful alternative to language-specific process managers.
Einhorn: the language-independent shared socket manager
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Einhorn opens server sockets in the master process and passes file descriptors to workers via environment variables, enabling zero-downtime upgrades without application-level socket handling, as detailed in the README with examples for binding addresses.
Compatible with arbitrary languages, requiring only minimal code to read environment variables like EINHORN_FD_0, with libraries available for Go, PHP, and Python, as noted in the Compatibility section.
Supports hot upgrades by spawning new workers and gracefully shutting down old ones with SIGUSR2, allowing code updates without dropping connections, demonstrated in the 'Seamless upgrades' section.
Offers manual or timer-based ACK mechanisms, giving precise control over worker health confirmation, with Ruby helpers and socket communication options outlined in the ACKs section.
Integration libraries for non-Ruby languages are community-maintained and vary in quality, requiring custom implementation for unsupported frameworks, as hinted in the Compatibility list without official endorsement.
Preloading and copy-on-write memory savings are only available for Ruby applications via the -p flag, leaving other languages with slower worker startups and higher memory overhead.
The command socket uses a line-oriented YAML protocol and depends on file system permissions for security, which the README warns could be risky if misconfigured or exposed to malicious inputs.