Question
Are there any ways to improve metadata operation performance between a Linux based container running under Azure App Service and a mounted volume hosted in Azure Files?
Context
I recently migrated a solution which had everything on one server to an Azure based solution where:
- The code runs on a container hosted under Azure App Service.
- Those files which are part of the business data are on Azure Files (i.e. a share under an Azure Storage Account) / mounted on the container (via the app service's
Settings
> Configuration
> Path Mappings
section).
This has introduced some performance issues with operations which search through a folder to see if certain files exist. That's currently done via PHP's file-exists function.
When testing on my local device, I can improve performance by appending :cached
to the bind parameter; e.g. --mount type=bind,source=d:\my\host\path,target=/var/my/container/path:cached
; but I can't find an option to do anything similar in Azure App Service.
My container's running Linux (Ubuntu:21:10
); and I've read that SMB metadata operations (including checking if a file exists) have a higher overhead in Linux than Windows; so perhaps that's related (i.e. as Azure Files uses SMB); though I'm not certain (as the path is mounted to the container, so the container OS may not be aware of the underlying implementation).
I've enabled large file shares
to increase the IOPs available to the file share; but it's made no difference (which given this is a metadata rather than IO performance issue, makes sense).
At present I'm thinking the solution would be to update the code to keep a representation of the file structure in the app's database so we can query that to get the same information faster; but this has the downside that every operation to upload or deleted a file needs to also update the database to keep disk and db info in sync / duplicates where information's held; so I'm keen to solve this infrastructure issue rather than recode if possible.