PHP profiling is used by developers to identify performance issues or bottlenecks in their code. Profilers enable developers to drill into individual lines of code to ascertain which ones are running slow or are resource intensive. There are several reasons why a program might consume more CPU resources than it is expected to. To troubleshoot and/or optimize a PHP application’s consumption of CPU resources, a PHP CPU profiler is necessary. Without it, it would take a lot of guesswork, recreations of issues, code modifications, and diagnostics to localize the hot spots. In other words, it would be extremely difficult to find the specific lines of code where the majority of CPU is being used.
Profiling PHP applications in dev
Traditionally, profiling for PHP applications has been done in development environments due to the high level of overhead typically associated with their use. However, this approach of relegating profiling to development environments is not suitable for modern cloud-native environments. The more complex application environments become, the more difficult it is to maintain parity between development and production environments. If you’re trying to troubleshoot an issue by recreating it in development, you’ll need a development environment that has the same load, configuration, and infrastructure, just to name a few. This is not a sustainable approach when dealing with the ever changing nature of cloud-native, microservices based environments.
Additionally, it is important to understand how applications are constantly running in production, in order to know the dynamics of the hot spots with associated historical context (e.g. an application release version, runtime version or other metrics). In other words, it is important to understand when the problem started and why the problem started. This is simply not possible in a dev environment.
Using Instana AutoProfile™ for continuous production profiling
Instana’s always-on PHP profiler is designed for profiling and monitoring production environments. Instana AutoProfile automatically attaches itself to the running processes with no restarts or reconfiguration required. Users are able to continuously analyze code-level performance, quickly discover bottlenecks, visualize performance, and dig deep into the applications ‘hot paths’, in production. Instana AutoProfile, which is initialized in the application, records and reports regular CPU profiles to the Dashboard.
Instana AutoProfile for PHP collects a codepath capture for every request, no sampling. Each codepath capture is aggregated into a profile every 2 minutes which includes every invocation that was captured.
Get started troubleshooting your PHP bottlenecks today
Stop trying to recreate production issues in dev environments. Get started optimizing your PHP applications with Instana’s always on PHP production profiler in your Instana instance today. If you don’t already have an Instana instance, check out PHP Profiling with a free trial instance now. Once you see the power of profiling PHP applications in production, you’ll wonder why profiling was relegated to development environments to begin with.