Of course, it is better to implement both techniques, if you are going to optimize web performance and perform front-end optimization (FEO). The two methods work perfectly together. But the choice mostly depends on your budget and the coverage you want to reach.
Caching of resources is required an all cases, and should be done always for ensuring fast page delivery. As it was mentioned, implementation is simple: just set Expires headers. You can ask your provider to help you with configurations. After setting proper caching of pages and resources, you will see that your website truly became faster.
Content Delivery Network
From one point of view, CDN service is less important than server caching. From another - CDN can provide you with more performance gains and ensure coverage of audience around the world. When it should be implemented?
- 1. When your target audience is located in different regions, countries and continents.
- 2. When you need better protection.
- 3. When you have a lot of traffic and want to offload and protect your server.
The quality of CDN hosting depends on the provider and how many edge servers and locations it offers. CDN solution will also decrease the cost of bandwidth and CPU usage for you, because it will offload the main server.
In rare cases, a CDN can have adverse effects on website performance, if the latency of network is slower than of your server. Besides, if you use too much parallelization of resources (for instance, many subdomains), you can slow down user experience and get extra DNS lookups. Therefore it is necessary to reach the golden middle.
Another drawback is that if CDN network fails, so will your site. If this happens once, it may easily happen again. But this mostly applies to free CDNs. Thus, it is always recommended to back up the website and store resources somewhere else apart from edge servers of content delivery network.
If you decide to go with CDN, be ready to pay fee for usage that will increase hosting costs. But this solution not only provides you with caching: it features DDoS protection, load balancing and possibility to serve content quickly to any corner of the world.