Codexworker

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.

I'm a backend developer with 10+ years of experience across PHP, Go, MySQL and Elasticsearch. Recent work includes Cenoskop (30M+ products daily), Niftycent (US price intelligence), and facha.sk (Go backend). I build, fix and optimize backend systems that handle real data and real traffic.

What I Can Help With

Find what drives high CPU in PHP production.

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

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%.

What Is Included

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

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.

Starting from €399

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

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.

Related Services

Other problems I help with.

PHP Performance Optimization

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

Details →

PHP Memory Leak Investigation

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

Details →

Slow PHP Application? I'll Find the Bottleneck

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

Details →

MySQL Performance Optimization

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

Details →

Systems I've Built

Relevant production work.

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
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
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

Need Help With This?

Describe the problem in a few lines — I'll look at it and tell you what I think.

Request a CPU investigation