There is an Azure-specific problem: the platform can start very slow on Azure App Service. This problem is seemingly unstable: sometimes the platform starts normally and sometimes even not at all.
In case if not started the user will see at the platform admin page errors like: “Service Unavailable”, “500.37 ANCM Failed to Start Within Startup Time Limit”.
The causes of such behavior are:
- The platform does a lot of work every start: check modules versions, files in probing path, copy modules files to probing path if they absent or have inappropriate versions, and so on.
- But the Azure storage is really very slow when it works with multiple access to many relatively small files.
We’ve done small research to ensure the storage slowness.
To illustrate the problem we wrote a very simple example that creates copies of some relatively small file (~150KB) 1000 times and prints the time taken. This application was run on different plans several times to eliminate performance fluctuations.
For different service plans the times taken (in seconds) are:
|Run No||B1||S3||P1v2||Local (SSD)|
Times in the last column was measured on a local machine and given for comparison.
As you can see, more powerful plans accelerate IO operations, but the speed much slower than just on a local machine with SSD storage.
What is the solution?
- From v3.27.0 there is an option VirtoCommerce:RefreshProbingFolderOnStart to avoid checking the probing path at the platform startup. This can decrease startup time at least by a third. If the option set to false and the probing path exists, the platform will start with the current probing path content on an “AS IS” basis. It is assumed that the probing path contains consistent module files. If the probing path is absent, then the platform will start as usual, with module discovering/copying, with no look at the option value.
- Of course, you can also just increase startup timeout in web.config by setting startupTimeLimit to a bigger value.
- Strong recommendation to use premium plans with dedicated SSD.