ソフトウェアRAIDを使用したSambaによる低速転送

ソフトウェアRAIDを使用したSambaによる低速転送

私は次のように構成されたミニPC(Intel Celeron J4005、4GB RAM、Intel Gigabit LAN)を持っています。

  • Ubuntu(5.4.0-81 - 一般、sdaにインストール)
  • サンバ(バージョン4.11.6 - Ubuntu)
  • FTP(vsftpd、暗号化なし)
  • RAID5(mdadm、md0:sdb-sdc-sdd、USB-SATA)

RAIDアレイはSambaとFTPを介して共有されますが、FTPを削除し、すべての主要なクライアントはWindowsシステムです。問題は、Samba共有を介して取得する速度がFTPよりはるかに遅いということです。

装備 方法 読み取り速度(Mbyte/s、大容量ファイル1個)
MD0 地元の ~220
MD0 LAN、FTP ~115(ネットワーク制限)
MD0 ラン、サンバ ~48
MD0 LAN、Samba、2回目の実行(メモリにキャッシュされている) ~115(ネットワーク制限)
sda ラン、サンバ ~115(ネットワーク制限)

デフォルトのSamba設定と現在の設定(以下を参照)を試してみましたが、同じ結果が得られました。テストの間にキャッシュを更新しました。

iostat出力の例(LAN、Samba、最初の実行):

Device            r/s     rkB/s   rrqm/s  %rrqm r_await rareq-sz     w/s     wkB/s   wrqm/s  %wrqm w_await wareq-sz     d/s     dkB/s   drqm/s  %drqm d_await dareq-sz  aqu-sz  %util
md0            793.00 433408.00     0.00   0.00    0.00   546.54    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00   0.00
sda              0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00   0.00
sdb            254.00  16768.00     8.00   3.05   14.74    66.02    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    3.27  84.80
sdc            171.00  16896.00    93.00  35.23    2.99    98.81    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.32  60.80
sdd            161.00  16640.00   101.00  38.55   11.74   103.35    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    1.57  96.00

iostat出力の例(LAN、FTP、最初の実行):

Device            r/s     rkB/s   rrqm/s  %rrqm r_await rareq-sz     w/s     wkB/s   wrqm/s  %wrqm w_await wareq-sz     d/s     dkB/s   drqm/s  %drqm d_await dareq-sz  aqu-sz  %util
md0           1828.00 292480.00     0.00   0.00    0.00   160.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00   0.00
sda              0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00   0.00
sdb            458.00  39040.00   153.00  25.04    1.66    85.24    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.18  75.60
sdc            457.00  38976.00   152.00  24.96    1.45    85.29    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.09  70.40
sdd            457.00  38976.00   152.00  24.96    1.59    85.29    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.15  75.20

何が問題なのかわかりません。誰かが私を助けることができますか?それとも、少なくともどこで調査を始めるべきですか?


サンバ構成:

[global]
   workgroup = WORKGROUP
   min protocol = SMB3
   
   log level = 1
   socket options = TCP_NODELAY SO_RCVBUF=65536 SO_SNDBUF=65536 IPTOS_LOWDELAY SO_KEEPALIVE
   use sendfile = true
   aio read size = 65536
   aio write size = 65536
   read raw = yes
   write raw = yes
   getwd cache = yes
   acl allow execute always = true
   
   log file = /var/log/samba/log.%m
   max log size = 1000
   logging = file
   server role = standalone server
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user

[Share]
  path = /media/hdd
  writable = yes
  valid users = myuser
  directory mode = 0770
  create mode = 0660

RAIDアレイ構成:

/dev/md0:
           Version : 1.2
     Creation Time : Tue Sep  7 13:19:26 2021
        Raid Level : raid5
        Array Size : 976441344 (931.21 GiB 999.88 GB)
     Used Dev Size : 488220672 (465.60 GiB 499.94 GB)
      Raid Devices : 3
     Total Devices : 3
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Tue Sep 9 14:37:52 2021
             State : clean
    Active Devices : 3
   Working Devices : 3
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 64K

