Shared server guidance · Question & answer

How do I tell whether swap is contributing to a slow Linux server?

Swap usage indicates that some pages are stored outside RAM, but a nonzero used value does not prove active thrashing. Focus on current swap-in and swap-out activity alongside memory availability and response time. Disabling swap under pressure can make the situation worse by removing capacity needed to hold pages.

IntermediateLinux VPS and dedicated servers with GNU utilities
Go to the answer

Before you start

  • An authorised SSH session on the Linux server.

Instructions

1. Inspect the configured swap devices or files

Use the reporting form only. It shows what is already active and does not create, enable or disable swap.

Remote Linux shell
swapon --show
free -h

Review total and used swap together with available RAM. A small amount of old swap usage can persist after earlier pressure has ended.

2. Sample current paging activity

Collect several short intervals while the symptom occurs. The first vmstat report is not equivalent to a fresh one-second interval.

Remote Linux shell
vmstat 1 5

Inspect si and so for swap traffic and correlate them with memory availability, blocked tasks and application latency. Units follow the installed tool’s documentation.

Check the result

  • The diagnosis identifies whether paging is active during the slowdown and whether an application limit or memory demand is driving it.

Troubleshooting

Swap is used but si and so stay near zero
The occupied pages may be inactive historical allocations rather than current thrashing.
There is no swap on the server
That may be intentional. Adding swap requires capacity, filesystem and workload review; it does not replace sufficient RAM.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.