uptime

 

uptime Commands can be used to see how long the server has been running , How many users are currently logged in , And the server in the past 1 minute 、5 minute 、15 Average system load in minutes .

The best value for average load is 1, This means that every process can be executed immediately without missing CPU cycle . The normal value of load varies greatly in different systems . In a single processor workstation ,1 or 2 All are acceptable . On multiprocessor servers, however, you might see 8 To 10.

You can use uptime To determine if there's a problem with the server or the network . For example, if a web application is running , function uptime To see if the system load is high . If the load is not high , This problem is most likely caused by the network rather than the server .

Tips : You can use w Order in place of uptime.w It also provides information about the current system login user and the user's work .

 

On-line time (Uptime) It refers to the total working time of computer or communication system in a certain period of time . Contrary to online time Downtime Or offline time (Downtime), Downtime refers to a period of time when the computer or communication system cannot work properly Downtime Total duration of . Online time is one of the important indexes to measure the stability of computer or communication system .

uptime

There's another parameter -V( Capitalization ), It's used to query the version

procps It's a utility package , It mainly includes ps top kill And other programs are mainly used to display and control some system information , Process status and so on .

Input is shown below uptime Information about :

04:03:58 up 10 days, 13:19, 1 user, load average: 0.54, 0.40, 0.20

  1. current time 04:03:58
  2. The time that the system has been running 10 days, 13:19
  3. Current online user 1 user
  4. Average load :0.54, 0.40, 0.20, lately 1 minute 、5 minute 、15 Minute system load

cat /proc/loadavg

The most direct view of the system average load command

[email protected]:~# cat /proc/loadavg
0.10 0.06 0.01 1/72 29632

Except before 3 The number represents the average number of processes , hinder 1 A score , The denominator represents the total number of system processes , The numerator represents the number of running processes ; The last number indicates the most recently running process ID

What is system load ?

The average system load is defined as The average number of processes in the running queue during a specific time interval . If a process satisfies the following conditions, it will be in the run queue :

  • It's not waiting I/O Results of operation
  • It doesn't take the initiative to enter the waiting state ( That is, there is no call 'wait')
  • Not stopped ( for example : Waiting for termination )

Generally speaking , Every CPU The number of active processes in the kernel is not more than 3, Then the system runs well ! Of course, it's about every cpu kernel , That is, if your host is quad core cpu Words , So as long as uptime The value of the last output string is less than 12 It means that the system load is not very serious . Of course, if it reaches 20, That means the current system load is very heavy , It's estimated to open the execution web The script is very slow .