onysko/octane-health
| Install | |
|---|---|
composer require onysko/octane-health |
|
| Latest Version: | 1.0.0 |
| PHP: | ^8.3 |
| Laravel: | 12 · 13 |
| License: | MIT |
| Last Updated: | Nov 21, 2026 |
| Links: | GitHub · Packagist |
Octane Health
Health checks for Laravel Octane in production. It watches the things that only go wrong when a PHP process lives for thousands of requests: memory that never comes back, state that leaks from one request into the next, workers that die or keep running old code.
Every worker records what it looks like between requests and writes a small snapshot to a shared cache store. A command (or a probe endpoint) reads the snapshots of all workers and turns them into checks.
What it checks
| Check | What it tells you |
|---|---|
| memory growth | Average bytes a worker gains per request, fitted over its life after warm-up, and where that leads: the growth is carried forward to the request at which the server recycles the worker and held against memory_limit. Steep growth that ends far below the limit is stated, not flagged. |
| memory usage | How close a worker's resting memory is to PHP's memory_limit. |
| code version | Workers still running the release from before the last deploy. |
| worker exits | Workers whose process vanished without stopping: fatals, out-of-memory kills, segfaults. |
| config state | Config keys changed on the worker itself, outside the per-request sandbox, so every later request sees them. |
| event listeners | One event collecting listeners request after request. A worker's total always rises while it warms up (every model and component registers its own on first use), so growth is tracked per event. |
| static properties | Static arrays and countable objects of your own classes that gain elements check after check. A cache that filled up and stopped is not flagged. |
| long requests | Requests that held a worker longer than a threshold. |
| worker pool (Swoole) | How often every worker was busy at once, and whether tasks queue behind the task workers. |
| swoole tables (Swoole) | How full each Swoole table is, including the one behind the octane cache store. A full table refuses writes silently. |
| opcache | OPcache memory, interned strings and script table as the workers see them, and whether JIT is on. |
And one table that is the reason to install it: routes ranked by the memory they leave behind. Memory is read when a request arrives, after the previous request's sandbox is gone, so the difference between two arrivals is what the earlier request kept for good. That is charged to the route it ran:
Route Requests Left behind Per request Worst request Avg ms
GET reports/export 1,204 71.3 MB 59.2 KB 1.1 MB 412.0
GET orders/{id} 48,310 1.2 MB 25 B 310.4 KB 38.5
Requirements
PHP 8.3 or newer, Laravel 12 or 13, Laravel Octane 2.6 or newer.
Installation
composer require onysko/octane-health
php artisan vendor:publish --tag=octane-health-config # optional
The package needs a cache store that every worker and the CLI share: Redis, Memcached, the
database. Set it with OCTANE_HEALTH_STORE (default: the application's default store). The array
store is per process, and Octane empties it on every request.
Recording starts on the next octane:start / octane:reload.
Usage
php artisan octane:health # checks, workers, top routes
php artisan octane:health --json # the same as JSON
php artisan octane:health --fail-on=warning
php artisan octane:health:reset # forget all snapshots
The command exits non-zero when a check is critical (or a warning, with --fail-on=warning), so it
works as a cron alert or a container probe.
Dashboard
/octane-health shows everything on one page and refreshes every five seconds: the checks, the
worker pool, every worker, the routes ranked by the memory they leave behind, growing statics,
table usage and OPcache.
Four graphs show requests, average response time, worker memory at rest (highest and average worker) and, on Swoole, busy workers, over anything from the last 30 minutes to the last 30 days. Hovering reads the values of a point; "Show as table" lists the same numbers. A stretch nobody reported in breaks the line.
History is kept at three resolutions, so a month costs a few hundred buckets rather than 43,000:
| Range shown | Resolution | Kept for |
|---|---|---|
| up to 3 hours | one point per minute | history.minutes (180) |
| up to 3 days | one point per 10 minutes | 3 days |
| up to 30 days | one point per hour | history.days (30, the maximum) |
It lives in the same cache store as everything else: the minutes in one key, the two coarser
tiers in one key per day, each expiring by itself. Workers hand their finished minutes over every
history.handover_seconds (5 minutes) and when they stop, so the graphs outlive the workers that
drew them. Requests are always shown as a rate per minute, so the scale holds when the range
changes; clearing the cache clears the history.
Like Horizon, it is open to everyone in the local environment and closed everywhere else until
you say who may see it. Define the gate in a service provider:
use Illuminate\Support\Facades\Gate;
Gate::define('viewOctaneHealth', function ($user = null) {
return in_array($user?->email, ['you@example.com']);
});
Or replace the rule altogether:
use OctaneHealth\OctaneHealth;
OctaneHealth::auth(fn ($request) => $request->user()?->hasRole('admin') === true);
The path and middleware are in octane-health.ui (web by default, so the session user is
available to the gate); OCTANE_HEALTH_UI=false removes the page. The view can be published with
--tag=octane-health-views.
Probe
A JSON probe for load balancers and orchestrators is available but off by default:
OCTANE_HEALTH_ROUTE=true
GET /octane-health/probe then answers 200 with the checks, or 503 when one is critical. It is
not behind the gate: give it middleware of its own (octane-health.route.middleware) before
exposing it.
Configuration
The published config/octane-health.php documents every option. The ones worth knowing:
version- what identifies a release. By default a fingerprint of the release path and the time the dependencies were installed; setOCTANE_HEALTH_VERSIONto your commit or release id if a deploy changes neither.memory.warmup_requests/memory.min_samples- a worker's first requests grow it legitimately (lazy loading), so they are left out of the growth rate, and a worker is not judged until it has served enough requests after that.memory.max_requests- when the server recycles a worker. Read from Swoole itself; on other servers it falls back tooctane.max_requests(500), so set it if you start Octane with a different--max-requests. With 0 (never recycled) the growth rate itself is judged, againstmemory.growth_warning/growth_critical.requests.route_warmup- the first hits of a route in a worker are counted but not charged with memory growth, for the same reason.flush_every/flush_seconds- how often a worker writes its snapshot. One cache write per 20 requests by default.state.ignore_config- config keys you change on purpose;*is a wildcard. The framework's ownlogging.channels.deprecations.*is ignored by default.history.days- how long the hourly history is kept, 30 at most (OCTANE_HEALTH_HISTORY_DAYS).state.static_namespaces- whose static properties are measured (App\by default). Only these classes are walked, everystate.static_check_everyrequests; an empty list turns it off.pool.sample_every- how often a worker samples the Swoole pool.
Cost and limits
- Per request the recorder reads memory twice and updates a few counters. The state checks (config comparison, listener count), the static walk and the pool sample each run every few requests, not on each one.
- Health reporting never breaks a request: every recorder entry point swallows its own failures, including an unreachable store.
- A worker reports when it serves a request. An idle worker's snapshot is as old as its last flush
and expires after
ttl. - An unexpected exit can only be detected for workers on the host that runs the report (it checks whether the process still exists). A worker is counted as having died only when a worker that ran beside it is still alive: a server that was stopped or restarted as a whole is not a death (Octane stops Swoole with SIGKILL, so no worker gets to say goodbye).
- Workers of another host cannot be checked: they drop out of the report once they have been
silent for
workers.forget_after(10 minutes). - A container replaced by a deploy is recognised sooner. Once workers of the current release are
reporting, a worker of an older release that has been silent for
workers.stale_grace(2 minutes) is dropped. While it is still serving, it shows as an older release. - The growth rate is a fit over the worker's life. Workers keep meeting code for the first time well past warm-up, so some growth is normal; the check asks whether it reaches the memory limit before the worker is recycled. A leak in a route that is rarely hit shows up in the routes table long before it moves the worker's slope.
Server support
The memory, lifecycle and state checks work on every Octane server. The worker pool and the table usage are read from Swoole (and OpenSwoole) only: on RoadRunner and FrankenPHP those sections are simply absent.
- Pool saturation is sampled, not measured continuously: a worker looks at the pool when one of its own requests arrives, so "no idle worker" means all the others were busy at that moment too.
- "Busy workers" leaves out the worker that took the sample. It is always busy while it looks, so counting it would add one to every reading; without it the figure estimates the average load (requests per second times their duration).
- A static is reported by element count, not bytes. One huge value in a small array does not show here - it shows as memory growth on the route that put it there.
Not built yet
- Pool saturation on RoadRunner and FrankenPHP.
- Database and Redis connection state: open transactions at request end, reconnects.
Testing
composer test
tests/OctaneWorkerTest.php runs requests through Octane's own worker loop (real events, a real
sandbox per request), so the listeners and the memory attribution are tested against the real thing.
Changelog and licence
Changes are listed in CHANGELOG.md. The package is open-sourced software licensed under the MIT licence.
Related Packages
Focused octane server health check for Spatie's Laravel Health package.
Focused octane server health check for Spatie's Laravel Health package.
APM agent for laravel projects to monitor the application with elastic apm tools...
Kanbino Health endpoint for Laravel — emits stack profile + extensible probes fo...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.0 | ^8.3 | ^12.0| | MIT |