Posts

OpenLiteSpeed vs Nginx PHP Isolation

Image
Scrolling system log output during a load stress test (Photo via Unsplash) Single-site benchmarks lie. Point wrk at a fresh WordPress install on almost any modern stack and you'll pull 18,000 requests per second out of a $20 VPS. That tells you nothing about running a multi-tenant CMS host. Put 75 WordPress, WooCommerce, and Drupal tenants onto one 16-core, 64 GB Debian box and the failure modes change overnight. Tenant #37 installs a sloppy inventory sync plugin that parks 12 PHP workers on dead upstream sockets. Tenant #14 updates a category archive and kicks off a cache stampede across 400 pages. Suddenly synthetic RPS stops mattering. What matters is blast radius, memory ceilings, cache invalidation accuracy, and how fast you can catch the offender at 3:00 AM. Over the last few years I've operated production multi-tenant fleets on both OpenLiteSpeed with LSPHP (via LSAPI) and classic Nginx with PHP-FPM, regularly sanity-checking our numbers against the CMS infrastruct...

Systemd Socket Tuning for High Load

Image
Security telemetry graphs displayed on a dark workstation (Photo via Unsplash) If you've run busy Linux web stacks for a few years, you recognize this outage immediately. Traffic jumps for twenty seconds after an email blast, a webhook storm, or a cache stampede. CPU sits at 35%. Memory has gigabytes free. Application logs look calm. Yet Nginx spits out waves of 502 Bad Gateway errors, and your error log fills with Resource temporarily unavailable or abrupt upstream timeouts. Almost nobody checks the kernel listen queue first. People blame PHP, Go, Python, the firewall, or noisy hypervisor neighbors. What actually happened is far more mundane: your worker pool saturated for 200 milliseconds, incoming connections stacked up in the accept queue, and Linux quietly truncated that queue at 128 or 511 slots. On hosts where systemd manages service lifecycles and socket activation, mismatched sysctl defaults, unit files, and daemon configs keep that cap invisible until burst load h...

Redis Object Cache Memory Eviction

Image
Printed circuit board pathways under studio lighting (Photo via Unsplash) At 14:22 on a Tuesday afternoon, our main editorial CMS slowed to a crawl. Median time to first byte jumped from 94 milliseconds to 4.1 seconds across four PHP-FPM application nodes. MariaDB primary CPU pinned itself at 89%, active threads climbed past 140, and editors couldn't save a draft without hitting a gateway timeout. Meanwhile, our dedicated Redis 7.2 node on Debian 12 sat practically idle at 5% CPU and 18 Mbps of traffic. That mismatch sends most teams down the wrong path. Slack immediately blamed a morning plugin release or exhausted PHP-FPM workers. We ruled out kernel backlog drops fast—we'd already raised listen queue ceilings during our earlier systemd socket tuning for high load work. PHP process pools weren't starving either; per-pool memory boundaries had held steady since our OpenLiteSpeed vs Nginx PHP isolation audit. PHP wasn't waiting on sockets. It was hammering MariaDB ...

Dynamic vs Static PHP FPM Pool Modes

Image
Network switching hardware with glowing amber link LEDs (Photo via Unsplash) Every Debian and Ubuntu PHP package ships with the same conservative www.conf defaults: pm = dynamic , five max children, two start servers, one minimum spare, three maximum spares. Most engineers raise pm.max_children before launch. Far fewer touch the process manager mode. The config comments make dynamic sound smart—scale workers up under load, reap them during lulls, save RAM. On a shared host juggling thirty quiet domains, that logic holds up. On a dedicated 8-core server taking real bursts, pm = dynamic is a latency trap. I've watched this play out on production WooCommerce stores, Laravel APIs, and media sites for over a decade. The box cruises at 12% CPU all morning. Then a newsletter hits 200,000 inboxes or a scraper opens 300 connections at once. Within two seconds, kernel CPU crosses 35%, Nginx logs upstream socket failures, and p99 latency blows past three seconds. You didn't run o...

Nginx FastCGI Cache for Heavy PHP

Image
Close-up of backend configuration code on an engineer monitor (Photo via Unsplash) Most PHP performance fires follow the exact same script. Traffic spikes, a handful of crawlers discover your faceted catalog, and suddenly an eight-core PHP-FPM box sits pinned at 85% CPU. Nothing in the slow log looks broken, yet PHP workers burn seven cores rebuilding identical HTML ninety times a second for anonymous visitors who aren't even signed in. Teams routinely throw bigger instances at traffic that shouldn't reach PHP at all. If you already terminate TLS and route requests through Nginx , you already have a fast page cache built into your stack. Turning on FastCGI microcaching with fastcgi_cache_use_stale updating regularly cuts PHP-FPM CPU by 80% on read-heavy apps—no Varnish tier, no extra TCP hops, and no extra daemon to babysit at 3 a.m. The catch is session safety. One careless fastcgi_ignore_headers line copied from an old forum thread can cache a logged-in response and se...

Solving MySQL 1040 Too Many Clients

Image
Linux terminal session inspecting active daemon processes (Photo via Unsplash) At 2:14 AM, your pager fires with a stack trace every PHP and Linux ops engineer knows by heart: SQLSTATE[HY000] [1040] Too many connections . Checkout pages throw 500s, Slack fills with alerts, and someone pastes an old forum reply telling you to bump max_connections from 151 to 2000. Don't do it. I've watched that panic edit turn a survivable traffic spike into a 40-minute full outage more times than I care to count. Five minutes after you raise max_connections to 2000 and restart the daemon, Error 1040 vanishes. Fifteen minutes later, the Linux OOM killer shoots mysqld in the head, leaving you staring at InnoDB crash recovery while your primary database drops every packet. The failure comes straight from how MySQL's thread-per-connection architecture handles RAM and CPU scheduling. Raising max_connections doesn't add IOPS to your NVMe drives or conjure extra CPU cores. It just re...

Fixing Linux OOM Killer on Web Nodes

Image
Structured Cat6 and fiber patch cabling on a rack switch (Photo via Unsplash) At 03:14 UTC on a Tuesday, PagerDuty woke me up with a wall of HTTP 502s from our EU checkout node. It was a 32 GB bare-metal Debian 12 box running Nginx, PHP-FPM 8.3, Redis, and MySQL 8.0 on one host—the classic single-server layout that starts as a pragmatic budget call and quietly matures into a trap two years later. Before I even finished typing my SSH passphrase, Slack had three people blaming connection exhaustion and linking our earlier postmortem on solving MySQL 1040 too many clients errors . Except PHP wasn't reporting max connections. The app log screamed SQLSTATE[HY000] [2002] Connection refused . One look at systemctl status mysql ended the guessing: Active: failed (Result: oom-kill) since Tue 2026-11-10 03:12:42 UTC Main PID: 1842 (code=killed, signal=KILL) MySQL hadn't crashed or deadlocked. The kernel shot it dead with SIGKILL mid-query while 94 bloated PHP-FPM workers—the rea...