項目中目前使用的FastDFS作文件存儲,可是最近項目併發量有點高,常常出現文件下載和上傳時間較長的狀況,這是須要排查是由於網絡延遲、請求阻塞或者FastDFS的問題。shell
如何排查是不是FastDFS問題而不是網絡延遲致使的,咱們最好能夠在部署FastDFS的服務器上手動執行上傳和下載,由於FastDFS目前沒有在維護致使這方面的資料比較少,因此記錄下來方便有須要的朋友使用。服務器
fdfs_test /etc/fdfs/client.conf.sample upload ~/2.png網絡
執行結果:併發
This is FastDFS client test program v5.09 Copyright (C) 2008, Happy Fish / YuQing FastDFS may be copied only under the terms of the GNU General Public License V3, which may be found in the FastDFS source kit. Please visit the FastDFS Home Page http://www.csource.org/ for more detail. [2018-07-03 11:37:02] DEBUG - base_path=/data/fdfs/fastdfs_tracker, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0 tracker_query_storage_store_list_without_group: server 1. group_name=, ip_addr=10.0.20.13, port=23000 server 2. group_name=, ip_addr=10.0.20.14, port=23000 server 3. group_name=, ip_addr=10.0.20.15, port=23000 group_name=group1, ip_addr=10.0.20.15, port=23000 storage_upload_by_filename group_name=group1, remote_filename=M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.png source ip address: 10.0.20.15 file timestamp=2018-07-03 11:37:02 file size=204254 file crc32=930688791 example file url: http://10.0.20.15/group1/M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.png storage_upload_slave_by_filename group_name=group1, remote_filename=M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105_big.png source ip address: 10.0.20.15 file timestamp=2018-07-03 11:37:02 file size=204254 file crc32=930688791 example file url: http://10.0.20.15/group1/M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105_big.png
其中有兩個須要注意的group_name和remote_filename,這個在咱們後面的文件下載須要用到app
group_name=group1, remote_filename=M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.pngurl
fdfs_test /etc/fdfs/client.conf.sample download group1 M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.pngcode
downlad後面的兩個參數就是上面上傳返回的group_name和remote_filenameserver
結果:token
This is FastDFS client test program v5.09 Copyright (C) 2008, Happy Fish / YuQing FastDFS may be copied only under the terms of the GNU General Public License V3, which may be found in the FastDFS source kit. Please visit the FastDFS Home Page http://www.csource.org/ for more detail. [2018-07-03 11:44:01] DEBUG - base_path=/data/fdfs/fastdfs_tracker, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0 storage=10.0.20.13:23000 download file success, file size=204254, file save to CgAUD1s6716ATKtBAAMd3jd5Lxc105.png root@VM010000020015 fdfs]# ls CgAUD1s6716ATKtBAAMd3jd5Lxc105.png client.conf.sample storage.conf storage_ids.conf.sample tracker.conf