PHP · Go · MySQL · Elasticsearch

Why Is PHP Using So Much CPU?

PHP-FPM is pinned, response times spike, and the server CPU won't drop. It's not always the framework — it's often one hot function, a tight loop, an unindexed query, or a calculation repeated for every row.

I profile running PHP and find the exact functions and queries driving CPU, then prioritize the cheapest win.

Problems

What I Can Help With

Find what drives high CPU in PHP production.

Symptoms

Typical Problems

pinned PHP-FPM workers CPU spikes on specific endpoints tight loops in PHP code repeated database queries expensive date/math operations blocking external calls tying up workers inefficient autoloading over-aggregation in PHP
Track Record

Relevant Experience

Profiled a PHP backend where CPU was pinned at 100% during peak hours. Blackfire revealed a nested loop in a product comparison function that was doing O(n²) comparisons on a 50K-row dataset. Replaced with a hashmap lookup — CPU dropped to 15%.

Scope

What Is Included

CPU profiling (XHProf/tideways/Blackfire)
hot function identification
slow query cross-reference
request timing analysis
root cause identification
fix recommendations
Process

How It Works

You share profiling output plus slow-log/query timing, or I add a sampling profiler for a run. I cross-reference the CPU hotspots against the query log — if the CPU is in PHP code, I find the function; if it's in MySQL, I link it to query optimization. One focused session.

Pricing

Starting from €399

CPU profiling and a written diagnosis with the fix location and expected impact. Implementation is quoted separately.

FAQ

Frequently Asked Questions

Can profiling run on production?

Yes, with a sampling profiler (tideways/Blackfire) the overhead is small enough for production. I avoid Xdebug on live traffic.

What if the CPU is in the database, not PHP?

I cross-reference PHP profiling against the MySQL slow log — if the CPU is in queries, I report that and link it to MySQL optimization.

More

Related Services

PHP Performance Optimization

Profile and optimize PHP applications that are slow, memory-heavy or consuming too much CPU.

PHP Memory Leak Investigation

Find what causes PHP memory usage to grow until the process dies.

Slow PHP Application? I'll Find the Bottleneck

Diagnose why a PHP application is slow, no rewrite required.

MySQL Performance Optimization

Optimize MySQL queries, indexes and schema for a production workload.

Selected Work

Systems I've Built

Price Intelligence Engine

Cenoskop / Levnobot

Crawler monitoring millions of products. Processing 30M products daily and comparing them.

Built and maintain the full crawling pipeline — from scraping through Elasticsearch indexing to price comparison.

Data Aggregation Scraping ElasticSearch
US Price Intelligence

Niftycent

Price intelligence engine for the US market. Processing large-scale product data.

Built the data pipeline and crawling infrastructure for large-scale US product monitoring.

Data Aggregation Scraping Big Data
Traffic Analysis

AnalyticsForWebsite

Custom solution for collecting and evaluating traffic metrics with emphasis on processing speed and minimizing backend load.

Designed and built the backend for fast traffic metric collection and evaluation.

Performance Optimization Data Collection
Secure Communication

Paidshield

Chat application with end-to-end encryption.

Built the backend and encryption layer for a secure chat application.

End-to-End Encryption Real-time Communication Security
Job & Services Marketplace

facha.sk

Find a job or offer your services.

Built the Go backend — API, matching logic and deployment.

Job Marketplace Services Go
Contact

Not sure what's wrong?

Write what's happening and paste anything relevant — errors, logs, metrics. I'll have a look and tell you what I think.

Request a CPU investigation