1
00:00:00,330 --> 00:00:01,350
Sometimes we're going to need

2
00:00:01,350 --> 00:00:04,560
to get informations about our specific CPU,

3
00:00:04,560 --> 00:00:06,810
so the best thing to do is we can use less command,

4
00:00:06,810 --> 00:00:08,310
we're going to use a proc folder.

5
00:00:09,150 --> 00:00:10,300
We're going to do cpuinfo.

6
00:00:12,120 --> 00:00:14,820
Now this screen gives us a lot of good information

7
00:00:14,820 --> 00:00:17,250
about the type of processors that we're using.

8
00:00:17,250 --> 00:00:19,680
It identifies the number of processors

9
00:00:19,680 --> 00:00:20,850
that we're referring to.

10
00:00:20,850 --> 00:00:22,200
'Cause sometimes we might be in a situation

11
00:00:22,200 --> 00:00:24,330
where we have multiple processors.

12
00:00:24,330 --> 00:00:26,190
And we can see some good information here.

13
00:00:26,190 --> 00:00:27,750
Of course, cache size.

14
00:00:27,750 --> 00:00:29,520
We can also see the cpu cores,

15
00:00:29,520 --> 00:00:32,549
the amount of cores associated with this CPU.

16
00:00:32,549 --> 00:00:35,400
We can see speed with the cpu MHz,

17
00:00:35,400 --> 00:00:37,290
how fast it should be performing.

18
00:00:37,290 --> 00:00:39,090
And again, this is going to help us do some research,

19
00:00:39,090 --> 00:00:41,160
so when we start looking at more detailed information,

20
00:00:41,160 --> 00:00:42,570
we can get a good gauge

21
00:00:42,570 --> 00:00:45,090
on how fast should our CPU be running,

22
00:00:45,090 --> 00:00:47,880
which will determine how fast our system can operate.

23
00:00:47,880 --> 00:00:50,940
Another command we're going to like to use is called uptime.

24
00:00:50,940 --> 00:00:53,190
The most important part of this information

25
00:00:53,190 --> 00:00:55,260
is going to be the load average.

26
00:00:55,260 --> 00:00:59,010
The first field is for a one-minute increment.

27
00:00:59,010 --> 00:01:01,140
The second field is for five-minute increments.

28
00:01:01,140 --> 00:01:03,330
And the third field is for 15-minute increments.

29
00:01:03,330 --> 00:01:07,350
Now what this tells us is the average amount of processes

30
00:01:07,350 --> 00:01:10,500
that are being active or waiting to be used

31
00:01:10,500 --> 00:01:11,700
in that timeframe.

32
00:01:11,700 --> 00:01:15,960
So for example, for one minute, on average for that CPU,

33
00:01:15,960 --> 00:01:19,860
it's only taking 0.08 percentage/usage capacity

34
00:01:19,860 --> 00:01:21,240
for that CPU.

35
00:01:21,240 --> 00:01:22,860
And the same thing for the five-minute increment

36
00:01:22,860 --> 00:01:24,720
and the 15-minute increment.

37
00:01:24,720 --> 00:01:26,550
Now of course, the first field that we see

38
00:01:26,550 --> 00:01:28,500
all the way to the left, it just lets us know how long

39
00:01:28,500 --> 00:01:30,750
has the system been up from the very beginning,

40
00:01:30,750 --> 00:01:32,043
since this last reboot.

41
00:01:32,970 --> 00:01:34,530
The next command we would like to be familiar with

42
00:01:34,530 --> 00:01:35,940
is the sar command.

43
00:01:35,940 --> 00:01:37,440
It lets us see a breakdown

44
00:01:37,440 --> 00:01:39,330
of a lot of different information.

45
00:01:39,330 --> 00:01:41,790
This report consists of various sections,

46
00:01:41,790 --> 00:01:43,620
each of which consists of the type of data

47
00:01:43,620 --> 00:01:45,930
at the time it was collected.

48
00:01:45,930 --> 00:01:49,350
The default mode of the sar command displays the CPU usage

49
00:01:49,350 --> 00:01:52,050
in various time increments for each category of resource

50
00:01:52,050 --> 00:01:55,410
that access the CPU, such as users, the system,

51
00:01:55,410 --> 00:01:58,110
input/output scheduling, etcetera.

52
00:01:58,110 --> 00:01:59,003
And what's here at the bottom of the report,

53
00:01:59,003 --> 00:02:01,800
this is the average of all the information

54
00:02:01,800 --> 00:02:02,940
compiled together.

55
00:02:02,940 --> 00:02:05,160
Now another way we can format this sar command

56
00:02:05,160 --> 00:02:07,740
is we can use these two options.

57
00:02:07,740 --> 00:02:10,919
And what those two options determine is every 2 seconds,

58
00:02:10,919 --> 00:02:13,080
it's going to give us a total of 6 queries.

59
00:02:13,080 --> 00:02:14,940
So again, as you see like the last screen,

