Sobes.tech
Middle

Server diagnostics: how would you act if you connected via SSH to an unfamiliar server that is slow?

sobes.tech AI

Answer from AI

When connecting via SSH to an unfamiliar server that is slow, I would act as follows:

  1. Load check:

    • top or htop — check CPU load, memory, processes.
    • uptime — find out the average load over 1, 5, 15 minutes.
  2. Memory and swap:

    • free -m — check the usage of RAM and swap.
  3. Disk activity:

    • iostat or iotop — check if the disk is overloaded.
    • df -h — check free space on disks.
  4. Network resources:

    • netstat -tulnp or ss -tulnp — view open ports and active connections.
    • iftop — monitor network traffic.
  5. Logs:

    • Review system logs (/var/log/syslog, /var/log/messages) for errors.
  6. Processes:

    • Identify processes with high load (ps aux --sort=-%cpu).
  7. Check for locks:

    • dmesg — view system messages related to hardware.
  8. Action plan:

    • If the problem is with a specific process — restart or optimize it.
    • If resources are exhausted — possibly increase resources or optimize configuration.

This systematic approach helps quickly localize the cause of slowdowns and take measures.