Azure container instance (ACI) was very slow when creating tremendous small files on an azure file share disk mount point

Jun Ge 20 Reputation points
2024-11-04T02:34:31.4833333+00:00

Hi,

I created a linux azure container instance (aci), and mounted an azure file share disk to it in ARM when creating the ACI, the mount point was at "/mytest". The file share disk wasn't SSD, it's HDD, and it's "transaction-optimized" type.And then I have the following code to create tremendous small files in ACI.##### start

try:

os.makedirs(staging_path, exist_ok=True)

start_time1 = time.time()

for i in range(10000):

file_path = os.path.join(staging_path, f"file_{i}.txt")

with open(file_path, "w") as f:

f.write("abcdefghij") # 10 bytes of content

end_time1 = time.time()

total_time1 = end_time1 - start_time1

logger.log(ST_LOG, f"Total time to create 10,000 files: {total_time1:.2f} seconds")

except Exception as e:

logger.log(ST_ERROR, f"test: {e}")

##### end

It's very slow as the following for the file share disk mount point:

10/29 03:11:38 MSG "Total time to create 10,000 files: 602.12 seconds" - task_handler.py->process_unzip_request():117

But the interesting thing is, if I removed the mount point, and ran the above code in the disk allocated to ACI by default, which is 46 gb. The performance is very well as the following.

26 140221229517696 10/29 02:13:26 MSG "Total time to create 10,000 files: 0.75 seconds" - task_handler.py->process_unzip_request():117

Then my question: Why did the mounted file share disk so slow for above code? How to increase the default 46 gb allocated disk for ACI? Thanks.

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,301 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,218 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.