Continuing
lastAfter chatting, how did I struggle and finally decided to change the theme. I decided to do it, but then I encountered a new problem:
How to change the theme and open the CDN, how to arrange the order?
My original plan is to use the old theme to test the data of ‘No CDN’, open the CDN to get the comparison results, and then change the theme. In this way, the ‘CDN speed-up effect’ of the old theme can also be left, which looks perfect.
But if you think about it carefully, there is a problem with this plan, and the problem is not small.
Why did I not drop ‘Open the CDN first, then change the theme’
The first question: data cannot be compared
The most basic common sense of doing performance testing is:Change only one variable at a time.
If I open the CDN first to get the data of the old theme, and then change the new theme, then there are two differences between the old and new data of ‘theme code’ and ‘CDN status’. At that time, is the change of loading speed measured, is the contribution of CDN, or is the new theme itself lighter or more bloated? Totally unclear.
Moreover, the previous data has shown my readers 96% with Chrome, 93% Windows, more than 35% screen width more than 1680px. New themes are more likely to be more suitable for these mainstream configurations than older themes, but they may also introduce more CSS and JS at the same time – these changes will affect the load time. If it is mixed with the effect of CDN, it cannot be disassembled at all.
Second question: CDN cache will be a disaster
This is a more practical consideration.
The CDN cache is based on the URL path one-to-one correspondence. The static file path of the old theme is /wp-content/themes/hueman/, the new theme is /wp-content/themes/newtheme/. If I open the CDN first, these things will happen after changing the theme:
- The cache file of the old theme will continue to take up the CDN node space and will not be released until it expires
- There is no cache in the path of the new theme, all requests will penetrate back to the source, causing a ‘return to the source storm’ – equivalent to the CDN is open in vain
- If the old and new themes happen to have files of the same name (for example, they are all called
style.css), the CDN may mistake the old cache to return the old cache to the visitor, resulting in a confusion of the page style
This means that after changing the theme, I not only have to manually refresh a large number of caches, but also bear the embarrassing period of slowing down the initial launch of the new theme. This completely deviates from the original intention of my theme change in the previous article – giving readers a better experience.
My choice: change the theme first, then open the CDN
Based on the above analysis, my operation steps are determined as:
Step 1: Change the theme
Pick a widescreen-friendly, mobile-responsive and light-weight theme to complete migration and style fine-tuning.
Step 2: Retest the ‘No CDN’ baseline
Use the same test tools (PageSpeed Insights, Boorex, etc.) and nodes to re-run the domestic/foreign network speed data as the ‘naked running achievement’ of the new theme.
This step has a small episode:The ‘no CDN’ data of my old theme has actually been tested, but since I decided to change the theme, the set of data will not be used – because the theme has changed, the size of the page and the number of requests have changed, and the conclusion is inaccurate to compare the baseline of the old theme with the effect of the CDN after changing the theme. If the cost of sinking is sunk, you have to give up.
Step 3: Turn on the CDN
After the new theme runs stably for a few days, turn on the CDN, let the cache naturally warm up with the real visitor, and then conduct the second round of test to obtain pure CDN acceleration data.
Step 4: Post a comparison article
Sort out the difference between the two sets of data, and write an objective CDN effect evaluation.
The benefits of doing this are:
- control variable: There are two sets of data of ‘no CDN’ and ‘Having CDN’ in the new theme, and there is only one variable – whether the CDN is turned on, the conclusion can withstand scrutiny
- Avoid cache issues: The CDN has not been turned on when the new theme is online, and there is no problem of cache pollution or return storm
- smooth transition: After the CDN is turned on, the cache is naturally established with access, and there is no need to manually refresh or warm up
For friends who are also tossing, a little reference
This seemingly simple choice of ‘open CDN first or change the theme first’, is actually behindcontrol variable principleAndCache management practicedouble consideration. Although the ‘No CDN’ data of the old theme has been tested in vain, compared to getting an unexplainable comparison result, this sunk cost is worth paying.
If you’re also tossing about CDN or changing the theme, my advice is simple:
- Make a decision first: change the theme or not? This decision should not be based on feeling, to check the data.
- If you decide to change it, then turn on the CDN after changing it. The order is wrong, and the subsequent troubles are more than expected.
In the future, I will also sort out the selection process of the new topic and the measured data of the CDN. Welcome to continue to pay attention.
Leave a Reply