AJAX 加载时间 - 主机和服务器问题?
我遇到 AJAX 调用缓慢的问题。这是一个常见问题,但我已经完成了我能找到的所有研究中建议的所有内容。我希望读过这篇文章的人能够达成共识。
基本上,我向 php 页面发出 ajax 请求,该页面从数据库获取信息。
这里是页面。
我已经对所有 javascript、mySQL 和 php 脚本、请求和页面进行了计时。 (如果你运行 firebug,你可以在控制台以及 xml 中看到我的时间标记)
作为示例 -
mysql 请求需要 20ms PHP页面耗时50ms ajax 成功脚本处理少量 xml(小于 1k)并生成标记,运行时间为 8 毫秒。
然而,加载页面需要近 4 秒的时间。
因此,假设我的脚本没有滞后,这一定是服务器响应时间或我自己的互联网连接的问题,对吧?
我很感激任何理论或想法。
谢谢
I'm having an issue with slow AJAX calls. This is a common question, but I've done everything suggested in all the research I can find. I'm hoping to get a consensus form people who read this.
Basically, I make an ajax request to a php page, which gets info from a database.
Here is the page.
I've timed all of my javascript, mySQL, and php scripts, requests, and pages.
(If you run firebug you can see my time markers in the console, as well as in the xml)
As an example -
The mysql request takes 20ms
The PHP page takes 50ms
The ajax success script, which processes the small amount of xml (less than 1k) and generates the markers, takes 8ms to run.
Yet, loading the page takes nearly 4 seconds.
So, assuming none of my scripts are lagging, this has to be a problem with the response time from the server, or my own internet connection, right?
I'd appreciate any theories or thoughts.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,查看了您的页面,以下是我看到的一些会影响速度的问题:
因此,通过执行上述操作,您可以大大加快速度。您将从 82 个组件减少到 51 个本地组件,以及 Google CDN 上的 2 个组件。如果您可以改进 xml 读取时间,您还可以缩短近一秒的卸载时间
Ok looked at your page and here are some of the issues I saw that would affect speed:
So you can greatly speed things up by doing the above. You would go from 82 components down to 51 local and 2 more on Google CDN. If you can improve that xml read time you can shave nearly another second off load time as well