php - 带有 100kb JSON blob 的非常慢的 apache 请求
问题描述
堆栈: ELB > EC2 > Apache > Laravel
问题:
- 发送带有大型 JSON blob (50-100KB) 的 PUT 请求时,响应时间从 2 秒到 25 秒不等
- 发送带有小 JSON blob(例如 100 字节)的 PUT 请求时,响应时间始终为 300 毫秒
故障排除:
- 从我的笔记本电脑(或 Web UI)发出 CURL 请求时,它似乎“挂起”,但是当它实际命中路由代码(我在那里有一个日志)时,它会在 200 毫秒内执行(请注意,较小的 JSON blob 不会有这个“挂”过)
- 如果我向 ELB 或直接向 EC2 框发出 CURL 请求,响应时间是相等的(这应该排除 ELB 的问题)
- 如果我直接从 EC2 框向自身发出 CURL 请求,它的速度非常快,没有“挂起”(100 毫秒响应)
real example from laptop to ec2:
time_namelookup: 0.000707s
time_connect: 0.095264s
time_appconnect: 0.000000s
time_pretransfer: 0.095421s
time_redirect: 0.000000s
time_starttransfer: 0.201627s
----------
time_total: 3.734784s
real example from laptop to ec2:
time_namelookup: 0.000373s
time_connect: 0.097481s
time_appconnect: 0.000000s
time_pretransfer: 0.097572s
time_redirect: 0.000000s
time_starttransfer: 0.205721s
----------
time_total: 15.709542s
real example from ec2 to itself:
time_namelookup: 0.000038s
time_connect: 0.000670s
time_appconnect: 0.000000s
time_pretransfer: 0.000722s
time_redirect: 0.000000s
time_starttransfer: 0.003291s
----------
time_total: 0.102886s
解决方案
推荐阅读
- java - org.apache.hadoop.security.AccessControlException:客户端无法通过以下方式进行身份验证:[TOKEN,KERBEROS] 问题
- vb.net - 使用 CType 转换没有时间组件的日期会产生不一致的结果
- hash - Corda:我怎样才能知道有关特定交易的所有信息?
- bash - bash 变量的远程命令后跟 if 语句,但输出读取不正确?
- flutter - 文本字段焦点触发 UI 的重建
- android - 执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障
- java - OSX Catalina 以管理员权限打破了 osascript 启动
- python - 按索引和列排序
- android - 如何通过使用带有子元素的Scrollview将底部导航保持在底部是LinearLayout作为根
- python - 这个脚本运行良好,直到他停下来并显示错误