網站加速最佳實踐 – 減少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% 的網站訪問者是第一次訪問,他們的瀏覽器中並沒有你這個網站的快取檔案。
相關文章
- face 31減少http請求HTTP
- 前端巧用localStorage做“快取”,減少HTTP請求次數前端快取HTTP
- 網站http請求狀態碼網站HTTP
- 小程式https請求,http網站升到httpsHTTP網站
- 一個HTTP請求,把網站打裂開了HTTP網站
- 封裝 uniapp 請求庫的最佳實踐封裝APP
- SpringMVC——HTTP請求專案實踐整理總結SpringMVCHTTP
- [Http] 跨站請求偽造(CSRF)HTTP
- HTTP網路請求原理HTTP
- Java實現Http請求JavaHTTP
- 優雅地減少redux請求樣板程式碼Redux
- 使用Egret外掛壓縮程式碼包體積,減少請求數量的實戰教程
- 爬蟲:HTTP請求與HTML解析(爬取某乎網站)爬蟲HTTPHTML網站
- 相親原始碼開發,從程式碼級別減少資料請求次數的實現原始碼
- 瑞星:週末攔截掛馬網站數減少新聞類網站佔主打網站
- Fetch API HTTP請求實用指南APIHTTP
- http請求概述HTTP
- Jsoup http請求JSHTTP
- go http請求GoHTTP
- Laravel最佳實踐 -- API請求頻率限制(Throttle中介軟體)LaravelAPI
- 全民加速節:全站加速在網際網路媒體應用上的最佳實踐
- Qt - http網路請求與響應QTHTTP
- 從 1 秒到 10 毫秒!在 APISIX 中減少 Prometheus 請求阻塞APIPrometheus
- 合併HTTP請求vs並行HTTP請求,到底誰更快?HTTP並行
- 合併HTTP請求 vs 並行HTTP請求,到底誰更快?HTTP並行
- 使用HTTP2來加速你的網站HTTP網站
- flask如何請求別的網站Flask網站
- HTTP請求報文HTTP
- Cookie 與 HTTP請求CookieHTTP
- python做http請求PythonHTTP
- 怎樣修改公司網站內容,公司網站內容更新最佳實踐網站
- SpringBoot 攔截器獲取http請求引數Spring BootHTTP
- [譯] Android效能最佳實踐:減少您的APK大小看這一篇就夠了AndroidAPK
- Http請求資料格式HTTP
- HTTP 請求與響應HTTP
- Http請求與響應HTTP
- Http請求相關(轉)HTTP
- go搞笑http請求庫GoHTTP
- go http請求流程分析GoHTTP