模拟本地主机加载

发布于 2024-07-26 04:27:20 字数 153 浏览 6 评论 0原文

我有一个使用 AJAX 和预加载器的网站。 现在我想在在线部署站点之前看看这些预加载器的影响。

“问题”是本地主机没有加载时间并且响应是立即的,所以我看不到我的预加载器。

如何模拟加载或有限带宽(使用 Firefox、Rails 或其他任何工具)?

I have a site which uses AJAX and preloaders. Now I would like to see the impact of these preoloaders before deploying the site online.

The "problem" is that localhost doesn't have loading time and the response is immediate, so that I can't see my preloaders.

How can I simulate loading or limited bandwidth (with Firefox, Rails or whatever else)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

握住我的手 2024-08-02 04:27:21

我现在面前没有 Rails 应用程序,但为什么不向适当的控制器添加延迟呢?

def index
    # ...
    sleep 2        # sleeps for 2 seconds
    # ...
end

或者,使用调试器并在控制器代码中放置断点。 这应该意味着您的预加载器将显示,直到继续执行。

I don't have a rails app in front of me right now but why don't you just add a delay to the appropriate controller?

i.e.

def index
    # ...
    sleep 2        # sleeps for 2 seconds
    # ...
end

Alternatively, use a debugger and place a breakpoint in the controller code. This should mean that your preloader will show until execution is continued.

好多鱼好多余 2024-08-02 04:27:21

一种选择是将站点短暂部署到您将用于生产的主机上,并使用备用 URL 进行性能测试。

但是,它对您的执行方式不一定与其他位置的其他人相同。

如果您提供有关这些“预加载器”是什么、它们如何工作以及您所说的“查看影响”的更多详细信息,我们也许能够给出更好的答案。 您的意思是您想要观察 AJAX spinner gif 并了解加载发生时最终用户看到的效果吗? 或者你的意思是你想对它们进行某种正式的基准测试?

One option would be to deploy the site briefly to the host you will be using for production under an alternate URL for performance testing.

However, the way it performs for you won't necessarily be the same for everyone else in other locations.

If you provide some more detail on what these "preloaders" are and how they work and what you mean by "see the impact" we might be able to give better answers. Do you mean you want to eyeball the AJAX spinner gifs and get a feel for how it will look to the end user as the loading takes place? Or do you mean you want to do some kind of formal benchmarking on them?

话少心凉 2024-08-02 04:27:21

您可以使用 Firefox 的 Firebug 插件来确定页面的网络行为。 这对于本地主机来说效果很好。 您应该看到在执行预加载时同时检索所有图像。

You can use Firebug plugin to Firefox to determine the network behavior of your page. This works fine for localhost. You should see all images being retrieved simultaneously at the time of the preload execution.

丢了幸福的猪 2024-08-02 04:27:21

您可以配置路由器,以便它将某个端口上的请求转发到您正在运行网站的计算机。 然后,当您在浏览器中打开 your.ip.add.ress:the_port 时,瓶颈将是您的上传速度,通常相当低。

但这就是我会做的;)

You could configure your router so that it forwards requests on a certain port to the computer you're running the website on. Then, when you open your.ip.add.ress:the_port in your browser, the bottleneck will be your upload speed, which is generally quite low.

But that's just how I would do it ;)

回忆那么伤 2024-08-02 04:27:20

如果在 Windows 上,请下载 Fiddler 并将其设置为像在调制解调器上一样:

工具-- >性能-->模拟调制解调器速度

[编辑]
既然你说你现在在 MAC 上,你就有 Charles,它有 节流
[/编辑]

If on windows, download Fiddler and set it to act like you are on a modem:

Tools-->Performance-->Simulate Modem Speeds

[edit]
Since you said you are now on a MAC, you have Charles which has throttling
[/edit]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文