0

I have a few scripts included in some web pages that no longer exist. People get tons of 404s because the pages are high traffic. I just removed them, but, does it impact performance if I were to leave these in?

4

3 回答 3

1

They certainly do, as they are unnecessary request/response interactions that can add to page load time.

Yahoo explains it very well in their "Best Practices for Speeding Up Your Website".

In your particular case, my suggestion is use a tool such as YSlow or PageSpeed to determine how big is the impact of the 404 responses.

于 2012-11-03T22:54:52.670 回答
0

You still have the request/response communication between client and server, even if a 404 is sent back. However, no processing is needed (such as PHP or other server-side languages) so you will recover some of the load but it's still best not to leave the 404 references in there.

于 2012-11-03T22:54:06.327 回答
0

目前尚不清楚您是在询问断开的链接还是有效的链接,或者您是在询问断开的链接还是根本没有链接。

所以我对所有三种情况都做了一些测试。在我的测试中,我使用了指向图像的链接,因此指向文档的链接可能会给您带来不同的结果。我创建了一个加载 100 个独特图像的测试页面。我用图像加载了五次,用损坏的图像链接加载了五次(创建 404 错误),五次根本没有任何图像标签。每次在加载页面之前,我都会清除缓存以确保这是一场公平的战斗。

有 100 张图片,这些是我的结果:

3138 milliseconds
3102 milliseconds
2721 milliseconds
4105 milliseconds
3365 milliseconds

有 100 个损坏的图像链接:

1700 milliseconds
1706 milliseconds
1734 milliseconds
1661 milliseconds
1678 milliseconds

完全删除图像标签:

10 milliseconds
13 milliseconds
21 milliseconds
12 milliseconds
12 milliseconds

所以一个断开的链接比一个有效的链接快,但它仍然比没有链接慢。如果您不需要它们,则可能值得摆脱它们。

于 2021-09-17T01:31:13.697 回答