大网数据广告活动
服务器运维问答

Poor performance when mounting Azure File Share on Linux VM

· 52CE 我爱测

I have experimented with Azure File Service as a form of network file system that can be mounted by several VMs simultaneously -- something that regular Azure virtual hard disks are not capable of. An Azure VHD can only be attach…

问题原文

原帖链接 · hal · CC BY-SA 3.0

I have experimented with Azure File Service as a form of network file system that can be mounted by several VMs simultaneously -- something that regular Azure virtual hard disks are not capable of. An Azure VHD can only be attached to a single VM at a time.

However, when mounting an Azure File share via the SMB protocol, I observe some really poor write performance.

The set up is as follows, I've started a Canonical:UbuntuServer:16.04-LTS:latest VM on a Standard_DS2 VM.

When the boot process completes I follow the official instructions to mount the Azure File Share via SMB.

sudo apt-get install cifs-utils
sudo mkdir -p /mnt/azure
sudo mount -t cifs //<storageaccount>.file.core.windows.net/<file-share-name> /mnt/azure/ -o vers=3.0,username=<storageaccount>,password=<base64-encoded>,dir_mode=0777,file_mode=0777,serverino

Then I run this simple write performance test:

time for i in $(seq 1 500); do echo "hello!" > /mnt/azure/hello.txt; done

real    0m20.673s
user    0m0.032s
sys     0m0.124s

As can be seen, it takes over 20 seconds to complete. As a comparison, running the same test on my local machine (with SSD drive), I see the following numbers:

time for i in $(seq 1 500); do echo "hello!" > hello.txt; done

real    0m0.031s
user    0m0.004s
sys     0m0.024s

That is is completes in about 30 milli seconds. So there is almost a performance penalty factor of 1000 when running against the Azure File Share.

Are such performance numbers to be expected or am I missing something?

已采纳解答

原帖链接 · Bruno Faria · CC BY-SA 3.0

Yes.

Bear in mind that although the local disk and Azure Files are fundamentally network storages, the later uses an I/O API instead of direct hardware access. The latency will be a lot higher. Said that let's try a simple math:

You are making 500 requests and each time it opens and closes a connection:

500 requests / 20.673.sec = 24.18 Req/sec

24.18 / 1000 = 0,02418s to complete each request, which is great.

If you need performance against small and/or a large number of files, then Azure File Storage is not for your use case. In theory, it can achieve 1000 IOPS and 60MB/sec.

Additionally, let's face it, SMB/CIFS is very slow dealing with small files.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。