gpt4 book ai didi

php - 最近在 ubuntu 16.04 上使用 php 7 到同一服务器的完整 url 的 file_get_contents 非常慢

转载 作者:行者123 更新时间:2023-12-04 19:14:37 24 4
gpt4 key购买 nike

会不会与以下有关:

https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1674733

只是一个想法?可能不会,因为最终,它确实有效。

这曾经非常快,现在需要 7 秒到 26 秒来制作一个小图像,并且也存储在本地。

“好吧,只需将代码更改为不通过 h​​ttp 进行”,我宁愿不重写我用来解决突然冒出来的问题的库。如果我在本地开发机器上本地执行相同的调用,则需要一瞬间。
myapp/public/caup_laravel/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php
代码:

   $options = array(
'http' => array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n".
"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n"
)
);

$context = stream_context_create($options);
if ($data = @file_get_contents($url, false, $context)) { //VERY slow call
return $this->initFromBinary($data);
}

网址的示例是:

http://dev.causepick.org/caup_api/uploads/causes/52/cropped-436535-a42b2.jpg

通过浏览器访问图像是即时的,例如如果我在地址栏中输入 url

最佳答案

我收到了来自我的服务器提供商的 digitalocean 的回复

We've received reports of a DNS outage affecting users that utilize Google's DNS servers, which is the default on all of our images. This droplet is in the affected IP range, so it is likely related to the issue.

Can you try using OpenDNS's servers, 208.67.222.222 and 208.67.220.220, as your primary or backup nameservers? This should resolve the issue you are facing. You can do this temporarily (it will persist until your next reboot) by editing /etc/resolv.conf to look like this:


nameserver 208.67.222.222  
nameserver 208.67.220.220

So far everything points to this being an issue on Google's end, affecting UDP-based DNS queries from our 192.241.128.0/17 range. Eventually, queries can fall back to TCP, which allows them to succeed, but it takes several seconds explaining the slowness you're seeing. We've seen Google rate-limit or block selective IP ranges before, and it was very difficult to pin down. We've already reached out to Google and we are awaiting a response and resolution.



这行得通

关于php - 最近在 ubuntu 16.04 上使用 php 7 到同一服务器的完整 url 的 file_get_contents 非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43053872/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com