azurefile is slow on read/write large mount of small files
While attempting to setup AKS cluster for number of wordpress sites I've noticed that azurefile is unbearably slow when working with many files. Installing chart stable/wordpress takes up to 20 minutes due to copying wp-content with themes and few plugins into persistent volume (with default configuration kubernetes will kill the pod before install finishes). When using azuredisk everything is done in few minutes. This doesn't affect only installation, but also working with wp - for instance installing most new plugins takes several minutes.
WP is not the only one suffering: http://unethicalblogger.com/2017/12/01/aks-storage-research.html
From tests below it seems that the issue occurs when working with many files whereas when just writing one large file the speed difference is acceptable.
If this is hard technical limitation it should be noted in documentation.
time ( wget -qO- https://wordpress.org/latest.tar.gz | tar xvz -C ./wp )
| real | user | sys | |
|---|---|---|---|
| azuredisk | 0m2.112s | 0m0.489s | 0m0.507s |
| azurefile | 2m7.894s | 0m0.417s | 0m2.513s |
time ( cp -R --verbose wp wpcopy )
| real | user | sys | |
|---|---|---|---|
| azuredisk | 0m0.527s | 0m0.042s | 0m0.282s |
| azurefile | 1m23.843s | 0m0.056s | 0m2.503s |
sync; time ( dd if=/dev/zero of=testfile bs=100k count=1k && sync ); rm testfile
| real | user | sys | |
|---|---|---|---|
| azuredisk | 0m0.353s | 0m0.007s | 0m0.172s |
| azurefile | 0m1.801s | 0m0.002s | 0m1.719s |
I see my work! :clap:
Anyways, I think azurefile can generally be considered unusable. The Azure File storage in Azure (not Kubernetes' support of it) seems to using slow (HDD, not SSD) storage and is generally very slow in my usage from a Linux machine mounting a CIFS volume.
So, it's slow, I agree, but I'm not sure that's an AKS problem so much as the fundamental service is slow :cry:
If it is general problem with azure file then please put a big red warning in AKS azurefile docs. Suggesting an alternative that would allow spreading pods over multiple nodes would be also nice - unfortunately the only thing I can think of is setting up glusterfs using azuredisks which is quite a lot of work and an extra thing you must maintain 😭
Thanks for the feedback. /cc @neilpeterson for any doc guidance on Azure Files perf.
just a heads up, azure files premium doesnt fix this
current azure premium file is still slow when read/write large number of small files, azure file team are working on this. I will update this issue as soon as wordpress could run well on azure premium file
Update this thread: On k8s v1.13.x, azure premium file is supported, with 5120GiB quota premium file size, the latency is close (or even better) to local disk now
time ( wget -qO- https://wordpress.org/latest.tar.gz | tar xvz -C ./wp )
| real | user | sys | |
|---|---|---|---|
| azuredisk | 0m2.112s | 0m0.489s | 0m0.507s |
| azure premium file | 0m1.022s | 0m0.291s | 0m0.199s |
Below are the command lines about how to set up wordpress on premium file on a k8s v1.13.x cluster:
kubectl create -f https://raw.githubusercontent.com/andyzhangx/demo/master/pv/storageclass-azurefile-premium.yaml
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install --set persistence.accessMode=ReadWriteMany,persistence.storageClass=azurefile-premium,persistence.size=5120Gi --set mariadb.master.persistence.accessMode=ReadWriteMany,mariadb.master.persistence.storageClass=azurefile-premium,mariadb.master.persistence.size=5120Gi bitnami/wordpress
is this with many small files?
@4c74356b41 yes, wordpress has more than 1K small files, and both mariadb and wordpress pod could run on azure premium file now, see above example. And also azure file team are improving the perf besides this premium file feature. It's quite promising.
what about reasonable share size? 5tb for wordpress site seems a bit overkill?
also, 100gb was the smallest size back in november, which is ridiculous as well
@andyzhangx
Does anyone know if the storage account version makes any difference?
@moebius87 No, I don't think so, azure file on storage account type (Premium_LRS) is faster.
@andyzhangx K8s cluster 1.13.x is still not available for an upgrade on AKS. How did you make it work?
I tried Premium_LRS on a 1.11 K8s basically it will not work because this link states that "Azure Files currently only work with Standard storage. If you use Premium storage, the volume fails to provision." And indeed it didn't worked on mine. Failed to provision volume with StorageClass "premium-azfile": failed to create share kubernetes-dynamic-pvc-*** in account : failed to create file share, err: Put https://*.file.core.windows.net/kubernetes-dynamic-pvc-********?restype=share: dial tcp: lookup **********.file.core.windows.net on 172.x.x.x:53: no such host
@jtasipit you can use this approach: https://4c74356b41.com/post5779
@4c74356b41 I tried your suggested approach but encountered same error. The prestaged premium SA is not being used by the pvc when created for no known reason.
you probably did something wrong, it worked fine for me
Azure Premium file dynamic provision support is available from k8s v1.13.0
This problem is also with the Premium SKU. It's a little bit faster .. but not useable as pod storage. Also a 100 GB min size for a simple workload is a little bit oversized.
So AKS is not useful for small workloads due the limitation of data disks (4 or 8 for small nodes) and the slow azure files service
I've run some tests recently and for me, Premium Azure File is unusable. I've tested on 100gb and 5120gb file share and the Premium Azure File was around 20 times slower then Premium Azuredisk. when doing same benchmarks as above. My application would take Xmin and few restarts cause of health probe failure before they could start on Premium Azure File back-end storage.