Exam Module Subscription Required
You need an active Exam Module Subscription to access this content. Subscribe now to unlock the exam materials and continue your preparation.
Previous Job Question: Basic Introduction, Types, Kernel
Previous Job Question: Basic Introduction, Types, Kernel
- ☆1Operating SystemBasic Introduction, Types, KernelA high traffic web application suddenly begins failing with database connection timeouts under peak load. At the same time, the underlying Linux OS kernel hosting the database reports "too many open files" error and network socket exhaustion. Explain the root cause of this failure at the linux os kernel level.RAKUB, ANSE, 26 | AME/ANE/AE
The failure is caused by resource exhaustion at the Linux kernel level, specifically involving file descriptors and network sockets under high load.
Key Root Causes:
File Descriptor Exhaustion:
In Linux, everything like files, sockets, and network connections is handled using file descriptors. The error "too many open files" indicates that the process or system has exceeded the ulimit (open file descriptor limit) configured in the kernel.Socket Exhaustion:
Each database connection uses a TCP socket, which also consumes file descriptors. Under heavy load, too many simultaneous connections can exhaust available kernel socket resources.Kernel Resource Limits (ulimit / sysctl constraints):
The Linux kernel enforces several limits such as:- Maximum open files per process (ulimit -n)
- System-wide file descriptor limit
- TCP socket backlog limits
When these limits are reached, the system can no longer accept new connections, causing failures or timeouts.
Connection Leak / Poor Connection Pooling:
If the application does not properly close database connections or lacks efficient connection pooling, open sockets accumulate over time, eventually exhausting available resources.Why Timeouts Occur:
- New TCP connections cannot be created due to resource limits
- Connection requests remain in SYN queue or wait state
- Database requests fail, leading to timeout errors
Overall, the root cause is Linux kernel-level resource exhaustion, mainly due to hitting file descriptor and socket limits under peak load, often worsened by poor connection management at the application level.
Root Cause (Linux Kernel Level)
এই সমস্যার মূল কারণ হলো Linux kernel-level resource exhaustion, বিশেষ করে file descriptor এবং network socket শেষ হয়ে যাওয়া।
মূল কারণসমূহ:
File Descriptor Exhaustion:
Linux-এ file, socket, database connection সবই file descriptor হিসেবে গণনা হয়। "too many open files" error মানে হলো process বা system তার ulimit (open file limit) ছাড়িয়ে গেছে।Socket Exhaustion:
প্রতিটি database connection একটি TCP socket ব্যবহার করে। বেশি load হলে available socket শেষ হয়ে যেতে পারে।Kernel Resource Limits:
Linux kernel কিছু limit enforce করে যেমন:- per-process open file limit (ulimit -n)
- system-wide file descriptor limit
- TCP backlog limit
এই limit গুলো পৌঁছে গেলে নতুন connection তৈরি হতে পারে না।
Connection Leak / Pooling Problem:
Application যদি connection properly close না করে বা connection pool ব্যবহার না করে, তাহলে open socket জমে যায় এবং ধীরে ধীরে resource exhaustion ঘটে।
Timeout কেন হয়:
- নতুন TCP connection তৈরি হতে পারে না
- Request queue বা SYN queue-তে requests আটকে যায়
- Database connection attempt ব্যর্থ হয়ে timeout হয়
মূল সমস্যা হলো Linux kernel-level file descriptor এবং socket resource exhaustion, যা high traffic এবং improper connection management-এর কারণে ঘটে।
