Operations 3 min read

Why Is My Server Overloaded? Diagnosing Nginx FastCGI Temp IO Bottleneck

A sudden high‑load alert on a web server was traced to Nginx’s massive write operations on fastcgi_temp files, revealed through top, iotop, lsof, strace and iostat, and temporarily resolved by redirecting fastcgi_temp to memory.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Why Is My Server Overloaded? Diagnosing Nginx FastCGI Temp IO Bottleneck

Problem description A server suddenly triggered a high‑load alarm and the website became slow.

Analysis

(1) Using top showed the CPU iowait exceeding 70%, indicating an IO overload.

(2) iotop -o revealed that Nginx’s write IO was unusually high, and top displayed the Nginx process in state D, meaning it was stuck waiting for IO.

At this point it was clear that Nginx’s heavy write activity caused the load, but the exact files being written were unknown.

(3) The PID of an Nginx worker was obtained and lsof -p <pid> listed open files, showing many entries under fastcgi_temp/xxx besides system libraries and logs.

(4) strace -p <pid> traced the process and confirmed massive writes to a specific file descriptor, matching the files identified by lsof.

(5) iostat 1 displayed heavy write IO on the partition that holds fastcgi_temp, confirming the source of the load.

A hypothesis was that an external client was uploading large files to php‑fpm, but monitoring inbound traffic with EZHTTP showed only modest traffic.

Solution

Since the fastcgi_temp IO pressure could not be eliminated instantly, the temporary fix was to point fastcgi_temp to /dev/shm (memory), restart Nginx, and restore service. A longer‑term fix will require collaboration with developers to address the root cause.

--- Thanks to HaiLin, chief architect of a major e‑commerce site, for providing this case study.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

OperationsNginxserver performanceIO BottleneckLinux troubleshootingfastcgi_temp
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.