Mac mini M4 CPU 有四大六小共 10 个核心。

测试环境

  • Host: macmini M4
  • Orbstack Ubuntu 24 arm64
  • sysbench --threads=N cpu run

测试结果

events per second 增长
CPU 1 12,466 12466
CPU 2 24,578 12,111
CPU 3 33,675 9,097
CPU 4 45,208 11,533
CPU 5 48,280 3,072
CPU 6 50,525 2,245
CPU 7 52,561 2,036
CPU 8 55,614 3,053
CPU 9 56,840 1,226
CPU 10 61,872 5,033

测试图表

测试图表

测试结论

四大核心每核心性能在 12000 左右,六小核心每核心性能在 2000 到 3000 左右。基本上 M4 只能当成 4 核 CPU 看待。

说明

测试工具 sysbench

主机环境 Macmini m4

虚拟环境 OrbStack Alpine 3.21 and Ubuntu 24 arm

测试参数

  • CPU 1 : sysbench cpu run
  • CPU 2 : sysbench --threads=2 cpu run
  • Memory: sysbench memory run

测试数据

CPU: events per second

Memory: MiB/sec

测试参数 Alpine Ubuntu %
CPU 1 10955.54 12684.96 15.7
CPU 2 22058.52 25551.73 15.8
Memory 9283.85 13949.42 50.2

测试结论

Alpine Linux 由于使用 musllibc ,使得其体积远小于 Ubuntu,但其运行速度可能稍差于使用用 glibc 的 Ubuntu。

虚拟机内的磁盘速度会降低更多,所以硬盘 IO 多的应用,至少应该用内存做缓存。

sysbench 在 mac m4 本机上运行时,CPU 速度出奇的高,无法采信。

这是用 ABB 0.3 写的第一篇文章。

原站图片虽然不能正常显示,但还好原文件还在。

图片等比较大的静态文件,有三种处理方案。

第一种:直接与 css,js 一样,与生成的 html 文件放在一起。

  • 优点:最方便的处理方式,统一放在 img 目录就可以了。

  • 缺点:图片体积相对来说比较大,对单独服务器来说,带宽和流量都会有压力。

第二种:使用 cloudflare 的 R2。

  • 优点:速度上没问题,cf 也会自动分发。

  • 缺点:图片上传到 R2 比较不方便, 只能手工处理上传或者用 S3 API 上传。

第三种: 使用 github 仓库保存图片,然后用 jsdelivr 进行加速。

  • 优点:图片可以用 git 进行管理。

  • 缺点:非要找个问题,github 仓库会有容量限制。

ABB 采用第三种方案,这样可以统一用 git 进行管理。如果碰到容量限制,可以再开新仓库存放。

博客停更 N 年,ABB 也有十来年没动过了。

原程序是 python 2.x,在 VS Code 的帮助下,修改了几处小地方,适配了 python 3.12。基本功能都挺正常,值得发贴纪念。

图床也挂掉了,老文章也得找时间修正一下。

update 2017.07.30

Tesla Referral Program

You can give up to 5 friends unlimited Supercharging and a $1,400 credit toward their new Tesla.

Full details here.

153 days remaining

UNIQUE REFERRAL LINK

http://ts.la/wei6831

If you want a CAD$1400 credit and unlimited Supercharging on your purchasing a Model S or X in next 153 days, feel free to use my referral code.

Click me for referral code

or copy this link:

http://ts.la/wei6831

update at 2017.6.1

Tesla Referral Program
You can give up to 5 friends unlimited Supercharging and 
a $1,400 credit toward their new Tesla. 
Full details here.

212 days remaining
UNIQUE REFERRAL LINK
http://ts.la/wei6831

If you want a CA$1200 credit on your purchasing a Model S or X in next 80 days, feel free to use my referral code.

Here is the link to a free $1200 $CDN when buying your new Tesla.

Click me for referral code

or copy this link:

http://ts.la/wei6831

Note: Valid until June 15. 2017

场景

在 Virtualbox 上直接启动 boot2docker.iso , 并加载虚拟硬盘存放 images 以及个人数据. 远程 ssh 进入系统后进行 docker 操作. 如果能够本机操作,直接安装整合包.

下载

https://github.com/boot2docker/boot2docker/releases/download/v1.9.1/boot2docker.iso

Docker v1.9.1
Linux v4.1.13 (AUFS v4.1-20151116)
Parallels Tools v11.1.0-32202
VMware Tools (open-vm-tools) v10.0.0-3000743
VirtualBox Guest Additions v5.0.10
XenServer Tools (xe-guest-utilities) v6.6.80
	

Virtualbox

设置一个新的虚拟硬盘, 启动后设置硬盘 Lable 为 boot2docker-data, 重启后系统会自动挂载在 /var/lib/boot2docker 以及 /var/lib/docker 下, 前者放启动脚本, 后者放docker 数据.

fdisk /dev/sda
mkfs.ext4 -L boot2docker-data /dev/sda1
reboot
	

修改默认密码

默认帐号为 docker/tcuser,修改为自定义密码

openssl passwd -1 > mypasswd.txt
vi mypasswd.txt 在密码前面加上"docker:"
cd /var/lib/boo2docker
vi bootlocal.sh
chmod +x bootlocal.sh
	

bootlocal.sh 内容为:

#!/bin/sh
chpasswd -e < /var/lib/boot2docker/mypasswd.txt
	

重启 ok.

tips

目录 /var/lib/boot2docker 下可以存放一些启动脚本或定制数据.

- bootsync.sh		docker 服务启动前运行此脚本
- bootlocal.sh		系统启动完成后运行些脚本
- profile			自动装载硬盘后读取
- certs/			目录下可以放 Registry server's public certificate (in .pem format)

共享目录会按共享名自动装载, 如共享名为home/jsmith会 mount 到 /home/jsmith, 也可以手动 mount 到指定目录.

mount -t vboxsf -o uid=1000,gid=50 your-other-share-name /some/mount/location

场景

注:系统可以全部安装在 U 盘上,但引导必须有一个 SD 卡.

  • 小容量 microSD卡, 64M+即可,此处为8G
  • 大容量 U 盘,此处为16G,或 USB 外置硬盘,功耗要低点

安装步骤

按 [Rapberry Pi 2 运行 Docker]操作, 将 SD 卡部分换成大容量 U 盘.

SD 卡格式化为 FAT或 FAT32, 放入电脑.

将 U 盘上 FAT 分区中的所有文件 COPY 到 SD 卡根目录.

	

更改SD 卡 cmdline.txt 文件中的 root=/dev/mmcblk0p2为 root=/dev/sda2

+dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda2 rootfstype=ext4 cgroup-enable=memory swapaccount=1 elevator=deadline rootwait console=ttyAMA0,115200 kgdboc=ttyAMA0,115200

sd卡,u 盘均插在 pi 2上并启动.

启动后 u 盘容量没有完全使用,手工修正

fidks /dev/sda
p

记下 sda2的起始点

/dev/sda2       133120 2429686 2296567  1.1G 83 Linux
	

重做 sda2分区

d
2
n
p
2
133120 或 回车
回车
w
	

重启一下.

partprobe
/sbin/resize2fs /dev/disk/by-label/root
reboot
	

df 一下.

df
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/root       14583904 800080  13134556   6% /
devtmpfs          469540      0    469540   0% /dev
tmpfs             473852      0    473852   0% /dev/shm
tmpfs             473852   6272    467580   2% /run
tmpfs               5120      0      5120   0% /run/lock
tmpfs             473852      0    473852   0% /sys/fs/cgroup
/dev/mmcblk0p1   7776384  45312   7731072   1% /boot