linux
Why Your App Crashes Under Load: Linux Out of Memory Killed Process
A plain-English guide to why Linux kills apps when memory runs out, how to recognize OOM events, and how to prevent them.
Your app is fine when one person uses it, then a small burst of visitors arrives and it vanishes like somebody pulled the plug.
Short version: a Linux out of memory killed process event means the server ran out of usable RAM, so Linux protected itself by killing something. The exact log often says Out of memory: Killed process, and the fix is usually to reduce memory use, add memory, set safer limits, or stop too many things from competing on the same server.
Why does Linux kill a process when memory runs out?
Think of RAM as the counter space in a small kitchen. Your app, database, background jobs, web server, and the operating system all need room to work. When the counter is full, something has to move before the whole kitchen becomes unusable.
Linux has a last-resort safety mechanism called the OOM killer. OOM means “out of memory.” When the server cannot find enough memory to keep running safely, the OOM killer chooses a process and stops it.
That is why your app may simply disappear. It did not always “crash” because of a bug in your code. Linux may have ended it to keep the server alive.
The common log line looks like this:
Out of memory: Killed process 12345 (node) total-vm...
You might also see plain Killed in the terminal, or OOMKilled if your app runs in a container platform. Different wording, same basic story: memory pressure got too high.
Why does it happen under load but not when testing?
Load changes the shape of your app.
One visitor is like one person asking for a sandwich. Fifty visitors at the same time is fifty sandwiches, fifty plates, and a queue at the counter. Each request may need memory for uploaded files, database results, templates, images, API calls, cache data, or background work.
Some apps also keep memory after the request is finished. That can be normal, like a cache. Or it can be a memory leak, where the app forgets to give memory back. A leak is like leaving every used plate on the counter forever.
Common causes include:
- Too many app workers running at once
- A database using more memory than expected
- Large image or file uploads
- Background jobs starting at the same time as web traffic
- Containers with no clear memory limits
- Multiple projects sharing one small server
- A real memory leak in the application
If the whole server also feels slow before the app dies, the issue may be part of a wider resource problem. This guide on why a server gets slow explains the difference between CPU, RAM, disk, and traffic pressure: /blog/why-is-my-server-slow.
How do you know it was the OOM killer?
The strongest sign is the literal error string Out of memory: Killed process in the system logs. That tells you Linux made the decision, not your app framework.
Other clues are more indirect. Your process stops without a normal application error. The server stays reachable, but one service is gone. A container restarts and shows OOMKilled. Your app works again after a restart, then dies during the next traffic spike.
You are looking for the difference between “the app rejected a request” and “the app process no longer exists.” A normal application error is like a shop saying, “We cannot make that order.” An OOM kill is like the shop lights going out.
It helps to line up three things in time:
- When users reported the failure
- When the app process stopped or restarted
- When the server logged memory pressure or an OOM event
If those timestamps match, you have a strong lead.
How do you stop an app being OOM killed?
Start by reducing how many memory-hungry things can happen at once. Fewer app workers, smaller job batches, lower upload sizes, and more careful image processing can turn a sudden flood into a manageable queue.
Then look at what else lives on the same server. A database, Redis, a search tool, several websites, and background workers all draw from the same pool. Hosting multiple projects together can be fine, but without boundaries one busy project can push another off the counter. If that sounds familiar, this is the problem behind many messy multi-site setups: /blog/host-multiple-websites-on-one-server.
Next, check whether your server is simply too small for the job. If your app needs more working room than the server has, tuning can only go so far. The plain-English sizing guide here can help you think through CPU, RAM, and storage without guessing: /blog/what-size-server-do-you-need.
Finally, treat containers carefully. Containers are useful, but they do not magically create memory. If you are still getting comfortable with them, this beginner guide explains what Docker changes and what it does not: /blog/docker-on-server-for-beginners.
FAQ
**What does Out of memory: Killed process mean?** It means Linux ran out of safe usable memory and stopped a process to protect the server.
Is an OOM kill always caused by bad code? No. It can be caused by normal traffic, too many services, undersized RAM, bad limits, or a memory leak.
Why did Linux kill my app instead of something else? The OOM killer scores processes and chooses a target. Big memory users are more likely to be selected, but the choice can still surprise you.
Will adding more RAM fix it? Sometimes. But if you have a memory leak or unlimited background jobs, more RAM may only delay the next failure.
The shortcut
Server Manager helps by keeping the shape of your setup visible. Instead of guessing months later which app, database, worker, or website is sharing the same memory pool, you can see the arrangement in a way that still makes sense after the initial setup is forgotten.
That matters for the exact failures in this post: one project breaking another, containers quietly competing for RAM, and an app disappearing under traffic with only Out of memory: Killed process left behind. The real benefit is that your server is easier to reason about before you change it, not just after something has already gone down.
You still decide how much memory your app needs. But the setup stays legible enough that those decisions are based on the actual moving parts, not a half-remembered pile of services.
How do you keep the app stable next time?
You win by giving your app breathing room and clear boundaries.
An OOM kill is frightening because it looks sudden, but it usually has a cause you can track: too much traffic at once, too many workers, a hungry database, several projects sharing one server, or an app that keeps memory too long.
Once you know what Linux means by Out of memory: Killed process, the problem becomes less mysterious. You can size the server honestly, reduce the spikes, separate the noisy parts, and keep your app online when the next wave of visitors arrives.