何时对动态页面使用 gzip 压缩?
一般来说,什么时候为 IIS 启用 gzip 压缩是个好主意?以以下情况为例:
- 静态页面
- 具有许多静态元素和一些动态元素的
- ASP 页面 具有一些静态元素和许多动态元素的
- ASP 页面 完全动态的 ASP 页面
- IIS 上的 WordPress 安装
显然,您可以混合使用静态/动态页面。做出决定的一般规则是什么?如果页面包含任何动态内容,压缩它是否不好?
就我而言,我有两个网站。一个站点大部分是静态的,只有少数页面是由 ASP 动态生成的。第二个站点是 WordPress 安装。对于第一种情况,我觉得压缩是最佳选择。对于 WordPress 我不太确定。
我无法理解动态内容会发生什么。假设我有一个页面,其中包含显示日期和时间的动态元素。每次有人来访,时间都会改变。压缩会很愚蠢吗?
As a general rule, when is enabling gzip compression for IIS a good idea? Take for example the following cases:
- Static Page
- ASP Page that has many static elements and a few dynamic elements
- ASP Page that has a few static elements and many dynamic elements
- ASP Page that is completely dynamic
- A Wordpress installation on IIS
Obviously you can have a mix of static/dynamic pages. What are some general rules to make a decision? If a page contains ANY dynamic content is it bad to compress it?
In my case I have two sites. One site is mostly static with a few pages that are generated dynamically by ASP. The second site is a Wordpress installation. For case one I feel comfortable saying compression is the way to go. For Wordpress I am not so sure.
I am having trouble wrapping my head around what happens with dynamic content. Say I have a page that contains a dynamic element that displays the date and time. Every time someone visited the time would change. Would compression be silly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然可以配置要缓存的压缩内容,但许多站点会动态压缩所有内容,即使它是静态内容。您必须决定压缩节省的带宽是否值得动态压缩的 CPU 负载,但在大多数情况下,下载时间对用户体验的影响比处理时间影响更大,因此收益会下降在压缩的一侧。在这种情况下,内容是否动态并不重要。
While it is possible to configure compressed content to be cached, many sites compress everything on the fly even if it is static content. You have to decide whether the bandwidth savings from compression are worth the CPU load of compressing on-the-fly, but in most cases, the user's experience is impacted much more by download time than by processing time, and so the benefit will come down on the side of compressing. Whether the content is dynamic isn't really relevant in that case.