Skip to content

Windows: PHP workers run under EcoQoS, requests ~2x slower #189

Open

Description

@Dimitros617

Platform

Windows

Flock version

1.0.0-beta.15

OS version

Windows 11 25H2 (26200)

What happened?

On Windows every request is about 2× slower than it should be. flockd runs from the "Flock Daemon" scheduled task without a window, so Windows treats the php-cgi workers as background work and puts them under EcoQoS (efficiency cores, low clock). On a hybrid CPU that's a big hit.

Laravel 13 + Filament 5 app, GET /up, sent straight to the workers over FastCGI, alternating requests so both see the same machine state:

worker /up median
Flock worker as started ~300 ms
same worker after opting it out of power throttling ~147 ms
same php-cgi + same php.ini started from a terminal ~132 ms

Priority, I/O and memory priority, affinity and CPU sets are all normal on the workers, it's only the QoS heuristic. Users can't fix it on their side without admin (powercfg /powerthrottling disable needs elevation).

Fix: opt each child out right after start, e.g. in started() in internal/supervisor/proc_windows.go (add PROCESS_SET_INFORMATION to the OpenProcess access mask there):

// The daemon has no window, so without this Windows runs the workers as
// background work: efficiency cores, low clock.
func disableEcoQoS(p windows.Handle) {
	state := struct{ Version, ControlMask, StateMask uint32 }{1, 1 /* EXECUTION_SPEED */, 0}
	windows.NewLazySystemDLL("kernel32.dll").NewProc("SetProcessInformation").Call(
		uintptr(p), 4 /* ProcessPowerThrottling */, uintptr(unsafe.Pointer(&state)), unsafe.Sizeof(state))
}

Postgres starts a new process per connection, those probably need it too (not measured, a connect is ~30 ms here).

Second, smaller: opcache.revalidate_freq = 0 (internal/php/php.go:477) makes OPcache stat every included file on every request. On Windows each stat goes through Defender's filter driver, ~0.2 ms per file here, and a Filament page includes ~2,200 files. With revalidate_freq = 2 /up went from 451 to 289 ms (same as validate_timestamps = 0). 2 would be a better default on Windows.

Checked and not the cause: OPcache (on, shared by the workers), Caddy (same times when going to the worker directly), the Xdebug pool (unused), worker age.

Steps to reproduce

  1. Windows 11 on a hybrid Intel CPU (Core Ultra 5 135U here), on AC, Balanced power mode
  2. Serve a Laravel app with Flock (FastCGI)
  3. Time /up through Flock, then the same request against a php-cgi started from a terminal with the same php.ini and PHP_INI_SCAN_DIR: the Flock one is ~2× slower
  4. Opt one Flock worker out of power throttling (SetProcessInformation, ProcessPowerThrottling, ControlMask = 1, StateMask = 0): it drops to the terminal one's time

Logs


Activity

  1. added theissue type on Nov 18, 2026
  2. onairmarc commented on Nov 18, 2026

    @onairmarc
    Member

    Please upgrade to v1.0.0 and report if the issue is still happening.

  3. self-assigned this
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions