Expecting a traffic spike? It may turn into a real disaster for those who don’t use CDN (content delivery networks) that spread load over several servers. Therefore you should make sure that your web-site is prepared for massive loading. Here are some simple but important recommendations for those who want to ensure website availability during traffic surge (whether you use CDN service or not).
Know your limits
Don’t know what are the limits of your hosting plan? Contact your web hosting provider to understand the specifications of your hosting plan. Although some companies do their best to keep servers offloaded (for instance, use caching and filter requests), some certain amount of traffic still passes via your host. If you are aware of the limits of your plan, you will be able to prevent bottlenecks.
The fewer unwanted requests – the better
Some hosting and CDN providers allow blocking individual IP addresses or IPs of some regions. If you don’t want traffic from some locations, specify settings in control panel. This is especially useful for sites with certain target audience. That will both save traffic and prevent possible attacks from some regions.
Use some certain IP addresses
You can protect your server during peak season by configuring your firewall to accept traffic from provider’s IP addresses only (note that this is a temporary measure). If you accept only provider’s IPs, you will prevent malicious traffic coming to your IP.
Make sure that provider’s IPs are whitelisted
As a rule, CDN provider operates as reverse proxy to user’s website, so all connections come from its IPs. Thus, if you eventually restrict provider’s IPs, visitors may have problems when accessing your website. Include provider’s IPs in the white list.
Go beyond default caching
By default static content is cached on CDN, but you can customize the option by specifying custom Page Rules. Open Page Rules section of your account and choose “Cache everything” option (it can be done either for the entire site, or for its section). Cache Everything option allows reducing the number of times provider needs to access your origin to download cacheable items. On the same page you can alter Edge Cache Expire TTL and the Browser Cache Expire TTL to specify how long cached assets are to be stored.
Thanks to these simple tips, you will be able to have traffic under control and prevent overloading of your origin server. Don’t forget that correctly chosen CDN solutions greatly reduce the chance of site breakdown or slow work.