My containers keep getting OOMKilled—how do I set memory limits correctly for PHP-FPM and Go?
Measure the working set instead of raising the limit; compute max_children against the cap in PHP-FPM and set GOMEMLIMIT plus GOMAXPROCS in Go.
Just Ask
Ask me anything about software architecture, careers, PHP, Go and the craft of building software; I answer here, in the open, for everyone. (Page 2/10)
The questions here are compiled from what I have run into in the field and from what people have asked me; I write the answers. No record carries the name of whoever asked.
Measure the working set instead of raising the limit; compute max_children against the cap in PHP-FPM and set GOMEMLIMIT plus GOMAXPROCS in Go.
Make most changes additively and never remove or retype a field; for an unavoidable break, pin the version with a header instead of cutting /v2.
Create one expression index per fixed key and confirm the plan drops to an Index Scan; promote to a generated column if you join on the value.
Keep channel capacity near the worker count, let blocking propagate to the Kafka poll loop, and when consumer lag climbs grow workers, not the buffer.
With 3 stable types and a real need for foreign keys, use a single-table exclusive arc; if the type set is open-ended, go pure morph with a morph map.
Stay in FPM and start with a Guzzle Pool pinned to 20-50 concurrency; move to AMPHP v3 only if the codebase grows async, Swoole only when re-architecting.
Kill the reflex to grab the keyboard; your metric isn't how fast you ship today but whether the junior needs you a little less each week.
Start with RED on the API, model jobs as requests to run RED on the workers too, then layer USE onto both for queue depth and pool saturation.
Flip CMD to exec form and listen with signal.NotifyContext(..., syscall.SIGTERM) instead of os.Interrupt; add tini only if the worker forks.
Standardize on RFC 9457 rather than 7807, produce every error body in one central exception handler, and manage the type URI as a versionable contract.