Consistency Policy : bitmap

ファイルシステム情報:

root@MiniPC:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.8G     0  1.8G   0% /dev
tmpfs           371M   12M  360M   3% /run
/dev/sda2        58G  3.4G   55G   6% /
tmpfs           1.9G   12K  1.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           500M   79M  422M  16% /var/cache/apt
tmpfs           500M     0  500M   0% /tmp
tmpfs           500M     0  500M   0% /var/backups
tmpfs           500M  2.2M  498M   1% /var/log
tmpfs           500M     0  500M   0% /var/tmp
/dev/sda1       511M  5.3M  506M   2% /boot/efi
/dev/md0        917G  356G  562G  39% /media/hdd

root@MiniPC:~# lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda       8:0    0  59.6G  0 disk
├─sda1    8:1    0   512M  0 part  /boot/efi
└─sda2    8:2    0  59.1G  0 part  /
sdb       8:16   0 465.7G  0 disk
└─sdb1    8:17   0 465.7G  0 part
  └─md0   9:0    0 931.2G  0 raid5 /media/hdd
sdc       8:32   0 465.8G  0 disk
└─sdc1    8:33   0 465.8G  0 part
  └─md0   9:0    0 931.2G  0 raid5 /media/hdd
sdd       8:48   0 465.8G  0 disk
└─sdd1    8:49   0 465.8G  0 part
  └─md0   9:0    0 931.2G  0 raid5 /media/hdd

ベストアンサー1

https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html

aio読み取りサイズ(S)

If this integer parameter is set to a non-zero value, Samba will read from files
asynchronously when the request size is bigger than this value.
Note that it happens only for non-chained and non-chaining reads and when
not using write cache.

The only reasonable values for this parameter are 0 (no async I/O) and 1 (always do async I/O).

same is said for aio write side

smb.confからこれらの両方を削除することをお勧めします。私はsmb.confでこれらのいずれかを使用したことがありません。

win10コンピュータを使用する1gbpsの有線ネットワークを介して、1日中112MB/秒の読み取り/書き込み速度を取得します。ここで私のsmb.confグローバルセクションを見てください。

[global]
    workgroup = SAMBA
    security = user

    passdb backend = tdbsam

    printing = bsd
    printcap name = /dev/null
    load printers = no
    disable spoolss = yes
  # cups options = raw

    smb encrypt = required
    client min protocol = SMB3
    client max protocol = SMB3

RHEL 7で調整された設定ファイルは参照用です。

> tuned-adm list
    Available profiles:
    - atomic-guest                - Optimize virtual guests based on the Atomic variant
    - atomic-host                 - Optimize bare metal systems running the Atomic variant
    - balanced                    - General non-specialized tuned profile
    - cpu-partitioning            - Optimize for CPU partitioning
    - default                     - Legacy default tuned profile
    - desktop                     - Optimize for the desktop use-case
    - desktop-powersave           - Optmize for the desktop use-case with power saving
    - enterprise-storage          - Legacy profile for RHEL6, for RHEL7, please use throughput-performance profile
    - hpc-compute                 - Optimize for HPC compute workloads
    - laptop-ac-powersave         - Optimize for laptop with power savings
    - laptop-battery-powersave    - Optimize laptop profile with more aggressive power saving
    - latency-performance         - Optimize for deterministic performance at the cost of increased power consumption
    - mssql                       - Optimize for MS SQL Server
    - network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
    - network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks
    - oracle                      - Optimize for Oracle RDBMS
    - powersave                   - Optimize for low power consumption
    - server-powersave            - Optimize for server power savings
    - spindown-disk               - Optimize for power saving by spinning-down rotational disks
    - throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads
    - virtual-guest               - Optimize for running inside a virtual guest
    - virtual-host                - Optimize for running KVM guests
Current active profile: latency-performance

おすすめ記事