🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# Filesystem Performance Benchmarking > 原文:[https://docs.gitlab.com/ee/administration/operations/filesystem_benchmarking.html](https://docs.gitlab.com/ee/administration/operations/filesystem_benchmarking.html) * [Executing benchmarks](#executing-benchmarks) * [Benchmarking with `fio`](#benchmarking-with-fio) * [Simple benchmarking](#simple-benchmarking) # Filesystem Performance Benchmarking[](#filesystem-performance-benchmarking "Permalink") Filesystem performance has a big impact on overall GitLab performance, especially for actions that read or write to Git repositories. This information will help benchmark filesystem performance against known good and bad real-world systems. 通常,在谈论文件系统性能时,最大的顾虑是网络文件系统(NFS). 但是,即使某些本地磁盘也可能具有缓慢的 I / O. 此页面上的信息可用于两种情况. ## Executing benchmarks[](#executing-benchmarks "Permalink") ### Benchmarking with `fio`[](#benchmarking-with-fio "Permalink") 我们建议使用[Fio](https://fio.readthedocs.io/en/latest/fio_doc.html)测试 I / O 性能. 该测试应该在 NFS 服务器和与 NFS 服务器通信的应用程序节点上都运行. 安装: * 在 Ubuntu 上: `apt install fio` . * 在`yum`管理的环境中: `yum install fio` . 然后运行以下命令: ``` fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=/path/to/git-data/testfile --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75 ``` 这将在`/path/to/git-data/testfile`创建一个 4GB 的文件. 它使用文件中的 75%/ 25%的拆分来执行 4KB 读取和写入,一次运行 64 个操作. 测试完成后,请确保删除文件. 输出将根据所安装的`fio`版本而有所不同. 以下是网络固态驱动器(SSD)上`fio` v2.2.10 的输出示例: ``` test: (g=0): rw=randrw, bs=4K-4K/4K-4K/4K-4K, ioengine=libaio, iodepth=64 fio-2.2.10 Starting 1 process test: Laying out IO file(s) (1 file(s) / 1024MB) Jobs: 1 (f=1): [m(1)] [100.0% done] [131.4MB/44868KB/0KB /s] [33.7K/11.3K/0 iops] [eta 00m:00s] test: (groupid=0, jobs=1): err= 0: pid=10287: Sat Feb 2 17:40:10 2019 read : io=784996KB, bw=133662KB/s, iops=33415, runt= 5873msec write: io=263580KB, bw=44880KB/s, iops=11219, runt= 5873msec cpu : usr=6.56%, sys=23.11%, ctx=266267, majf=0, minf=8 IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0% issued : total=r=196249/w=65895/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency : target=0, window=0, percentile=100.00%, depth=64 Run status group 0 (all jobs): READ: io=784996KB, aggrb=133661KB/s, minb=133661KB/s, maxb=133661KB/s, mint=5873msec, maxt=5873msec WRITE: io=263580KB, aggrb=44879KB/s, minb=44879KB/s, maxb=44879KB/s, mint=5873msec, maxt=5873msec ``` 注意此输出中的`iops`值. 在此示例中,SSD 每秒执行 33,415 次读操作和每秒 11,219 次写操作. 旋转磁盘可能每秒产生 2,000 和 700 的读取和写入操作. ### Simple benchmarking[](#simple-benchmarking "Permalink") **注意:**此测试是幼稚的,但如果系统上没有`fio`可能有用. 在此测试中可能会收到不错的结果,但由于读取速度和其他各种因素,性能仍然很差. 以下单行命令为文件系统的读写性能提供了快速基准. 这会将 1,000 个小文件写入执行该文件的目录,然后读取相同的 1,000 个文件. 1. 更改为适当的[存储库存储路径](../repository_storage_paths.html)的根目录. 2. 为测试创建一个临时目录,以便以后轻松删除文件: ``` mkdir test; cd test ``` 3. 运行命令: ``` time for i in {0..1000}; do echo 'test' > "test${i}.txt"; done ``` 4. 要测试读取性能,请运行以下命令: ``` time for i in {0..1000}; do cat "test${i}.txt" > /dev/null; done ``` 5. 删除测试文件: ``` cd ../; rm -rf test ``` `time for ...`命令的`time for ...`输出将类似于以下内容. 重要指标是`real` . ``` $ time for i in {0..1000}; do echo 'test' > "test${i}.txt"; done real 0m0.116s user 0m0.025s sys 0m0.091s $ time for i in {0..1000}; do cat "test${i}.txt" > /dev/null; done real 0m3.118s user 0m1.267s sys 0m1.663s ``` 根据与多个客户的经验,此任务应花费 10 秒以表明文件系统性能良好.