../courses.php
The Server's Role
ASERVER
90
CPU RAM Disk And Network
Why a server can be running perfectly and still refuse to do the avatar's bidding.
A server has been answering requests normally for months. One day, with no code changed and no configuration touched, every new request suddenly fails or hangs, while requests that were already in progress finish normally. Nothing about what was asked of the server changed at all. What kind of problem produces a failure that depends on timing like this, rather than on anything about the request itself?
A server depends on a small number of finite physical resources, processing power, memory, disk space, and network capacity, to do any work at all. If one of these resources, commonly memory or disk space, becomes exhausted, the server can still be running and technically working, but has nothing left to do new work with. Existing requests already holding what they need can finish, while new requests that need to claim some of that same exhausted resource cannot, which is exactly the kind of failure that depends on when a request happens to arrive rather than on what it asks for.
Every server ultimately depends on four physical resources to do its job: CPU, the processing power to actually carry out instructions; RAM, the working memory programs use while running; disk, the storage holding files and data; and network capacity, the bandwidth available to send and receive data.
Each of these resources is finite, and a server can run out of any one of them independently of the others, producing different specific symptoms depending on which resource was actually exhausted.
Running out of disk space specifically can stop a server from doing things that have nothing obviously to do with storage, such as logging an error or even starting a new program, because many basic operations need to write something to disk to happen at all.
Running out of memory commonly causes whichever program most needs more of it to be forcibly stopped by the operating system, which can mean an entirely different, unrelated program on the same machine is the one that gets shut down.
Monitoring these four resources over time, rather than only checking them once something has already gone wrong, is what lets a problem be caught and addressed before it actually causes a visible failure.
Checking what a server actually has left, and finding the cause
$ df -h /
Filesystem Size Used Avail Use%
/dev/sda1 50G 50G 0G 100%
$ free -h
total used free
Mem: 4.0G 3.9G 0.1G
df -h / reports how much disk space is used and available on the main filesystem. 0G available with 100% used means this disk has nothing left to write to at all.
Many programs, including server software, fail in confusing, seemingly unrelated ways the moment they try to write a log entry, a temporary file, or anything else to a disk with zero space remaining.
free -h reports total and available memory. 0.1G free out of 4.0G total means almost no memory remains for any program that needs to start or grow.
A request already being handled, with memory it already claimed earlier, can often finish using what it has. A brand new request needing to claim its own fresh memory may not be able to get any, producing exactly the timing-dependent failure described in this lecture's opening question.
A disk problem and a memory problem can produce very similar symptoms from the outside, failures and hangs with no obvious pattern, which is why checking both, rather than guessing, is the faster way to find which resource is actually the cause.
A full disk can break things that have nothing to do with storage
A server at 100% disk usage can fail to log its own errors, fail to start new processes, or fail to save session data, none of which look, on the surface, like a storage problem, which is exactly why disk usage is worth checking even when the visible symptom seems unrelated to files.
Running out of memory can shut down the wrong program entirely
When memory runs critically low, the operating system commonly forces some running program to stop in order to free memory, and that program is not necessarily the one that used the most memory or caused the problem, which means an apparently unrelated service can be the one that goes down.
A resource problem can make old requests succeed while new ones fail
Work already in progress, holding resources it claimed earlier, can often complete normally even while a resource is exhausted, while brand new work needing to claim that same resource fails immediately, producing a failure pattern that depends entirely on timing rather than on anything about the request itself.
CPU, memory, disk, and network can each be the bottleneck, with different specific symptoms
A server maxed out on CPU tends to respond slowly rather than fail outright. One out of memory tends to crash specific programs. One out of disk tends to fail writes and logging. One saturated on network tends to time out or respond partially, which is why identifying which resource is actually constrained narrows down the likely cause significantly.
Catching a resource trend before it runs out prevents the failure entirely
A disk filling up gradually over weeks gives plenty of warning to whoever is watching its usage over time. The same failure, discovered only once it reaches 100%, looks sudden and confusing specifically because nobody was watching the trend leading up to it.
Checking disk space only after something fails
(no monitoring; df -h run for the first time during an outage)
Checking disk space on a regular schedule before it becomes a problem
$ df -h /
(checked on a daily schedule, trend tracked over time)
When an AI tool diagnoses a server failure, three things are worth checking. First, does it check CPU, memory, disk, and network usage as four separate, independently exhaustible resources rather than assuming only one generic kind of resource problem exists. Second, does it account for a resource shortage causing unrelated-looking symptoms, such as a full disk breaking logging. Third, does it consider that a timing-dependent failure pattern, old work succeeding while new work fails, points specifically toward a resource exhaustion problem.
Run df -h on a real system you have access to, and identify how much headroom remains on its main filesystem.
Run free -h on the same system, and explain what would likely happen if available memory reached zero while a new request arrived.
Describe, in your own words, why a server's CPU being maxed out tends to produce slow responses rather than outright failures, unlike memory or disk exhaustion.
Explain why a problem caused by a full disk might be mistaken for a completely unrelated software bug if disk usage is never checked.
Design a simple plan for checking these four resources on a regular schedule, rather than only reactively after something breaks.
Assuming a server failure must be caused by a software bug without first checking whether a physical resource, CPU, memory, disk, or network, was actually exhausted.
Failing to recognize that a full disk can cause failures that look completely unrelated to storage, such as broken logging or failed process starts.
Assuming the program that gets shut down during a memory shortage is necessarily the one that caused the shortage.
Checking a server's resources only after a failure has already happened, rather than tracking their trend over time.
Treating CPU, memory, disk, and network exhaustion as producing the same kind of symptom, rather than recognizing each one tends to fail in its own characteristic way.
You can now name the four physical resources every server depends on, and recognize the different, characteristic ways each one tends to fail when exhausted. You can also explain why a resource shortage can produce a failure that depends on timing, old work succeeding while new work fails, and why monitoring these resources over time catches a problem before it becomes a visible outage.
Login - Jit4All
Login
Welcome back to Jit4All