We have two environments in Azure with such configuration (both placed in West Europe):
Test:
- App Service (on plan Basic 1)
- SQL db (on Standard S0)
- CDN (on Standard Verizon)
Stage:
- App Service (on plan Standard 1)
- SQL db (on Standard S3)
- CDN (on Standard Verizon)
We deployed the same web app code that is based on Umbraco + uCommerce, but performance on Stage environment is way worse then on test one. The worst performance is on pages that uses uCommerce API. Content in Umbraco and uCommerce is the same. Backend processing time is <1s on Test and ~20s on Stage. We can't find any differences in configurations between these environments. What might me the issue? How can we find what is causing the problem?
edit:
Umbraco log shows bunch of such errors, even if the AzureCDNToolkit:CdnUrl value is valid:
2018-07-30 13:07:20,429 [P9292/D2/T31] ERROR Our.Umbraco.AzureCDNToolkit.UrlHelperRenderExtensions - Error resolving media url from the CDN
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly
closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Our.Umbraco.AzureCDNToolkit.UrlHelperRenderExtensions.<>c__DisplayClass6_1.b__0()
at Our.Umbraco.AzureCDNToolkit.UrlHelperRenderExtensions.TryFiveTimes(Action delegateAction)
at Our.Umbraco.AzureCDNToolkit.UrlHelperRenderExtensions.UrlToCdnUrl(String cropUrl, Boolean htmlEncode, String currentDomain)
Edit
After some time I found a problem: Azure uses TLS 1.2 as a default configuration for Azure Service so to make it work all I had to do was to add this line on application startup:
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;