ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

Linux性能优化工具系列详解(1)

Linux性能优化工具系列详解(1)

本系列内容参考:

极客时间 —— 倪朋飞 《Linux性能优化实战》

特此致谢!

序言

Linux系统性能优化,是基于Linux操作系统软硬件全栈,通过监控定位瓶颈、调整内核参数、优化调度/存储/网络、调整应用架构、合理分配硬件资源等手段,定位并消除系统资源瓶颈,提升系统吞吐量、降低响应延迟、减少资源损耗、保障业务稳定运行的整套工程体系。

性能优化是一个系统工程,涉及从程序设计、算法分析、编程语言,到系统、存储、网络等各种底层基础设施的方方面面。因此,性能优化五一是软件系统中最具有挑战的工作之一,同时也是最考验并体现个人综合能力的工作之一。

本系列是笔者基于极客时间中的倪朋飞《Linux性能优化实战》课程,对于其中提到的工具进行的引申学习。一方面,帮助笔者深入学习和理解该课程,也算作随笔;另一方面,在此基础上扩展和引申,帮助自己以及其它同仁更好地理解和掌握Linux性能优化以及相关工具。

闲言少叙,书归正文。

系列工具

1. uptime

(1)概述

uptime是计算机系统中用于反映系统运行状态的术语,在Unix/Linux系统中也是一个命令行工具。uptime是一个简单却功能强大的工具,它以一行简洁的输出提供关键信息,显示系统运行时长、当前登录用户数量及过去1、5、15分钟内的系统平均负载值,为服务器状态监测提供基础依据。uptime适合快速查看系统状态,无需复杂参数即可使用。

(2)详情

NAME
uptime - Tell how long the system has been running.

名称

uptime —— 告诉系统已经运行了多长时间。

SYNOPSIS
uptime [options]

简介

uptime [选项]

DESCRIPTION
uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

This is the same information contained in the header line displayed by w(1).

System load averages is the average number of processes that are either in a runnable or uninterruptable state. A process in a runnable state is either using the CPU or waiting to use the CPU. A process in uninterruptable state is waiting for some I/O access, eg waiting for disk. The averages are taken over the three time intervals.
Load averages are not normalized for the number of CPUs in a system, so a load average of 1 means a single CPU system is loaded all the time while on a 4 CPU system it means it was idle 75% of the time.

描述

uptime提供以下信息的单行显示:当前时间、系统运行时间、当前登录用户数以及过去1、5和15分钟的系统负载平均值。

这与w(1)显示的标题行中包含的信息相同。

系统负载平均值是处于可运行或不可中断状态的进程的平均数量。处于可运行状态的进程要么正在使用CPU,要么正在等待使用CPU。处于不可中断状态的进程正在等待某些I/O访问,例如等待磁盘。在三个(种)时间间隔内取平均值。

负载平均值不是针对系统中的CPU数量进行归一化的,因此负载平均值为1意味着单CPU系统一直在加载,而在4 CPU系统上,这意味着它有75%的时间处于空闲状态。

OPTIONS
-p, --pretty
show uptime in pretty format

-h, --help
display this help text

-s, --since
system up since, in yyyy-mm-dd HH:MM:SS format

-V, --version
display version information and exit

选项

  • -p, --pretty:以漂亮的格式显示正常运行时间。
  • -h, --help:显示此帮助文本。
  • -s, --since:以yyyy-mm-dd HH:mm:SS格式显示系统已运行时间。
  • -V, --version:显示版本信息并退出。

FILES
/var/run/utmp
information about who is currently logged on

/proc process information

文件

  • /var/run/utmp:关于当前登录用户的信息。
  • /proc:进程信息。

AUTHORS
uptime was written by Larry Greenfield ⟨greenfie@gauss.rutgers.edu⟩ and Michael K. Johnson ⟨johnsonm@sunsite.unc.edu⟩

作者

uptime命令是由Larry Greenfield (greenfie@gauss.rutgers.edu) 和Michael K.Johnson (johnsonm@sunsite.unc.edu)编写的。

更多内容请看下回。

返回列表