60
00:02:14,940 --> 00:02:16,800
it was kind of a lot of information all at once,

61
00:02:16,800 --> 00:02:19,800
but now we can kind of see things as they're happening,

62
00:02:19,800 --> 00:02:23,610
which will further help us isolate CPU performance issues.

63
00:02:23,610 --> 00:02:25,920
Now also with the sar, we can use this S option.

64
00:02:25,920 --> 00:02:28,320
It's going to give us swap space information.

65
00:02:28,320 --> 00:02:30,210
Now swap space is going to be key

66
00:02:30,210 --> 00:02:33,000
when you're dealing with systems that have low RAM usage

67
00:02:33,000 --> 00:02:35,100
because it's going to use the physical memory

68
00:02:35,100 --> 00:02:38,250
in order to offload some of that processes

69
00:02:38,250 --> 00:02:39,800
that the RAM's typically using.

70
00:02:40,680 --> 00:02:42,480
But we see here in my system,

71
00:02:42,480 --> 00:02:44,580
I'm not using much CPU speed, I'm only running the shell.

72
00:02:44,580 --> 00:02:46,740
So it's not going to be cause for too much concern.

73
00:02:46,740 --> 00:02:48,330
But when you're using a server

74
00:02:48,330 --> 00:02:50,820
that's really dealing with a lot of requests simultaneously,

75
00:02:50,820 --> 00:02:54,000
you might see the swap space used a certain period of time.

76
00:02:54,000 --> 00:02:56,550
Another good place to find information about your memory

77
00:02:56,550 --> 00:02:59,130
is going to be in that proc folder again.

78
00:02:59,130 --> 00:03:01,800
This time it's going to be under meminfo.

79
00:03:01,800 --> 00:03:04,290
And we went through multiple ways to check our memory.

80
00:03:04,290 --> 00:03:06,390
And I think at this point we can all agree

81
00:03:06,390 --> 00:03:09,870
that memory is vital to performance of any type of system,

82
00:03:09,870 --> 00:03:12,450
especially when it comes to servers.

83
00:03:12,450 --> 00:03:15,060
All right, now another way to quickly look at memory

84
00:03:15,060 --> 00:03:16,380
is the free command.

85
00:03:16,380 --> 00:03:18,810
It just gives us a quick view of what's free

86
00:03:18,810 --> 00:03:21,570
in our RAM and also in our swap memory.

87
00:03:21,570 --> 00:03:24,180
And of course, whenever we need a human-readable format,

88
00:03:24,180 --> 00:03:25,980
it helps us see a little bit better

89
00:03:25,980 --> 00:03:28,650
by converting things to megabytes and gigabytes,

90
00:03:28,650 --> 00:03:30,540
things that we're used to using

91
00:03:30,540 --> 00:03:32,970
when we're reading information and reports.

92
00:03:32,970 --> 00:03:35,070
And also if we're looking for a specific type of things,

93
00:03:35,070 --> 00:03:37,860
we can just set it up for megabytes

94
00:03:37,860 --> 00:03:40,530
and probably even gigabytes if we wanted to.

95
00:03:40,530 --> 00:03:43,500
Again, all these things are just for formatting the report,

96
00:03:43,500 --> 00:03:45,240
and the human-readable is probably going to be

97
00:03:45,240 --> 00:03:48,900
the most commonly used and most useful option for us.

98
00:03:48,900 --> 00:03:50,310
And one of the final commands we're going to go over

99
00:03:50,310 --> 00:03:52,173
is the vmstat command.

100
00:03:53,370 --> 00:03:57,750
So what that does is, again, we can use the same options

101
00:03:57,750 --> 00:03:58,920
that we use for the sar command.

102
00:03:58,920 --> 00:04:00,570
Pretty much what that does is it allows us

103
00:04:00,570 --> 00:04:03,570
to tell the system, "Hey, every 5 seconds

104
00:04:03,570 --> 00:04:06,060
we want 3 queries total."

105
00:04:06,060 --> 00:04:08,400
Because when you typically use the vmstat command,

106
00:04:08,400 --> 00:04:11,040
it only displays the last information

107
00:04:11,040 --> 00:04:12,603
from the most recent reboot.

108
00:04:13,620 --> 00:04:16,563
So this is going to give us a good look into what's going on.

109
00:04:20,730 --> 00:04:22,530
And this is just without the option.

110
00:04:23,760 --> 00:04:25,950
And we could also use the same command,

111
00:04:25,950 --> 00:04:27,480
but we're going to use a d option.

112
00:04:27,480 --> 00:04:31,440
And it helps us determine the information per device.

113
00:04:31,440 --> 00:04:34,560
So now it helps us isolate which partitions

114
00:04:34,560 --> 00:04:36,660
are using the most memory.

115
00:04:36,660 --> 00:04:37,980
Thank you for sticking with me with this walkthrough,

116
00:04:37,980 --> 00:04:39,780
and I'll see you in the next lesson.

