赞
踩
很荣幸通过龙芯官方申请到了龙芯云的体验资源,审核很快,大概几天过后就会有邮件发送过来了,这次申请到的服务器资源为龙芯3A4000的CPU
硬件信息概况:
root@loongson-PC:/home/loongcloud# lshw -short H/W path Device Class Description =================================================== system loongson,generic /0 bus Motherboard /0/0 processor ICT Loongson-3A R4 (Loongson-3A4000) @ 1800MHz /0/1 processor ICT Loongson-3A R4 (Loongson-3A4000) @ 1800MHz /0/2 processor CPU /0/3 processor CPU /0/4 processor CPU /0/5 processor CPU /0/6 memory 8GiB System memory /0/100 bridge Hyper Transport Bridge Controller /0/100/1 bus KeyLargo/Intrepid USB /0/100/2 display QXL paravirtual graphic card /0/100/3 network Virtio network device /0/100/3/0 enp0s3 network Ethernet interface /0/100/4 bus QEMU XHCI Host Controller /0/100/5 communication Virtio console /0/100/5/0 generic Virtual I/O device /0/100/6 storage Virtio block device /0/100/6/0 /dev/vda disk 53GB Virtual I/O device /0/100/6/0/1 /dev/vda1 volume 299MiB Windows FAT volume /0/100/6/0/2 /dev/vda2 volume 8001MiB swap partition /0/100/6/0/3 /dev/vda3 volume 41GiB EXT4 volume /0/100/7 generic Virtio memory balloon /0/100/7/0 generic Virtual I/O device
这里建议切换为bash,因为sh实在太难用
bash
首先龙芯云配置的镜像源是UOS20 Server的镜像源,但我死活无法apt更新网络一直报错,于是我更新为deepin20的镜像源
要换源首先要备份原来的镜像源:
cp /etc/apt/sources.list /etc/apt/sources.list.bak
然后编辑镜像源:
vim /etc/apt/sources.list
填入:
deepin 20 镜像源
## Generated by deepin-installer
deb [by-hash=force] https://community-packages.deepin.com/deepin/ apricot main contrib non-free
#deb-src https://community-packages.deepin.com/deepin/ apricot main contrib non-free
保存退出,并更新:
apt update && apt upgrade -y
然后发现deepin20的镜像源对于龙芯的MIPS64架构支持得不是很友好,许多包都没有,于是查询了一下,deepin20基于debian10,于是将源改成了debian10的镜像源,对于mips64的包就多了很多了
所以总结一下套壳顺序:UOS 20 -> Deepin 20 -> Debian 10
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
如果遇到无法拉取 https 源的情况,请先使用 http 源并安装:
sudo apt install apt-transport-https ca-certificates
保存退出,并更新:
apt update && apt upgrade -y
编辑sudoers文件:
vim /etc/sudoers
从以下四个规则里面四选一:
loongcloud ALL=(ALL) ALL
%loongcloud ALL=(ALL) ALL
loongcloud ALL=(ALL) NOPASSWD: ALL
%loongcloud ALL=(ALL) NOPASSWD: ALL
我选择了第三种,对于个人用的机器比较方便,但是对于服务器安全性不太高
首先安装pip:
sudo apt install python-pip python3-pip -y
临时使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
注意,simple
不能少, 是 https
而不是 http
设为默认:
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
aptitude与 apt-get 一样,是 Debian 及其衍生系统中功能极其强大的包管理工具。与 apt-get 不同的是,aptitude在处理依赖问题上更佳一些。举例来说,aptitude在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。
简单来说就是可以解决很多奇怪的依赖问题,安装:
sudo apt install aptitude
使用aptitude的方法与apt的方法相同
因为龙芯云搭配UOS 20 Server并没有配置g++编译器,需要我们重新安装带g++版本的gcc:
sudo aptitude install g++
然后第一部选择n,降级包,然后选择y安装即可
mux是一个 terminal multiplexer(终端复用器),它可以启动一系列终端会话
我们使用命令行时,打开一个终端窗口,,会话开始,执行某些命令如npm run dev,关闭此终端窗口,会话结束,npm run dev服务会话随之被关闭。有时我们希望我们运行的服务如npm run dev 或者一些cd命令等,被保留,而不是关闭窗口再打开后,重新手动执行。tmux的主要用途就在于此
它解绑了会话和终端窗口。关闭终端窗口再打开,会话并不终止,而是继续运行在执行。将会话与终端窗后彻底分离
简单来说就是可以实现终端复用,安装:
sudo aptitude install tmux
wget和curl都是常见的网络下载工具
不得不说龙芯版本的UOS 20 Server 连wget都没有是十分不方便的事情,还有g++编译器也没有,强烈建议以后要附加上,不然基本工具链都很麻烦
NPM是随同NodeJS一起安装的包管理工具,能解决NodeJS代码部署上的很多问题,常见的使用场景有以下几种:
sudo aptitude install wget curl npm -y
更换为bash:
sudo chsh -s $(which bash)
这里的性能测试主要针对CPU性能本身,使用的工具是UnixBench
UnixBench是一个类 Unix 系(Unix,BSD,Linux)统下的性能测试工具,一个开源工具,被广泛用与测试 Linux 系统主机的性能。UnixBench 的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C库等系统基准性能提供测试数据
在GitHub上可以获取到所有的源代码,来自行编译
git clone https://github.com/kdlucas/byte-unixbench.git
1
预选项:
sed -i 's/-mtune=native//' Makefile
sed -i 's/-march=native//' Makefile
sed -i 's/$field eq "bogomips"/$field eq "bogomips" or $field eq "BogoMIPS" /g' Run
CPU整型跑分指令:
./Run -c 1 dhry2reg
CPU浮点型跑分指令:
./Run -c 1 whetstone
这里使用另外两台VPS的不同架构的CPU作为对比:
这里主要测试单核性能,因为腾讯云的服务器只有一个核心
型号 | 整型 | 浮点 |
---|---|---|
Loongson-3A4000 | 1100.3 | 377.8 |
Huawei Kunpeng 920 | 3449.7 | 655.5 |
Intel® Xeon® Gold 6148 CPU @ 2.40GHz | 3395.3 | 1193.4 |
Loongson-3A4000 整型:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: loongson-PC: GNU/Linux OS: GNU/Linux -- 4.19.0-loongson-3-server -- #1187 SMP PREEMPT Wed Mar 25 22:36:49 CST 2020 Machine: mips64 (unknown) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: ICT Loongson-3A R4 (Loongson-3A4000) @ 1800MHz (3577.8 bogomips) CPU 1: ICT Loongson-3A R4 (Loongson-3A4000) @ 1800MHz (3594.0 bogomips) 08:57:43 up 7 days, 21:12, 2 users, load average: 0.00, 0.44, 0.62; runlevel 2020-12-22 ------------------------------------------------------------------------ Benchmark Run: 三 12月 30 2020 08:57:43 - 08:59:56 2 CPUs in system; running 1 parallel copy of tests Dhrystone 2 using register variables 12840354.6 lps (10.0 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 12840354.6 1100.3 ======== System Benchmarks Index Score (Partial Only) 1100.3
Loongson-3A4000 浮点:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: loongson-PC: GNU/Linux OS: GNU/Linux -- 4.19.0-loongson-3-server -- #1187 SMP PREEMPT Wed Mar 25 22:36:49 CST 2020 Machine: mips64 (unknown) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: ICT Loongson-3A R4 (Loongson-3A4000) @ 1800MHz (3577.8 bogomips) CPU 1: ICT Loongson-3A R4 (Loongson-3A4000) @ 1800MHz (3594.0 bogomips) 09:03:57 up 7 days, 21:18, 2 users, load average: 0.14, 0.27, 0.50; runlevel 2020-12-22 ------------------------------------------------------------------------ Benchmark Run: 三 12月 30 2020 09:03:57 - 09:06:22 2 CPUs in system; running 1 parallel copy of tests Double-Precision Whetstone 2077.9 MWIPS (9.9 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX Double-Precision Whetstone 55.0 2077.9 377.8 ======== System Benchmarks Index Score (Partial Only) 377.8
Huawei Kunpeng 920 整型:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: ecs-kc1-large-2-linux-20201025105424: GNU/Linux OS: GNU/Linux -- 4.15.0-124-generic -- #127-Ubuntu SMP Fri Nov 6 10:58:37 UTC 2020 Machine: aarch64 (aarch64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: (200.0 bogomips) CPU 1: (200.0 bogomips) 08:57:13 up 16 days, 14:14, 1 user, load average: 0.00, 0.00, 0.00; runlevel 2020-12-13 ------------------------------------------------------------------------ Benchmark Run: Wed Dec 30 2020 08:57:13 - 08:59:23 2 CPUs in system; running 1 parallel copy of tests Dhrystone 2 using register variables 40257567.5 lps (10.0 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 40257567.5 3449.7 ======== System Benchmarks Index Score (Partial Only) 3449.7
Huawei Kunpeng 920 浮点:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: ecs-kc1-large-2-linux-20201025105424: GNU/Linux OS: GNU/Linux -- 4.15.0-124-generic -- #127-Ubuntu SMP Fri Nov 6 10:58:37 UTC 2020 Machine: aarch64 (aarch64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: (200.0 bogomips) CPU 1: (200.0 bogomips) 09:03:48 up 16 days, 14:21, 1 user, load average: 0.01, 0.11, 0.07; runlevel 2020-12-13 ------------------------------------------------------------------------ Benchmark Run: Wed Dec 30 2020 09:03:48 - 09:06:28 2 CPUs in system; running 1 parallel copy of tests Double-Precision Whetstone 3605.4 MWIPS (9.8 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX Double-Precision Whetstone 55.0 3605.4 655.5 ======== System Benchmarks Index Score (Partial Only) 655.5
Intel® Xeon® Gold 6148 CPU @ 2.40GHz 整型:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: VM-0-16-ubuntu: GNU/Linux OS: GNU/Linux -- 5.4.0-42-generic -- #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 Machine: x86_64 (x86_64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz (4800.0 bogomips) x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET 09:00:07 up 2 days, 16:00, 1 user, load average: 0.32, 0.24, 0.10; runlevel 2020-12-27 ------------------------------------------------------------------------ Benchmark Run: Wed Dec 30 2020 09:00:07 - 09:02:17 1 CPU in system; running 1 parallel copy of tests Dhrystone 2 using register variables 39623549.0 lps (10.0 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 39623549.0 3395.3 ======== System Benchmarks Index Score (Partial Only) 3395.3
Intel® Xeon® Gold 6148 CPU @ 2.40GHz 整型:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: VM-0-16-ubuntu: GNU/Linux OS: GNU/Linux -- 5.4.0-42-generic -- #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 Machine: x86_64 (x86_64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz (4800.0 bogomips) x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET 09:03:44 up 2 days, 16:03, 1 user, load average: 0.17, 0.32, 0.17; runlevel 2020-12-27 ------------------------------------------------------------------------ Benchmark Run: Wed Dec 30 2020 09:03:44 - 09:06:17 1 CPU in system; running 1 parallel copy of tests Double-Precision Whetstone 6563.8 MWIPS (9.8 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX Double-Precision Whetstone 55.0 6563.8 1193.4 ======== System Benchmarks Index Score (Partial Only) 1193.4
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。