# 小鸡性能/信息查看


你终于买到/py到/偷到/蹭到一个你心仪的VPS。不妨看看这个小鸡怎么样。
注意:这篇文章只针对主流Linux发行版


# 一键脚本

在使用一键脚本前,您最好先刷新一下软件源。有两个软件是所有脚本运行起来的前提,其实就是让您的VPS从互联网上把脚本下载下来。

//Deb系(Ubuntu,Debian)
apt update|apt install curl,wget -y

//CentOS
yum update|yum install curl,wget -y

以下是可选的VPS综合测试脚本:

  • written by 秋水逸冰 (opens new window)

    curl -Lso- bench.sh | bash
    //或
    wget -qO- bench.sh | bash
    
  • written by ilemonrain (opens new window)

    //快速检测
    curl -fsSL http://ilemonra.in/LemonBenchIntl | bash -s fast
    //完整检测
    curl -fsSL http://ilemonra.in/LemonBenchIntl | bash -s full
    

    最好用快速检测以防SSH断线导致测试失败

  • written by oooldking (opens new window)

    curl -Lso- git.io/superbench.sh | bash
    //或
    wget -qO- git.io/superbench.sh | bash
    

  • 查看VPS流媒体解锁情况
    written by lmc999 (opens new window)

    bash <(curl -L -s https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh)
    


# 这可真没意思

如果你是真君子,不想占用大家的公共资源,或者你很好奇这背后的原理,不用担心。
作者正好很好奇这点 (并不会把shell脚本拆开来再ctrl+cv)
我就写在这里罢。

  • # 查看操作系统概况

    查看Linux发行版:

    lsb_release -a
    

    查看Linux内核版本:

    uname -a 
    
  • # 查看硬件信息

    处理器信息

    cat /proc/cpuinfo
    

    RAM大小

    //以MB为单位
    free -m
    //以GB为单位
    free -g
    
  • # 查看VPS虚拟化技术

    VPS虚拟化技术个人认为值得去知道,这可以大概地判断商家是不是 超 开 大 师 ,举个例子,Xen和KVM是比较“独立”的虚拟技术, 分配出的小鸡性能相对较好,除了处理器资源之外,其他的资源如RAM和硬盘是无法重复占用的,可以自行DD重做系统。
    而OpenVZ、LXC甚至是Docker的小鸡,得留意一点商家名声了。

    //Deb系
    apt install virt-what | virt-what
    //CentOS
    yum install virt-what | virt-what
    

  • # OpenVZ及LXC查看RAM超开

    如果你买到了这种VPS,如果觉得用着特别迟钝或者程序整天崩溃,CPU整天满载,然而RAM剩余很多,那可能就是超开十分严重的VPS了。
    如果你实在是想要看一下的话,按着顺序运行:
    written by FunctionClub (opens new window)
    Deb系

    apt-get update
    apt-get install wget build-essential -y
    wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
    gcc -l stdc++ memtester.cpp
    ./a.out
    

    CentOS

    yum install wget -y
    yum groupinstall "Development Tools" -y
    wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
    gcc -l stdc++ memtester.cpp
    ./a.out
    

    这个程序将会在被Linux杀死之前展示当前的内存占用。
    如果测试结果和商家声称不符的话,恭喜你。

  • # IO性能和状态

    商家可能会捡一些用HDD的垃圾物理机,或者超开严重,导致IO效率十分低,以至于执行命令等半天,你可以用下面这个命令检测当前磁盘速度。

    //通用
    dd if=/dev/zero of=test bs=8k count=256k conv=fdatasync
    
    //若SSD硬盘
    fdisk -l //(查看硬盘驱动号,看最大的分区,如"/dev/hda")
    //Deb系
    apt install hdparm -y | hdparm -t /dev/hda //(根据实际改动)
    //CentOS
    yum install hdparm -y | hdparm -t /dev/hda //(根据实际改动)
    

    你也可以用Linux自带的当前服务器性能数据功能,来查看IO负载。

     top
    
     //若顶上的"wa"参数超过40左右IO较繁忙
     //打ctrl+c退出
    
  • # 简单的网速检测

    curl --output /dev/null https://cachefly.cachefly.net/100mb.test
    

    你应该可以看到输出:

    root@homocloud-114514:~# curl --output /dev/null https://cachefly.cachefly.net/100mb.test
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    100  100M  100  100M    0     0  76.8M      0  0:00:01  0:00:01 --:--:-- 76.8M
    

    速度转换: Average Dload 乘以8,即 76.8Mb/s * 8=614.4Mbps 毕竟VPS都是共享端口,不一定会和商家声称的带宽一模一样。
    你也可以用Fast.com 或者 Speedtest脚本进行网络连接速度测试。

  • Fast.com

    wget https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_amd64 -O fast
    chmod +x fast
    ./fast
    
  • Speedtest

    wget -O speedtest https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
    chmod +x speedtest
    ./speedtest
    

    运行之前先确保安装了Python环境。

上次更新: 7/21/2022, 3:17:43 AM