My WordPress Blog Acceleration Strategy
From initially using a Hong Kong virtual host, I gradually started experimenting with VPS. Although I haven't used many hosts, I have experienced both free and paid options. Recently, I moved my blog to DigitalOcean, which has been quite a journey. DigitalOcean is a US-based cloud host; while its speed may differ from domestic servers, with proper optimization, it can perform nearly as well as domestic ones. Based on what I've learned, I'd like to share my optimization plan.
1. Choose a Stable DNS Provider
Generally, domain registrars offer free DNS resolution services. However, if you choose a smaller registrar or a foreign one, I don't recommend using their default DNS services. Small providers may be unstable, and foreign providers might be blocked in China, which is a very unfortunate situation. Therefore, it's essential to find a stable DNS resolution provider.
There are many free DNS services available in China, such as DNSPod, Aliyun DNS, and Baidu Cloud Acceleration. These are quite reliable as they are provided by large companies. However, I once encountered a DNS error warning from Google Search Console while using DNSPod. In such cases, you might try the international version of DNSPod.
2. Host Static Resources
When the server is located abroad, loading all website files together can result in slow page loads. To address this, we can store static files like images, CSS, and JS on third-party platforms to improve speed. For WordPress, popular options include Qiniu Cloud Storage (free 10GB), UpYun (which recently launched a free promotion), and some users even use Sina Weibo's image hosting. You can choose one of these. My blog has consistently used Qiniu Cloud Storage.
3. Use Third-Party Frontend Libraries
The advantage of using third-party frontend libraries is that they offer multiple CDN nodes, ensuring the fastest access. Additionally, since many developers use the same libraries, browsers won't need to reload them when visiting other sites that use the same libraries, significantly saving time. For example, my blog uses the Sina frontend library. Domestic frontend libraries are available from Baidu, Sina, 360, UpYun, Qiniu, and others.
4. Enable Caching
The WordPress official team recommends an excellent caching plugin called WP Super Cache. According to my tests, using this plugin reduced response time by several hundred milliseconds and significantly improved the speed score on Baidu's站长 tool. However, beginners might find it slightly challenging and may encounter some unusual issues. It is recommended for users with many articles or those using foreign hosts.
5. Load JavaScript at the Bottom
Developers are well aware that CSS should be placed at the top, while JavaScript should be loaded at the bottom. Many websites use sharing buttons, and the common practice is to copy and paste the code directly. I recommend placing the JavaScript code for calling sharing buttons at the very end of the body.
6. Optimize Site Statistics
I previously used the CNZZ site statistics tool but couldn't find a better acceleration solution. During each check, I noticed it consumed some time. Recently, I switched to Baidu's asynchronous statistics, which provided a slight improvement.
The above points are summarized based on my limited knowledge. While they may not be the optimal solution, they do have a noticeable effect on acceleration. If you have better methods, please feel free to share them.