脚本执行多久才算太长?

发布于 2024-08-31 21:33:00 字数 129 浏览 5 评论 0原文

您认为 Web 脚本(例如 PHP)在开始成为用户烦恼之前可接受的最长时间执行(平均)是多少?我一直认为,如果用户必须等待超过 1 秒才能加载页面(当然这是在图像和 css 被缓存之后......这个规则实际上只适用于后续请求)他们会开始生气。

What is the max time do you think is acceptable for a web script (PHP for example) to execute before it starts to become an annoyance for the user (on average)? I always thought that if the user has to wait more than 1 second for the page to load (this of course after images and css have been cached..this rule really only applies for subsequent requests) they would start to get annoyed.

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

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

发布评论

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

评论(9

怎会甘心 2024-09-07 21:33:00

42秒。

事实上,事实是,这更多地取决于您所迎合的用户的年龄和期望。例如,我的父母可能更能容忍长时间的等待,但也更有可能一次又一次地按下按钮,就像他们按下人行横道或电梯按钮一样。

也就是说,真正的答案是,用户没有反馈多久才算太久?即使是快速启动沙漏徽标或进度条,也可以为用户带来巨大的变化。也就是说,如果您提供的服务应该是实时的并且像桌面应用程序一样运行,那么太长的时间基本上就是“任何可感知的”。

所以,逃避的答案......这取决于。也就是说,即使是“太长”的等待,也可以通过适当的 UI 设计和客户交互来克服。

42 seconds.

Actually, truth is it more comes down to the age and expectations of the user you are catering to. My parents for example, might be much more tolerant of an extended wait, but are also much more likely to press the button again and again, like they will to a crosswalk or elevator button.

That said the real answer is, how long is too long for the user to go without feedback? Even kicking up a quick hourglass logo, or progress bar, can make all the difference in the world for a user. That said, if the service you are providing should be realtime and act like a desktop app, too long is basically "anything perceptible".

So, cop-out answer... it depends. That said, even a "too long" wait, can be overcome by proper UI design and customer interaction.

謌踐踏愛綪 2024-09-07 21:33:00

雅各布·尼尔森 引用了一些对此的研究:

  • 0.1秒大约是让用户感觉系统立即做出反应的极限,这意味着除了显示结果之外不需要特殊的反馈。
  • 1.0 秒 是关于用户的思想流保持不间断的限制,即使用户会注意到延迟。一般情况下,大于0.1秒小于1.0秒的延迟不需要特殊反馈,但用户确实失去了直接操作数据的感觉。
  • 10 秒 大约是让用户的注意力集中在对话上的限制。对于较长的延迟,用户会希望在等待计算机完成的同时执行其他任务,因此应该向他们提供反馈,指示计算机预计何时完成。如果响应时间可能变化很大,则延迟期间的反馈尤其重要,因为用户将不知道会发生什么。

为了获得灵感,您可以查看 NetBeans 社区如何解释这些值

  1. 0.1 秒 - 导航和编辑操作(例如文件夹扩展、在编辑器中粘贴、在编辑器中导航)以及所有菜单栏的绘制必须在此限制内完成
  2. 1.0 秒 - 所有窗口和对话框打开都必须在此限制内完成
  3. 10 秒 - 所有在 1 秒之后完成且通常花费不到 10 秒的操作必须显示某种忙碌指示(例如沙漏光标或“请稍候” ...“ 文本);所有花费时间超过此限制的操作都需要使用进度 API 提供进度栏

Jacob Nielsen cites some research on this:

  • 0.1 second is about the limit for having the user feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result.
  • 1.0 second is about the limit for the user's flow of thought to stay uninterrupted, even though the user will notice the delay. Normally, no special feedback is necessary during delays of more than 0.1 but less than 1.0 second, but the user does lose the feeling of operating directly on the data.
  • 10 seconds is about the limit for keeping the user's attention focused on the dialogue. For longer delays, users will want to perform other tasks while waiting for the computer to finish, so they should be given feedback indicating when the computer expects to be done. Feedback during the delay is especially important if the response time is likely to be highly variable, since users will then not know what to expect.

To serve as inspiration, you could look at how the NetBeans community interpret these values:

  1. 0.1 second - navigation and edit actions (e.g. folder expansion, paste in editor, navigation in editor), and painting of all menu bars must finish within this limit
  2. 1.0 second - all window and dialog openings must finish within this limit
  3. 10 seconds - all actions which are finished later than after 1 second and usually take less than 10 seconds must show some sort of busy indication (e.g. hour glass cursor or "please wait..." text); all actions taking longer than this limit are required to provide progress bar using Progress APIs
若水微香 2024-09-07 21:33:00

PHP 脚本执行的默认限制是 30 秒。如果您只是从用户的角度询问,那么经验法则是越快越好......

Well default limit for a PHP script execution is 30 seconds. If you are just asking from the users perspective then the rule of thumb would be the faster the better...

黒涩兲箜 2024-09-07 21:33:00

任何需要超过几秒处理时间的事情都应该以不同的方式处理,这里有一些示例

  • 缓存其输出服务器端
  • 运行一个进行处理的 Cron 作业
  • 使用 system() 使用 PHP 生成一个虚假进程

Anything that takes more than a few seconds of process time should be handled differently, here are some examples

  • Cache its output server side
  • Run a Cron job that does the processing
  • Spawn a faux process with PHP using system()
余生一个溪 2024-09-07 21:33:00

看一下这个链接:

http://www.simple-talk.com/dotnet/.net-tools/the-cost-of-poor-website-performance/

,然后决定用户可以达到的挫败程度。

Take a look at this link:

http://www.simple-talk.com/dotnet/.net-tools/the-cost-of-poor-website-performance/

then just decide the level of frustration your users can reach.

好听的两个字的网名 2024-09-07 21:33:00

我的经验法则:

在一般情况下将服务器端处理时间控制在 1 秒以内,在最坏的情况下绝对控制在 30 秒以内。

My rule of thumb:

Keep server-side processing under a second in the average case scenario and definitely under 30s in the worst case.

下雨或天晴 2024-09-07 21:33:00

我想说的是,在您应该调用 (PHP)ob_flush() 并至少向客户端发送一些内容之前几秒钟。否则电梯效应将接管并且用户将重复刷新。至于总页面加载量,只要您向用户发布信息就没关系。进度条将对此有所帮助。

I'd say a couple of seconds before you should call (PHP)ob_flush() and at least send SOMETHING to the client. Otherwise the elevator effect will take over and the user will refresh repeatedly. As for total page load, it doesn't matter as long as you keep the user posted. A progress bar will help with that.

尝蛊 2024-09-07 21:33:00

久经考验的正确策略始终是管理期望。不要让用户再次猜测您或您的应用程序。如果根据您的基准测试,特定页面的平均处理时间将超出(例如 6 秒)阈值,请在用户单击按钮之前说明。这很像等待网站向您发送确认电子邮件,但不知道它何时到达,因为从未提及由于流量超出网站的控制而可能需要几个小时。

The tried and true strategy is always to manage expectations. Don't make a user second guess you or your application. If, by your benchmarks, the average processing time for a particular page will go beyond, say a 6-second threshold, say so before the user clicks a button. It's much like waiting for a Web site to send you a confirmation e-mail, not knowing when it will arrive, because it was never mentioned that it could take several hours due to traffic beyond the control of the site.

笨笨の傻瓜 2024-09-07 21:33:00

根据我的经验,如果某些事情需要花费超过几秒钟的时间,您至少应该给用户一些通知。可能会使用 AJAX 和一些精美的动画,并注意到“这需要一段时间”。

例如,如果您无法使用 AJAX,并且您的 PHP 脚本加载时间超过 10 秒,请尝试考虑一种优化方法。

From my experience, you should give the user at least some notice if something's gonna take more than few seconds. Possibly use AJAX with some fancy animation and notice like "This is gonna take a while".

If you cannot use AJAX and your PHP script is taking, for example, more than 10 seconds to load, try to think about a way to optimize it.

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