惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Engineering at Meta
Engineering at Meta
The Register - Security
The Register - Security
N
Netflix TechBlog - Medium
D
Docker
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
IT之家
IT之家
V
V2EX
人人都是产品经理
人人都是产品经理
F
Fortinet All Blogs
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
F
Full Disclosure
P
Proofpoint News Feed
B
Blog RSS Feed
T
Tor Project blog
T
The Blog of Author Tim Ferriss
B
Blog
Webroot Blog
Webroot Blog
腾讯CDC
T
Troy Hunt's Blog
T
Tailwind CSS Blog
H
Heimdal Security Blog
AWS News Blog
AWS News Blog
G
Google Developers Blog
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
A
About on SuperTechFans
SecWiki News
SecWiki News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
I
InfoQ
M
MIT News - Artificial intelligence
大猫的无限游戏
大猫的无限游戏
美团技术团队
L
LangChain Blog

James Guo’s Portfolio (@ZE3kr)

Hertz Rental Debt Collection and How I Sued the Debt Collector macOS on iPad? (with Jump Desktop) Vision Pro Initial Experience | ZE3kr The Downtime of Alibaba Cloud Hong Kong Region How Fast is mmWave 5G? 2000Mbps! See if Your iPhone Supports mmWave Magic Keyboard for iPad Pro Experience Self-built PowerDNS Advanced: GeoDNS, dnsdist, Lua Records SSD USB, Windows To Go and Mac WordPress 5.0 Update is Available, New Editor, New Theme Azure DNS, NS1, Constellix, Comparison of Three International GeoDNS Service Providers Recommendations for Some Exquisite and Useful Software on Mac Talk About Data Backup | ZE3kr Introduction to DNSSEC, How Signatures Work Cloudflare Argo And Railgun Comparison Test, The technology of CDN Acceleration Recommendations For Several Free Server Monitoring Services Comparison of Several Full-Site CDNs 2017, Another Look at SSL and HTTPS Some suggestions on website construction and service purchase Detailed Explanation of DNS Domain Name Resolution System - Basics Build Blazing Fast Mobile Pages With AMP Cloudflare's new feature experience - Load Balancing, Rate Limiting Back to WordPress' Built-In Comment System Implementing ECDSA/RSA Dual Certificate with Free Let's Encrypt How to configure for pure IPv6-Only network access Self-built PowerDNS GeoDNS Server | ZE3kr Install GitLab on Your Own Server Instead of GitHub! A Few WordPress Optimization Suggestions Comprehensive Comparison of DNS Services such as CloudXNS, Route 53, and Alibaba Cloud DNS Talk about the streaming of video on the Internet Canon Announces New APS-C Model EOS 80D, Powerful Video Recording, New Focus System and CMOS Several recommended plugins for WordPress Using Matomo with WordPress to Build a Powerful Statistics System TL-PA500 power cat, deploy wireless LAN cluster Why use a CDN service? The pros and cons of static web pages HTTPS Everywhere is Coming | ZE3kr Withings Activité Pop smartwatch recommendation, sleep tracking, exercise recording, smart alarm clock DELL P2415Q 4K Monitor Recommended Use srcset + sizes attributes and w identifier to solve all responsive image problems Eyefi Mobi makes your camera Wi-Fi ready now MacID Lets iPhone Unlock Apple's Mac with Touch ID ProCamera – Recommended iPhone camera software Mobile First - Origins | ZE3kr
Mobile First - Speed | ZE3kr
2015-07-15 · via James Guo’s Portfolio (@ZE3kr)

Internet speeds on mobile devices are usually not fast, they usually have slower speeds and higher latency than broadband, so how do mobile browsers load pages? That’s what this article is about. In fact, whether you are loading a page on a mobile or desktop side, the following steps are required:

1. Resolve Domain Name

The domain name usually corresponds to an IP address, and the browser can communicate with the server only after knowing this IP address. In order to resolve the domain name, the client will send a request for the domain name to the DNS resolution server, and the IP address of the domain name can be queried. DNS resolution has a “TTL time to live”, which is the cache time. This content will be cached on the DNS resolution server, router and client, and stored according to the cache time. The DNS resolution server is usually provided by the operator, and if there is a cache, the resolution speed is quite fast. (The current DNS resolution is transmitted in very insecure plaintext, and any middleman can destroy or modify the resolution result)

2. Make a Request

After having the IP address, the browser establishes a TCP connection with the server and makes a request. The request will include the domain name of the website that needs to be accessed (so that IP can provide different content to multiple domain names), request method, URL path, acceptable data, compression type and encoding method, cookies and browser information (which can determine your whether the website is accessed on a mobile phone).

3. Download page

The browser starts to download the page itself, and after downloading the page itself, it starts to download other content that the page depends on, including CSS, JavaScript, images, etc. Depending on the priority, they may be downloaded before or after rendering.

4. Rendering the page

The browser will wait for the most important dependencies (that is, CSS and JavaScript in the head section, which will be highlighted later) to be loaded, before rendering. Because rendering depends on these contents, CSS is also what we often call style sheets. These style sheets are very important, such as this website of Baidu:

Baidu without stylesheets
Baidu without stylesheets

Without CSS style sheets, the layout of the entire web page is “out of control” and the page doesn’t load in the expected way, which is a terrible experience. A web page without a style sheet and a web page with a style sheet are usually two completely different things. However, JavaScript is usually not related to layout and can be loaded later without affecting page styles.

Boost Speed

Every content in the web page has to go through such a process in order to be obtained by the client. Only when the page is rendered can the user see the content of the page. Before that, the page is blank. Be aware that if a page is blank for 3 seconds, more than half of users will log out. Mobile-first considers the user experience on high-latency mobile networks, but when it comes to desktop, you can also enjoy the speed boost brought by limited mobile. In order to increase the speed, there are several common methods:

Put Unnecessary JavaScript at the End of the Page

If JavaScript is placed at the end, it can be loaded after the page is rendered, greatly reducing the time when the page is blank. This is the simplest and the most obvious improvement.

Using CDN

Using CDN means putting static files on the CDN server as much as possible. A CDN contains many nodes. When users download files on CDN, they will be downloaded from the node with the nearest physical location or the same operator. If there is a cache, it will be directly passed to the user. If there is no cache, it will be downloaded from the nearest data center and cached, and then passed to the user. My approach is to put all the images, videos, CSS stylesheets and JavaScript on the site on the CDN, the site itself is not on the CDN. Doing so can greatly reduce load times at a small cost. Whether it is a personal blog or an industry website, it is necessary to use a CDN. If you don’t have the money to buy your own CDN, it’s okay, you can use the CDN of common open source CSS and JavaScript for free. The official website address is: cdnjs.com.

Proper Use of Caching

Cache images, CSS style sheets and JavaScript settings. I’m used to setting a fairly long time period (a week, a year, etc.), and some people adjust the cache period to a smaller value in order to be able to modify it frequently. I change the file directory directly when I modify the file, so that the file can always be kept up-to-date. Taking advantage of the cache can greatly speed up the user’s second visit.

Summarize

For website speed, we should not only focus on the first startup speed, but also use the cache to improve the next visit speed. And you should pay attention to user experience while improving speed.