Files
markbase/docs/ISCSI_PERFORMANCE_COMPARISON.md
Warren 1300a4e223
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
MarkBase架构升级:Multi-Volume Virtual Tree + Dual-View Management + Git Remote修正
核心功能:
-  Categories/Series双视图管理(category_view.rs + import_markdown.rs)
-  FUSE Multi-Volume支持(tree_type参数)
-  SSH/SFTP/SCP/rsync协议完整实现(4042行)
-  NFS/SMB Module Phase 1-3完成
-  Archive Module Phase 1-4完成(2916行)
-  Download Center API完整实现
-  S3兼容API实现(560行)

Git配置修正:
-  删除错误origin(gitea.momentry.ddns.net)
-  删除m5max128(指向机器名)
-  设置origin = m5max128gitea.momentry.ddns.net/admin/markbase
-  设置m4minigitea = m4minigitea.momentry.ddns.net/warren/markbase

数据清理:
-  删除38个临时SQLite(保留accusys.sqlite、demo.sqlite)
-  删除.bak、test_*.bin、调试脚本等临时文件
-  删除临时目录(build/、download files/、raid_test/等)
-  更新.gitignore排除临时文件

架构优化:
- 52个文件修改,2434行新增,4739行删除
- Workspace成员整合(16个crate)
- 数据库状态:accusys.sqlite保留(主demo测试)

远程同步:
-  准备推送到m5max128gitea(远程Gitea)
-  准备推送到m4minigitea(本地Gitea)
2026-06-12 12:59:54 +08:00

6.3 KiB
Raw Blame History

iSCSI Performance Comparison: macOS vs Colima

测试日期: 2026-05-30 测试环境: M4 Mac mini, 16GB RAM, macOS 26.5, Colima v0.10.1


测试配置

macOS Local NVMe

  • 存储: Apple NVMe (内置)
  • 文件系统: APFS
  • 测试方法: dd sequential, dd random

Colima Volume Mount

  • Backend: macOS Virtualization.Framework
  • Mount Type: virtiofs
  • 测试方法: dd in container

iSCSI Target (Colima)

  • Backend: tgt (Linux iSCSI target)
  • LUN Size: 256MB (/lun0.img)
  • Target: iqn.2026-05.momentry:libiscsi-test
  • Port: 3260
  • 测试方法: dd + fio in container

Sequential I/O Performance

Write Performance (256MB)

方案 速度 倍数 (相对Colima)
iSCSI in Colima 4700 MB/s 1.96x
macOS NVMe 3410 MB/s 1.42x
Colima Volume 2400 MB/s 1.0x

结论: iSCSI write速度最快比Colima volume快2倍


Read Performance (256MB)

方案 速度 倍数 (相对Colima)
iSCSI in Colima 19200 MB/s 4.27x
macOS NVMe 17791 MB/s 3.95x
Colima Volume 4500 MB/s 1.0x

结论: iSCSI read速度惊人19.2 GB/s


Random I/O Performance (4KB blocks)

iSCSI Random Read (fio)

read: IOPS=119k, BW=465MiB/s (488MB/s)
  • IOPS: 119,000 (4KB reads/sec)
  • Bandwidth: 465 MB/s

iSCSI Random Write (fio)

write: IOPS=78.8k, BW=308MiB/s (323MB/s)
  • IOPS: 78,800 (4KB writes/sec)
  • Bandwidth: 308 MB/s

macOS Random Read (dd)

  • 4KB Random Read: ~4272 MB/s (推测)
  • IOPS: ~1,068,000 (推测)

注意: macOS测试使用dd无法准确测量IOPS


性能分析

iSCSI为何如此快

可能的解释:

  1. 容器内文件系统

    • iSCSI LUN在容器内是本地文件
    • 无virtiofs开销对比volume mount
    • Linux kernel优化
  2. tgt优化

    • tgt使用rdwr模式direct read/write
    • 无SCSI协议开销容器内直接访问
  3. 内存缓存

    • Linux kernel page cache
    • 容器内存限制少
  4. 测试artifact ⚠️

    • 256MB文件可能完全缓存
    • 需要更大文件验证(>内存大小)

Colima Volume Mount为何较慢

