译者注:此处的减少带宽指的是,减少数据传输量(带宽使用)以提升服务的质量。摘抄其中一段:How can I reduce my "bandwidth usage"?我怎么样才能降低我的带宽使用呢?You certainly do not want to reduce the number of visitors. So, the most effective way is to reduce the size of the files on your website.首先,你肯定不想降低访问你网站的用户量,所以,最有效的方法就是减少网站文件的大小。
Build simpler, more efficient websites. Remove any unnecessary text, images or other files. Keep your pages as small as possible. 创建一个简单的网站,删除一切不必要的文字、图片以及其他文件,让你的网站尽可能地简单 Optimize your graphics. Use JPEG image format for photos and GIF form for graphics. 优化图像显示,对图片使用JPEG格式,对动画使用GIF格式 Refrain from fancy flash presentations, audio or video. This includes any music playing the background. 避免使用flash来做页面效果或者展示视频及音频,同样避免有任何背景音乐 Use CSS and call JavaScript externally instead of embedding in every page. This reduces the HTML file size. 从外部CSS和JavaScript,避免将其嵌入至HTML页面中 Remove unwanted tags, white space and comments 删除不想要的标签,空格以及注释 Limit your Meta tags to those absolutely necessary 限制源标签的大小 Consider caching your website, but set an expiry date in the HTTP headers so your visitors' browsers will refresh the content after a certain time (this allows their browser to save a copy of your website, and each time the visitor visits your website, the pages are served from the copy on the browser and not your web server) 对你的网站考虑做缓存,并且在HTTP头部设置一个过期时间
Expires
或Cache-Control
响应头,它就被显示定义为了可缓存的。PUT和DELETE请求在任何情况下都不应该是可缓存的。ETag
或者 Last-Modified
响应头。译者注:一个用来验证缓存有效性的验证器
ETag
值是服务器与资源相关联的不透明的字符串标记,用于唯一标识资源在其整个生命周期内的状态。当资源发生改变时,ETag
值也随之改变。译者注:不透明的字符串标记带有的是一个由不透明的数据类型构成的字符串不透明的数据类型的是一个不想让别人知道的数据类型(隐藏起来的数据类型),具有较强的信息隐蔽性。它的值只能通过有权访问这个信息的子程序来操作。