Best practice to optimize CreateFile() function performance in Azure

This article introduces a best practice to optimize performance when you call the CreateFile() function for a file on Microsoft Azure Server.

Original product version:   Files Storage
Original KB number:   4021343

When you call the CreateFile() function to create or open a file on Azure Server, you should use both Read and Write access permissions. That is, specify GENERIC_READ | GENERIC_WRITE instead of only GENERIC_WRITE for the dwDesiredAccess parameter.

This is because a Write-Only handle cannot cache small writes locally, even if it is the only opened handle for the file. Using a Write-Only handle imposes a severe performance penalty.

Note

Calling the fopen() function in "a" mode also opens a W rite-Only handle.

More information

Contact us for help

If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.