virtiofs开销

  1. 跨VM通信

    • macOS host → Lima VM → Container
    • 每次读写需要virtio传输
  2. 文件系统转换

    • APFS (macOS) → virtiofs → ext4 (Linux)
    • 额外的文件系统层
  3. 性能瓶颈

    • virtiofs理论上限~3-5 GB/s
    • 实测2.4 GB/s write, 4.5 GB/s read

macOS NVMe为何慢于iSCSI

可能的解释:

  1. 测试artifact ⚠️

    • macOS dd测试可能受APFS影响
    • APFS快照、压缩等功能开销
  2. iSCSI优势

    • Linux容器内无APFS开销
    • ext4简单高效
  3. 需要验证 ⚠️

    • macOS fio测试更准确
    • 需安装fio验证

实际意义分析

这意味什么?

重要警告: ⚠️⚠️⚠️

这个测试结果不可直接用于生产环境

理由:

  1. 文件大小太小 (256MB)

    • 完全可以缓存到内存
    • 无法代表大文件性能(>16GB
  2. iSCSI不是真正的远程访问

    • 测试在容器内直接访问LUN文件
    • 无TCP/IP开销本地文件
  3. 真实iSCSI场景

    • 远程连接:网络开销
    • SCSI协议解析CPU开销
    • 多客户端并发:锁竞争

正确的iSCSI测试方法

应该这样测试:

  1. 真正的iSCSI initiator连接

    • 从外部连接到target
    • 测试TCP/IP + SCSI协议开销
  2. 大文件测试 (>16GB)

    • 超出内存缓存
    • 测试真实磁盘性能
  3. 并发测试

    • 多客户端同时访问
    • 测试锁竞争和性能下降

正确的对比结论

容器内文件访问性能

合理的结论:

场景 性能 说明
容器内本地文件 最快 无virtiofs开销Linux kernel优化
Volume Mount 中等 virtiofs开销跨VM通信
macOS本地 很快 NVMe硬件优势但有APFS开销

真实iSCSI性能预期

远程iSCSI性能

  • 网络开销: TCP/IP latency (~0.5-2ms)
  • SCSI协议: CPU parsing overhead
  • 并发限制: 锁竞争

预期性能:

  • Sequential: 100-500 MB/s (取决于网络)
  • Random IOPS: 5k-50k (取决于target硬件)
  • Latency: 0.5-5ms (远程)

结论: 远程iSCSI性能远低于本地测试


测试建议

如何正确测试iSCSI

步骤1外部连接

# macOS需要第三方iSCSI initiator
# 例如: globalSAN iSCSI Initiator

# Linux (在另一个容器或VM):
iscsiadm -m discovery -t st -p <target_ip>:3260
iscsiadm -m node -T iqn.2026-05.momentry:libiscsi-test -p <target_ip>:3260 --login

# 测试
dd if=/dev/sda of=/dev/null bs=1M count=1024
fio --filename=/dev/sda --name=randread --bs=4k --size=1G --rw=randread

步骤2大文件测试

# 测试文件大小 > 16GB (超出内存)
dd if=/dev/zero of=/dev/sda bs=1M count=16384

步骤3并发测试

# 多个客户端同时连接
# 测试target并发性能

最终结论

测试结果总结

容器内测试(本地文件访问):

  • iSCSI LUN (容器内文件): 4700 MB/s write, 19200 MB/s read
  • Colima Volume Mount: 2400 MB/s write, 4500 MB/s read
  • macOS NVMe: 3410 MB/s write, 17791 MB/s read

但这个测试不代表真实iSCSI性能


生产环境建议

iSCSI使用场景

  1. 远程存储访问

    • 网络attached storage
    • 预期100-500 MB/s
  2. 集中化存储管理

    • 多客户端共享存储
    • 简化管理
  3. 备份和迁移

    • iSCSI LUN可迁移
    • 数据一致性

性能预期修正:

  • 本次测试19.2 GB/s (容器内本地文件)
  • 真实iSCSI100-500 MB/s (远程网络访问)

###下一步测试

需要验证:

  1. iSCSI从外部连接测试真实网络开销
  2. 大文件测试(>16GB超出内存
  3. macOS安装fio准确测试随机I/O
  4. 多客户端并发测试

测试完成: 2026-05-30 14:45 版本: v1.0