优化和调整Linux服务器(媒体服务器)

优化和调整Linux服务器(媒体服务器)

我重建了一个服务器,特别是媒体服务器,基于Debian 12稳定(内核6.1)。

  • 中央处理器:i7-6700K(不超频)
  • 内存:16GB DDR4(双通道)
  • 网卡:2 个 2.5Gbit(绑定平衡-tlb) (最大传输单元bond0:4096。但我的网络家庭有经典的MTU)
  • 图形处理器:PHY T400(4GB 版本)
  • 贮存: 3固态硬盘

这些 SSD 的配置如下:

  1. 固态硬盘1:每部电影 1TB(xfs)(调度程序:没有任何
  2. 固态硬盘2:250GB 用于操作系统(125GB操作系统,125GB 用于交换)(外部4)(调度程序:没有任何
Disk /dev/sdb: 232,89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 860 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcfa6d02d

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1  *         2048 244140031 244137984 116,4G 83 Linux
/dev/sdb2       244140032 488280063 244140032 116,4G 82 Linux swap / Solaris

dumpe2fs 1.47.0 (5-Feb-2023)
Filesystem volume name:   root
Last mounted on:          /
Filesystem UUID:          927a3648-60d1-4537-af56-0d87ff5a6e0b
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index fast_commit filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              7634944
Block count:              30517248
Reserved block count:     305172
Overhead clusters:        625720
Free blocks:              28139695
Free inodes:              7541676
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Tue Oct 17 02:41:54 2023
Last mount time:          Thu Oct 19 19:21:21 2023
Last write time:          Thu Oct 19 19:21:21 2023
Mount count:              25
Maximum mount count:      -1
Last checked:             Wed Oct 18 03:33:16 2023
Check interval:           0 (<none>)
Lifetime writes:          90 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      5f52b9e5-cf5a-438c-9e90-0c2d91207ea7
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0x2f208f9b
Journal features:         journal_incompat_revoke journal_64bit journal_checksum_v3 FEATURE_I5
Total journal size:       512M
Total journal blocks:     131072
Max transaction length:   130816
Fast commit length:       256
Journal sequence:         0x0000796d
Journal start:            1
Journal checksum type:    crc32c
Journal checksum:         0x0a6d11a2

  1. 固态硬盘3:500GB 用于“常规”缓存(转码、通过 fscache 进行网络挂载点缓存等)。 (外部4)(调度程序:没有任何
Disk /dev/sdc: 465,76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: CT500MX500SSD1  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

dumpe2fs 1.47.0 (5-Feb-2023)
Filesystem volume name:   <none>
Last mounted on:          /cache
Filesystem UUID:          070d06bd-6a01-4457-b20f-cf699f412168
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index fast_commit filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              30531584
Block count:              122096646
Reserved block count:     0
Overhead clusters:        2201430
Free blocks:              119895208
Free inodes:              30531569
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Wed Oct 18 19:01:18 2023
Last mount time:          Thu Oct 19 19:21:22 2023
Last write time:          Thu Oct 19 19:21:22 2023
Mount count:              16
Maximum mount count:      -1
Last checked:             Wed Oct 18 19:01:18 2023
Check interval:           0 (<none>)
Lifetime writes:          48 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      cbad2af6-a244-4e66-b27c-3e8dea9f8f2f
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0x47fb58ba
Journal features:         journal_incompat_revoke journal_64bit journal_checksum_v3 FEATURE_I5
Total journal size:       1040M
Total journal blocks:     266240
Max transaction length:   262144
Fast commit length:       4096
Journal sequence:         0x00000384
Journal start:            0
Journal checksum type:    crc32c
Journal checksum:         0xae89c35f

使用的软件:(和硬件转码/编码)和服务(DLNA 软件)

我选择 xfs 作为电影的文件系统,因为将托管大文件(众所周知,xfs 在这种类型的文件上执行),对于所有其他 SSD,我选择 ext4,也用于缓存。我的选择正确吗?小前提:不要查看与备份计划、有关文件系统的数据安全等相关的服务器/存储,因为该服务器仅充当“通道”...让我更好地解释...也就是说,它必须在转码、文件访问速度(通过 cifs/fscache)以及与文件共享介质相关的所有内容方面尽最大努力,因此即使某些内容被损坏,我也不会丢失任何东西......我不知道我是否'我明白了。因此,我寻找优化/设置来尽可能加快速度,包括吞吐量。我发布了一些配置。根据更专家的意见,我应该更改/添加一些内容吗?抛开这些配置不谈,我是否也应该更改操作系统中的某些内容?我只运行了 rsyslogd,省略了我主要使用的上述软件。

幼虫

GRUB_CMDLINE_LINUX_DEFAULT="quiet mitigations=off nopti net.ifnames=0 biosdevname=0 intel_idle.max_cstate=1 i915.enable_psr=0 i915.enable_dc=0 zswap.enabled=1 zswap.compressor=lzo nowatchdog nosgx"

系统配置文件

kernel.sysrq=0
vm.swappiness=1
vm.vfs_cache_pressure=60

fs.suid_dumpable=0
kernel.core_pattern=|/bin/false

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

net.ipv4.tcp_keepalive_time = 60 
net.ipv4.tcp_keepalive_intvl = 10 
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_fastopen=3
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_fin_timeout=5
net.ipv4.tcp_sack=1
net.core.default_qdisc=cake
net.ipv4.tcp_congestion_control=bbr

相关内容