Category: linux

  • 更改centos cpu 调频模式

    [TOC]

    CPU frequency scaling (简体中文)

    CPU优化建议使用cpupower设置CPU Performance模式

    CPU频率

    查看 cpu 的频率

    [root@mulangcloud ~]# lscpu|grep Hz
    Model name:            Intel(R) Xeon(R) Silver 4210 CPU @ 2.20GHz
    CPU MHz:               1616.296
    CPU max MHz:           3200.0000
    CPU min MHz:           1000.0000
    

    每 4.2 查询一次,所有 cpu 核心的实时频率

    watch -n4.2  "cat /proc/cpuinfo | grep \"^[c]pu MHz\""
    

    cpufreq

    cpufreq是一个动态调整cpu频率的模块,系统启动时生成一个文件夹/sys/devices/system/cpu/cpu0/cpufreq/,文件夹里有一些 cpu 频率信息.

    ###scaling_min_freq代表最低频率
    [root@mulangcloud ~]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    1000000
    ###scaling_max_freq代表最高频率
    [root@mulangcloud ~]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    3200000
    ###scalin_governor代表cpu频率调整模式
    [root@mulangcloud ~]# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    performance
    

    cpu 调频模式

    模式
    performance 将CPU频率固定工作在其支持的最高运行频率上,而不动态调节.追求系统高性能
    powersave 将CPU频率设置为最低的所谓“省电”模式,CPU会固定工作在其支持的最低运行频率上. 追求系统低功耗
    userspace 运行于用户指定的频率
    ondemand 按需快速动态调整CPU频率, 一有cpu计算量的任务,就会立即达到最大频率运行,空闲时间增加就降低频率
    conservative 与ondemand不同,平滑地调整CPU频率,频率的升降是渐变式的,会自动在频率上下限调整

    cpupower

    cpupower 是一组为辅助 CPU 调频而设计的用户空间工具。该软件包并非必须,但强烈建议安装,因为它提供了方便的命令行实用程序,并且内置 systemd 服务,可在启动时更改调频器。

    查看 cpu 频率

    [root@mulangcloud ~]# cpupower frequency-info
    analyzing CPU 0:
      driver: intel_pstate
      CPUs which run at the same hardware frequency: 0
      CPUs which need to have their frequency coordinated by software: 0
      maximum transition latency:  Cannot determine or is not supported.
      hardware limits: 1000 MHz - 3.20 GHz # 硬件限制色频率
      available cpufreq governors: performance powersave
      current policy: frequency should be within 1000 MHz and 3.20 GHz.
                      The governor "performance" may decide which speed to use
                      within this range.
      current CPU frequency: 2.68 GHz (asserted by call to hardware)
      boost state support:
        Supported: yes
        Active: yes
    

    cpupower设置performance

    cpupower frequency-set -g performance
    

    mac os 查询 cpu

    sysctl -a | grep machdep.cpu
    
  • rpm 与 yum 常用查询功能

    [TOC]

    例如查询ceph rados 命令的依赖包

    ldd /usr/bin/rados |awk '{print $3}'|grep '^/' |xargs -i  rpm -qf {}|xargs -i rpm -qi {} |grep ceph -B 10 -A 10
    

    rpm 查询

    rpm -qf 查询文件来源于那个package

    [root@localhost ~]# rpm -qf /usr/bin/rados
    ceph-common-10.2.10-0.el7.x86_64
    

    rpm -qi 查询rpm package 信息

    rpm -qi ceph-common
    Name        : ceph-common
    Epoch       : 1
    Version     : 10.2.10
    Release     : 0.el7
    Architecture: x86_64
    Install Date: Sat 23 May 2020 04:12:25 PM CST
    Group       : System Environment/Base
    Size        : 62321887
    License     : LGPL-2.1 and CC-BY-SA-1.0 and GPL-2.0 and BSL-1.0 and GPL-2.0-with-autoconf-exception and BSD-3-Clause and MIT
    Signature   : RSA/SHA1, Mon 13 Nov 2017 05:33:12 PM CST, Key ID d4a2e50be451e5b5
    Source RPM  : ceph-10.2.10-0.el7.src.rpm
    Build Date  : Wed 18 Oct 2017 11:04:07 PM CST
    Build Host  : c1bj.rdu2.centos.org
    Relocations : (not relocatable)
    Packager    : CBS <cbs@centos.org>
    Vendor      : CentOS
    URL         : http://ceph.com/
    Summary     : Ceph Common
    Description :
    Common utilities to mount and interact with a ceph storage cluster.
    Comprised of files that are common to Ceph clients and servers.
    

    rpm -qR 查询package 依赖

    [root@localhost ~]# rpm -qR ceph-common
    /bin/bash
    /bin/sh
    /bin/sh
    /bin/sh
    /bin/sh
    /usr/bin/env
    config(ceph-common) = 1:10.2.10-0.el7
    ld-linux-x86-64.so.2()(64bit)
    ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
    libbabeltrace-ctf.so.1()(64bit)
    libbabeltrace.so.1()(64bit)
    libblkid.so.1()(64bit)
    libblkid.so.1(BLKID_1.0)(64bit)
    ...
    

    rpm -qa 查找所以

    [root@localhost ~]# rpm -qa |grep ceph
    centos-release-ceph-jewel-1.0-1.el7.centos.noarch
    libcephfs1-10.2.10-0.el7.x86_64
    python-cephfs-10.2.10-0.el7.x86_64
    ceph-common-10.2.10-0.el7.x86_64
    

    rpm -q

    [root@localhost ~]# rpm -q ceph-common
    ceph-common-10.2.10-0.el7.x86_64
    [root@localhost ~]# rpm -q ceph-common-10.2.10-0.el7.x86_64
    ceph-common-10.2.10-0.el7.x86_64
    [root@localhost ~]# rpm -q ceph-common-10.2.10-0.el7
    ceph-common-10.2.10-0.el7.x86_64
    

    yum 查询

    yum 查询软件可用版本

    [root@localhost ~]# yum list ceph-common --showduplicates
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.njupt.edu.cn
     * centos-qemu-ev: mirrors.ustc.edu.cn
     * extras: mirrors.dgut.edu.cn
     * updates: mirrors.dgut.edu.cn
    Installed Packages
    ceph-common.x86_64      1:10.2.10-0.el7  @centos-ceph-jewel
    Available Packages
    ceph-common.x86_64      1:10.2.5-4.el7   base
    ceph-common.x86_64      1:10.2.7-0.el7   centos-ceph-jewel
    ceph-common.x86_64      1:10.2.10-0.el7  centos-ceph-jewel
    

    yum 查询软件需要的依赖

    [root@localhost ~]#  yum deplist ceph-common
    
    Loaded plugins: fastestmirror
    Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
    Loading mirror speeds from cached hostfile
     * base: mirrors.njupt.edu.cn
     * centos-qemu-ev: mirrors.ustc.edu.cn
     * extras: mirrors.dgut.edu.cn
     * updates: mirrors.dgut.edu.cn
    package: ceph-common.x86_64 1:10.2.10-0.el7
      dependency: /bin/bash
       provider: bash.x86_64 4.2.46-34.el7
      dependency: /bin/sh
       provider: bash.x86_64 4.2.46-34.el7
      dependency: /usr/bin/env
       provider: coreutils.x86_64 8.22-24.el7_9.2
      dependency: ld-linux-x86-64.so.2()(64bit)
       provider: glibc.x86_64 2.17-324.el7_9
      dependency: ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
       provider: glibc.x86_64 2.17-324.el7_9
    
  • 笔记_CPU缓存知识

    记录一下 cpu cache 相关内容

    (more…)

  • outline accesskey format

    ss://base64(method:passwod)@server-address:port

  • 查看tcp 队列

    查看队列溢出

    netstat -s | egrep "listen|LISTEN"
        ;全连接队列溢出次数:
        41696 times the listen queue of a socket overflowed
        ;半连接队列溢出次数:
        41696 SYNs to LISTEN sockets dropped
    

    (more…)