網站加速最佳實踐 – 減少HTTP請求數
參考: http://developer.yahoo.com/performance/rules.html#num_http
80% of the end-user response time is spent on the front-end . Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.
簡化頁面很重要,但是往往不可行,如何在保持頁面內容豐富多彩的前提下保持快速的響應時間,這是優化的重點!
One way to reduce the number of components in the page is to simplify the page's design. But is there a way to build pages with richer content while also achieving fast response times? Here are some techniques for reducing the number of HTTP requests, while still supporting rich page designs.
Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of your release process improves response times.
CSS Sprites
are the preferred method for reducing the number of image requests. Combine
your background images into a single image and use the CSS background-image
and background-position
properties to display the desired image
segment.
Image maps combine multiple images into a single image. The overall size is about the same, but reducing the number of HTTP requests speeds up the page. Image maps only work if the images are contiguous in the page, such as a navigation bar. Defining the coordinates of image maps can be tedious and error prone. Using image maps for navigation is not accessible too, so it's not recommended.
Inline
images
use the data:
URL scheme
to
embed the image data in the actual page. This can increase the size of your
HTML document. Combining inline images into your (cached) stylesheets is a way
to reduce HTTP requests and avoid increasing the size of your pages. Inline
images are not yet supported across all major browsers.
Reducing the number of HTTP requests in your page is the place to start. This is the most important guideline for improving performance for first time visitors. As described in Tenni Theurer's blog post Browser Cache Usage - Exposed! , 40-60% of daily visitors to your site come in with an empty cache. Making your page fast for these first time visitors is key to a better user experience .
每天的訪問量中,有 40~60% 的網站訪問者是第一次訪問,他們的瀏覽器中並沒有你這個網站的快取檔案。
相關文章
- 網站加速最佳實踐 – 減少DNS查詢網站DNS
- 大型網站最佳化技術:減少HTTP請求網站HTTP
- 減少HTTP請求(大型網站最佳化技術)HTTP網站
- face 31減少http請求HTTP
- 前端巧用localStorage做“快取”,減少HTTP請求次數前端快取HTTP
- 減少HTTP請求之合併圖片詳解(大型網站優化技術)HTTP網站優化
- 網站加速最佳實踐 – 避免重定向網站
- 高效能web建站規則(儘量減少http請求)WebHTTP
- 瀏覽器的小改進讓 Facebook 網站減少 60% 的網路請求瀏覽器網站
- 網站http請求狀態碼網站HTTP
- 一個HTTP請求,把網站打裂開了HTTP網站
- 優雅地減少redux請求樣板程式碼Redux
- 小程式https請求,http網站升到httpsHTTP網站
- 封裝 uniapp 請求庫的最佳實踐封裝APP
- [Http] 跨站請求偽造(CSRF)HTTP
- HTTP網路請求原理HTTP
- 使用Egret外掛壓縮程式碼包體積,減少請求數量的實戰教程
- SpringMVC——HTTP請求專案實踐整理總結SpringMVCHTTP
- Java實現Http請求JavaHTTP
- 相親原始碼開發,從程式碼級別減少資料請求次數的實現原始碼
- http請求HTTP
- HTTP 請求HTTP
- locust 執行一段時間,使用者數沒減少,但是 RPS 逐漸減少,最後沒有請求
- 瑞星:週末攔截掛馬網站數減少新聞類網站佔主打網站
- 爬蟲:HTTP請求與HTML解析(爬取某乎網站)爬蟲HTTPHTML網站
- 網站效能優化——DNS預熱與合併HTTP請求網站優化DNSHTTP
- Android Http請求框架二:xUtils 框架網路請求AndroidHTTP框架
- 從 1 秒到 10 毫秒!在 APISIX 中減少 Prometheus 請求阻塞APIPrometheus
- 全民加速節:全站加速在網際網路媒體應用上的最佳實踐
- http請求概述HTTP
- HTTP請求方法HTTP
- http請求頭HTTP
- go http請求GoHTTP
- Laravel最佳實踐 -- API請求頻率限制(Throttle中介軟體)LaravelAPI
- CDN的combo技術能把多個資原始檔合併引用,減少請求次數
- .NET處理HTTP請求——摘自網路HTTP
- Android測試Http網路請求。AndroidHTTP
- 使用HTTP2來加速你的網站HTTP網站