performance - Azure 应用服务 - 更高的应用服务计划性能更差
问题描述
我们在 Azure 中有两个具有这种配置的环境(都位于西欧):
测试:
- 应用服务(基本计划 1)
- SQL 数据库(在标准 S0 上)
- CDN(在标准 Verizon 上)
阶段:
- 应用服务(计划标准 1)
- SQL 数据库(在标准 S3 上)
- CDN(在标准 Verizon 上)
我们部署了相同的基于 Umbraco + uCommerce 的 Web 应用程序代码,但在 Stage 环境中的性能比在测试环境中要差得多。性能最差的是使用 uCommerce API 的页面。Umbraco 和 uCommerce 中的内容是相同的。后端处理时间在测试上小于 1 秒,在舞台上约为 20 秒。我们找不到这些环境之间的配置差异。我可能有什么问题?我们如何才能找到导致问题的原因?
编辑:
即使 AzureCDNToolkit:CdnUrl 值有效,Umbraco 日志也会显示大量此类错误:
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)
编辑
一段时间后我发现了一个问题:Azure 使用 TLS 1.2 作为 Azure 服务的默认配置,因此为了使其正常工作,我所要做的就是在应用程序启动时添加这一行:
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
解决方案
推荐阅读
- python - tkinter Scrollbar 折叠它所在的 Canvas
- c - 错误说“返回结构类型时不兼容的类型......”
- google-bigquery - 如何在 BigQuery 中将 CONCAT 语句与 CASE 语句一起使用?
- c# - 努力为我的 C# CONSOLE 打字游戏实现计时器
- javascript - 如何测试整数减法不是可交换的?
- javascript - 在 MongoDB 中使用 async/await 时,在应用游标方法之前获取文档总数?
- python - 如何使用 BeautifulSoup 从特定字符串解析表?
- python - SOAP 响应只给了我 1% 的文件内容
- r - 大数据集循环打印不正确的结果
- java - 如何不使用 Tomcat 在多个请求中保留静态变量?