If you been doing sysadmin work long enough, you’ve seen the dreaded "Server is slow" incidents. For a long time, these types of incidents would give me a pit in my stomach. How the heck do you troubleshoot something so subjective? An everyday user’s "slow" might just be caused by other processes (scheduled or not) running and consuming more resources than usual, or something could actually be wrong with the server.
When I first started working as a sysadmin, I would immediately reply with: "I need more information on this." Well, usually the user isn’t able to give any more info, because they don’t know what’s running behind the scenes or how to explain what they’re seeing other than "it’s just slow." Nowadays, before I even reply to the user, I check a few things out.
Initial login
There’s a lot you can tell by logging into the host. Can you log in at all? Is the login slow or hanging? The ssh
command has three debug levels, each of which gives you a plethora of information before you’re even on the system. To enable debug, just add an additional v
to the -v
option. For example, a level three debug, which is what I use exclusively, would be:
[~]$ ssh -vvv hostname.domain.com
The "Big 3" (aka CPU, RAM, and Disk I/O)
Now, let’s look at the three biggest causes of server slowdown: CPU, RAM, and disk I/O. CPU usage can cause overall slowness on the host, and difficulty completing tasks in a timely fashion. Some tools I use when looking at CPU are top
andsar
.
Checking CPU usage with top
The top
utility gives you a real-time look at what’s going on with the server. By default, when top
starts, it shows activity for all CPUs:
This view can be changed by pressing the numeric 1 key, which adds more detail regarding the usage values for each CPU:
Some things to look for in this view would be the load average (displayed on the right side of the top row), and the value of the following for each CPU:
us
: This percentage represents the amount of CPU consumed by user processes.sy
: This percentage represents the amount of CPU consumed by system processes.id
: This percentage represents how idle each CPU is.
Each of these three values can give you a fairly good, real-time idea of whether CPUs are bound by user processes or system processes.
To truly explain load average would need an article on its own. For the purpose of this article, I’ll talk in generalities. The three load average values from left to right represent one-minute, five-minute, and 15-minute averages. Again, speaking very generally, if you see the one-minute average go above the number of physical CPUs you have, then the system is most likely CPU bound.
Note: For more information about load average and why some people think it’s a silly number, check out Brendan Gregg’s in-depth research.
Checking all of the "Big 3" with sar
For historical CPU performance data I rely on the sar
command, which is provided by the sysstat
package. On most server versions of Linux, sysstat
is installed by default, but if it’s not, you can add it with your distro’s package manager. The sar
utility collects system data every 10 minutes via a cron job located in /etc/cron.d/sysstat
(CentOS 7.6). Here’s how to check all of the "Big 3" using sar
.
Note: If you’ve just installed sar
to follow along with this article, give the command some time to record data first.
The command sar -u
gives you info about all CPUs on the system, starting at midnight:
As with top
, the main things to check here are %user
, %system
, %iowait
, and %idle
. This information can tell you how far back the server has been having issues.
Overall, the sar
command can provide a lot of information. Since this article explains just a quick check of what’s happening on the server, check out man sar
to break down this info even further.
To check RAM performance, I use sar -r
, which give you that day’s memory usage:
The main thing to look for in RAM usage is %memused
and %commit
. A quick word about the %commit
field: This field can show above 100% since the Linux kernel routinely overcommits RAM. If %commit
is consistently over 100%, this result could be an indicator that the system needs more RAM.
For disk I/O performance, I use sar -d
, which gives you the disk I/O output using just the device name. To get the name of the devices, use sar -dP
:
For this output, looking at %util
and %await
will give you a good overall picture of disk I/O on the system. The %util
field is pretty self-explanatory: It’s the utilization of that device. The await
field contains the amount of time the I/O spends in the scheduler. Await is measured in milliseconds, and in my environment, I’ve seen that anything greater than 50ms starts to cause issues. That threshold may vary in your environment.
If any of these commands show a problem, you can go back to see when the server issues started by using sar {-u, -r, -d, -dP} -f /var/log/sa/sa<XX>
(where XX
is the day of the month you wish to look for).
At this point, I usually have a good idea of what’s currently happening on the server, and what’s been going on for the last 48 hours or so. I’ll reply to the user with more informed responses. For example: "I don’t see any indication of host slowness in the last 24 hours. Please try using a new putty profile to ssh
in, and let me know if you continue to have issues."
Another example: "I don’t see anything currently causing issues on this host, but I did notice some higher CPU load $time
. Is that when you saw issues? If so please try now and let me know if you continue to see issues."
You get the idea. Having the information provided by looking at the initial login and then running a few sar
commands, which generally take me less than 10 minutes to run, does a lot to head off more questions and reach a resolution faster.
저자 소개
Jake has been an Enterprise Linux Systems Administrator for the 13 years. His goal has been to automate himself out of a job and try as he will he's been unable to do so, yet. In his free time, he enjoys fishing, kayaking, and knife making.
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.