简体   繁体   English

Apache HTTP localhost 在 macOS Monterey 上随机花费 5 秒,但在 HTTPS 上快速

[英]Apache HTTP localhost randomly taking 5 seconds on macOS Monterey but fast on HTTPS

I waited as long as I could but finally had to upgrade from Mojave.我尽可能地等待,但最终不得不从 Mojave 升级。
I knew something would needlessly break.我知道有些东西会不必要地破裂。 And of course it did.当然它确实做到了。

Largish files (more than 100k) randomly take 5 seconds to load.大文件(超过 100k)随机加载需要 5 秒。 It's not always the same file, and not every time, and it only happens in HTTP Apache (tried port 80 and 8080).它并不总是同一个文件,也不是每次,它只发生在 HTTP Apache (尝试端口 80 和 8080)。 It works fine in Apache HTTPS/443 and Python's SimpleHTTPServer on HTTP/80.它在 Apache HTTPS/443 和 Python 的 SimpleHTTPServer on HTTP/80 中运行良好。

Things I have tried:我尝试过的事情:

  • It's not DNS.它不是 DNS。 It happens on http://127.0.0.1/large.jpg它发生在http://127.0.0.1/large.jpg
  • It's not browser related, it happens on curl.它与浏览器无关,它发生在 curl 上。
  • It's not IPv6.这不是 IPv6。 Turned it off, same deal.关掉了,一样的。
  • It's not MTU, tried 1492, same thing (you can see my desperation by now)这不是 MTU,试过 1492,同样的事情(你现在可以看到我的绝望了)
  • Already reinstalled it via brew reinstall httpd .已经通过brew reinstall httpd重新安装了它。 Nothing.没有什么。

Steps to reproduce:重现步骤:
i=1; while [ $i -lt 50 ]; do time curl http://127.0.0.1/large.jpg > /dev/null; ((i++)); done

Eventually it will stall for 5 seconds at 96%:最终它将在 96% 处停止 5 秒:
96 395k 96 382k

Another file:另一个文件:
i=1; while [ $i -lt 50 ]; do time curl http://127.0.0.1/jquery-latest.min.js > /dev/null; ((i++)); done

Eventually stalls at 85%最终停滞在 85%
85 95786 85 81390

httpd -v httpd -v
Server version: Apache/2.4.52 (Unix)服务器版本:Apache/2.4.52 (Unix)
Server built: Dec 20 2021 13:37:44服务器建成:2021年12月20日13:37:44
Installed via brew通过 brew 安装

macOS Monterey 12.1 (21C52) macOS 蒙特雷 12.1 (21C52)

I'm loosing my mind, any help is much appreciated.我正在失去理智,非常感谢任何帮助。
Thanks谢谢

I think I found a solution.我想我找到了解决办法。 Turn off Keep Alive by adding:通过添加以下内容来关闭 Keep Alive:

KeepAlive Off

To your http.conf到您的 http.conf

A better answer would be to understand why Keep Alive is misbehaving and fix that, but since it's on my local dev machine, it won't matter.一个更好的答案是理解为什么 Keep Alive 行为不端并修复它,但由于它在我的本地开发机器上,所以没关系。

Thanks to this thread, I've been able to open an issue on apache's bugzilla and the bug has been fixed and released in httpd 2.4.54 already available on brew:)多亏了这个线程,我已经能够在apache 的 bugzilla上打开一个问题,并且该错误已在 brew 上已经可用的 httpd 2.4.54 中修复和发布:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM