MathanKumar Stalin
MathanKumar Stalin

Solution Engineer

System Engineer

DevOps Engineer

Ethical Hacker

Cyber Security

MathanKumar Stalin

Solution Engineer

System Engineer

DevOps Engineer

Ethical Hacker

Cyber Security

Under the Hood: Optimizing WebHyena’s Server CPU and Memory

September 18, 2026 Uncategorized

When I set out to build WebHyena.com, the goal wasn’t just to spin up another hosting provider. I wanted an infrastructure that was lean, highly optimized, and heavily monitored. Out-of-the-box server configurations are notorious for bleeding resources, and in the hosting world, unoptimized CPU and memory management directly translates to sluggish sites and unhappy users.

Here is a look at how I tuned the WebHyena servers to handle high traffic without breaking a sweat, and exactly which processes I had to tame.

The Baseline: Identifying the Resource Hogs

Before applying any blind fixes, you have to know what your system is actually doing. During initial load testing, the baseline metrics weren’t great. CPU utilization was frequently spiking above 85% during concurrent requests, and memory usage was sitting dangerously close to 90%, threatening to push the system into swap space.

When I dug into the logs and ran htop and iotop, two main culprits were aggressively utilizing high memory and high CPU:

  1. mysqld (MySQL/MariaDB): This was the biggest memory hog. By default, the database was trying to cache too much unoptimized data, consuming massive chunks of RAM.
  2. php-fpm: This process was spiking the CPU hard. Every time a new request came in, unoptimized PHP scripts were spawning too many child processes, eating up both CPU cycles and memory concurrently.

Taming Memory: Database and PHP Tuning

To fix the memory utilization, I had to stop mysqld and php-fpm from writing blank checks for RAM.

Database Optimization (mysqld) The fix here was tuning the innodb_buffer_pool_size. The default settings are often too generic. By calculating the actual active dataset size, I adjusted the buffer pool to allocate exactly what was needed (around 60-70% of total available RAM for dedicated database nodes), preventing it from choking the rest of the system. I also tweaked max_connections to prevent OOM (Out of Memory) kills during traffic spikes.

PHP Process Management (php-fpm) For php-fpm, the default dynamic process manager was spinning out of control. I adjusted the pool configuration (www.conf):

  • Tuned pm.max_children based on the server’s available RAM (Total RAM – DB RAM / average PHP script memory footprint).
  • Set pm.max_requests = 500 to ensure that child processes are periodically respawned, completely eliminating the slow memory leaks that plague long-running PHP processes.

Offloading the CPU: Caching and Web Server Tweaks

With memory stabilized, I needed to drop that 85% CPU utilization.

Every dynamic request processed by PHP hits the CPU. The easiest way to reduce CPU load is to not process the request at all. I implemented strict FastCGI caching at the Nginx level. By caching static assets and standard HTML outputs directly in RAM, Nginx serves the response instantly without ever waking up php-fpm or querying the database.

The Result: Post-optimization, average CPU utilization dropped to a stable 15-20% under moderate load, with memory usage holding steady around 50-60%. No swapping, no OOM kills.

Continuous Observability

You can’t optimize what you can’t see. I don’t rely on basic server panels to watch these metrics.

To keep a constant eye on process-level utilization, I feed the server logs and system metrics through Fluent Bit, push them into a centralized datastore, and visualize the entire pipeline in Grafana. If php-fpm starts misbehaving or mysqld tries to chew through its memory limits, an alert triggers before it impacts any hosted sites.

Building WebHyena is an ongoing process of tweaking and tuning, but getting the core CPU and memory management locked down is what keeps the lights on.

Related Posts
Write a comment