為什么要在seafile搞webdav
Seafile 一直是一款可靠的文件同步web應用,經過個人測試,同一臺機器上,seafile在傳輸文件時的速度比nextcloud要快(可能也與php的設置有關系),這是seafile的優勢。但是,seafile在做架構時,將傳進來的文件進行了分塊處理,并將信息寫入數據庫,所以在硬盤上,你無法直接訪問自己上傳的文件,這可有點不方便。要解決該問題,其中一個方法是開啟seafile的webdav,然后在系統中掛載該webdav,于是就可以像訪問自己硬盤一樣訪問seafile中的文件。
西蒙宮已經部署了一臺CPU是J3455的NAS并進行了相關折騰具體可看:
西蒙宮:折騰,使用NAS的openmediavault系統配置seafile pro版?zhuanlan.zhihu.com

seafile開啟webdav的方法
這方法在官網相關鏈接已經給了很多解釋,這里僅是簡單記錄一下。
編輯/data/haiwen/conf/seafdav.conf
添加如下內容
[WEBDAV]# Default is false. Change it to true to enable SeafDAV server.
enabled = trueport = 8080# Change the value of fastcgi to true if fastcgi is to be used
fastcgi = false# If you deploy seafdav behind nginx/apache, you need to modify "share_name".
share_name = /
然后重啟seafile服務
./seafile.sh restart
linux系統掛載webdav的方法
比較直接的方法是使用mount命令,新建一個名為seafdav的文件夾
mount -t davfs http://127.0.0.1:8080/ /mnt/seafdav
掛載webdav后的讀寫性能測試
掛載webdav目錄的寫性能
root@localhost:/mnt/seafdav# dd if=/dev/zero bs=1024 count=1000000 of=1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB, 977 MiB) copied, 35.0303 s, 29.2 MB/s
掛載webdav目錄的讀性能
root@localhost:/mnt/seafdav# dd of=1Gb.file if=/dev/zero bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB, 977 MiB) copied, 35.0889 s, 29.2 MB/s
普通硬盤的寫性能
root@localhost:/mnt/raid# dd if=/dev/zero bs=1024 count=1000000 of=1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB, 977 MiB) copied, 6.21764 s, 165 MB/s
普通硬盤的讀性能
root@localhost:/mnt/raid# dd of=1Gb.file if=/dev/zero bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB, 977 MiB) copied, 13.546 s, 75.6 MB/s
結論
由以上數據可以看到,seafile所部署的webdav的讀寫性能確實差了一些,畢竟多了一些抽象,并且依賴cpu的處理速度,該NAS配置是J3455的CPU+8G內存,主打省電,但性能并不強。普通硬盤直接讀寫的速度是webdav的三倍左右。所以把webdav掛載為硬盤之后,只能進行一些硬盤負載較輕的工作。