web server audit

Web server audit for PHP applications: identifying the causes of slow response times

A web server audit helps identify the root causes of performance issues affecting a website, extranet, or business application. Even when a service remains available, HTTP response times can increase and disrupt the user experience. However, adding hardware resources does not necessarily solve the problem.

The diagnostic process examines the entire HTTP request processing chain: network infrastructure, Nginx or Apache, applications, the database, and the Linux server. By correlating performance metrics with log data, teams can pinpoint bottlenecks and determine appropriate corrective actions.

What symptoms indicate web server performance issues?

A slow web application does not necessarily experience a complete outage. Performance issues may affect specific pages, business operations, or periods of high traffic. For this reason, the audit begins by characterizing the symptoms before examining the server configuration.

Analyzing HTTP 502 and 504 errors without confusing their causes

HTTP 502 errors indicate that a gateway or proxy received an invalid response from an upstream service. An HTTP 504 error generally indicates that the upstream service failed to respond within the expected time limit. However, these status codes alone do not establish that PHP-FPM or the Linux server has reached its capacity.

The analysis must correlate each error with Nginx or Apache logs, application events, and the time the issue occurred. This correlation helps distinguish a connection failure from excessive processing times or an unavailable service.

Distinguishing server-side performance issues from browser rendering problems

A page may still load slowly even when the server responds quickly. Large image files, JavaScript scripts, or third-party services can delay page rendering. Conversely, a slow SQL query can delay the HTTP response before the browser begins rendering the page.

The audit therefore distinguishes between server-side processing time, network communication, and browser-side operations. This distinction prevents teams from attributing a purely front-end issue to the Linux system.

web server audit

Measuring HTTP response times and analyzing server logs

A reliable diagnosis requires comparable performance measurements: consistent application workflows, clearly defined time periods, and known request volumes. Therefore, analyzing a single page is not enough to understand performance issues across an entire service.

server performance analysis

web server audit

Measuring TTFB and the 95th percentile of response times

Time to First Byte (TTFB) measures the elapsed time before the client receives the first byte of the response. It includes factors such as DNS resolution, connection establishment, and server-side processing. Consequently, TTFB alone does not measure application execution time.

The median and 95th percentile (p95) provide additional insights. In particular, p95 highlights slower requests that an apparently acceptable average may conceal. The audit compares these metrics across dynamic pages, API calls, and static files.

Correlating Nginx and Apache timing metrics with application logs

In Nginx, the variables $request_time and $upstream_response_time provide information about total request duration and upstream response time. However, administrators must include these variables in an appropriate log format to make them available for analysis. Their interpretation also depends on the architecture and interactions with the client.

In Apache, a log format that includes %D can record request processing time. Correlating this information with PHP-FPM logs, application errors, and system events helps refine the diagnosis.

Nginx is the preferred choice.

Assessing Linux resources, PHP-FPM, and databases

Performance issues often arise from interactions between multiple components. A Linux server audit must therefore assess available resources and the services responsible for processing requests. An increase in system load alone does not necessarily explain a slowdown.

Identifying CPU saturation, memory pressure, and disk I/O wait

The analysis examines CPU utilization, available memory, disk activity, and I/O latency. It also identifies processes responsible for abnormal resource consumption. The analysis then correlates these findings with the times when performance issues occurred.

For example, heavy disk activity can slow data access even when CPU utilization remains low. Conversely, insufficient memory can increase swap activity and degrade application performance.

web server audit

Assessing PHP-FPM pools and concurrent connections

On a PHP-based website, the pm.max_children setting determines the maximum number of child processes in a PHP-FPM pool. When all available processes are already handling requests, subsequent requests may have to wait. The audit examines the request queue, active processes, and whether the configured limit has been reached.

A PHP-FPM slow request log enabled by the administrator also helps identify long-running operations. However, increasing the number of processes without assessing available memory may simply shift the bottleneck elsewhere.

Identifying slow SQL queries and caching issues

Applications may make numerous requests to MariaDB/MySQL, PostgreSQL, or another database. As a result, a poorly indexed SQL query can increase response times even when the HTTP server has adequate capacity. The analysis focuses on expensive queries, indexes, and wait times associated with concurrent database access.

Depending on the application, FastCGI caching or Redis caching can reduce repetitive computations. However, these caching mechanisms require appropriate handling of dynamic content and cache invalidation. Sowneo presents these technologies on its dedicated server applications page.

Diagnostic example: identifying the root cause of an application slowdown

Consider a hypothetical business extranet whose pages become slow when multiple users access it simultaneously. A thorough diagnostic process does not begin by adding memory. Instead, it first determines where each request spends the most time.

Correlating an increase in p95 with PHP-FPM queue times

Aggregating the request durations recorded in HTTP logs reveals an increase in p95 during periods of high traffic. At the same time, the PHP-FPM request queue grows, and fewer worker processes remain available. These findings direct the investigation toward application processing capacity without yet establishing the root cause.

Determining whether PHP processes are waiting for database operations

The next step is to correlate slow PHP requests with database performance metrics. If several processes are waiting for the same SQL operation, increasing pm.max_children could increase database contention. Conversely, identifying the expensive query allows teams to implement a more targeted fix.

This example illustrates the methodology: measure, correlate, and validate the hypothesis before determining the appropriate corrective action. Only measurements collected from the environment under audit can confirm the actual cause.

Turning a web server audit into a measurable remediation plan

A web server audit report must prioritize identified issues and explain their impact on services. It must also distinguish between measured findings, probable causes, and areas that require further investigation. This approach ensures that technical decisions are based on traceable evidence.

Prioritizing corrective actions based on root cause, impact, and production risk

The remediation plan may address SQL indexes, PHP-FPM pools, Nginx configuration settings, or caching strategies. However, each change requires an assessment of its potential impact on production applications. Teams prepare critical changes and establish a rollback plan.

Validating results and establishing ongoing performance monitoring

After implementing corrective actions, teams compare response times, p95, HTTP errors, and resource utilization. Additionally, tests must closely replicate the conditions observed during the initial assessment. Without this comparison, an apparent performance improvement may simply result from lower traffic.

Server monitoring then helps track performance metrics and detect new issues. It complements the audit but does not replace an in-depth root cause analysis. Sowneo also provides managed services for Linux infrastructure.

Have Sowneo audit your web server

Sowneo web server audit

Sowneo has expertise in Linux systems administration, server applications, and IT systems auditing. Its services can include the analysis of HTTP services, application components, and their underlying infrastructure. To learn more about the scope of these services, explore our IT services for businesses.

Is your website, SaaS application, or extranet experiencing recurring performance issues, HTTP errors, or slowdowns under load? Contact Sowneo to discuss the symptoms and define the scope of your web server audit.