Ajax ping 脚本多个IP
我有一个显示 IP 地址列表状态的页面。 它使用 ajax 为每个 IP 调用 ping 脚本。
我发现它一次只能执行大约 6 个操作,即使 javascript 同时请求所有 IP(大约 30 个)。
我怎样才能让它们同时 ping 通?
谢谢。
I have a page that shows the status of a list of IP addresses.
It uses ajax to call a ping script for each IP.
What I am finding is that it can only do about 6 at a time even though ALL of the IP's (about 30 of them) are requested at the same time from the javascript.
How can I get them to all ping at once?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的 Web 服务器似乎未接受超过 6 个请求,您应该检查一下。
此外,您可以使用 Firebug 查看是否所有请求都已同时触发以及每个请求发生了什么。
It looks like your Web Server is not accepting more than 6 requests, you should check it.
Additionally, you could use Firebug to see if all the requests have been triggered in the same time and what is happening with each of them.
您可以发送的并发请求数量是有限制的。另请参阅此处: 有多少个并发 AJAX (XmlHttpRequest )在流行的浏览器中允许请求吗?
网站用来提高服务速度的一个技巧是限制所需的请求量。他们还将内容(图像)放入单独的(子)域中,因为您会在该域上收到另外 3 个(或 6 个)请求。
根据您的情况,您可以尝试将它们放入 1 个调用中,或将它们定向到多个子域。
(需要明确的是:虽然服务器可以有限制,但您在这里达到的限制是您的浏览器发出的请求。在 IE 中,您似乎可以被限制为另一个(2?)数字,请参阅我提供的链接)
There is a limit on how many concurrent requests you can send out. Also see here: How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?
One trick websites use to make their serving faster, is to limit the amount of requests needed. They also put stuff (images) in a a separate (sub)domain, because you get another 3 (or 6) requests on that domain.
In your case you can try to fit them into 1 call, or direct them to several subdomains.
(to be clear: although the server CAN have a limit, the limit you are reaching here is the requests your browser sends out. in IE it seems you can be limited to another (2?) number, see the link I provided)
你只能做 6 个...需要太长时间吗?
You can do only 6...does it take too long?