High Traffic Websites Problems to Consider — SwiftERM

David Swift
3 min readJan 25, 2021

Choosing the right CDN is a good idea if your site hosts content or media with a frequent number of viewings. Since this content doesn’t change, it can be successfully cached without becoming outdated. The reduced latency decreases page load times to give users the content they want as quickly as possible.

Choose a CDN with servers in the areas where the majority of your visitors come from. You can determine your site’s reach by checking analytics reports and assessing the origin of your traffic. If your site has a fairly large audience, a global CDN solution is your best bet. Read more about how exactly a CDN works.

File compression is another way to cut down on content delivery times. Many high traffic websites enable Gzip Compression to reduce file sizes during retrieval and delivery. Gzip works by searching for duplicate strings within a file and then replacing the second string with a pointer to the previous string. The user’s browser then unzips the file and displays the page. Using this method can reduce file sizes by 70 percent, resulting in a significant increase in load speeds. Some hosting providers enable Gzip as part of their hosting packages for high traffic users, however, can also be done manually.

Other tools are available to decrease the size of JavaScript and CSS files, including:

These tools remove redundant characters and unnecessary spaces from code and compress the script files to speed up delivery. If your site includes a lot of custom scripting, minifying the code can greatly improve load times.

Every time visitors come to your site, their browsers store components of the pages, including content and scripting. A lot of this content remains static or is uniform across the site and doesn’t need to be requested repeatedly in order to display. Caching these types of content eliminates a large number of requests between browsers and servers.

Using a CDN is one way to improve the caching of your static assets, however, there are also other caching methods which can be used. If you use WordPress, plugins such as Cache Enabler or Cachify combine different techniques to optimize content loading.

You can also leverage browser caching by updating the expires header for files. Depending upon the current time interval that is defined for each static file type, this can potentially be increased in order to improve caching efficiency. For content updated occasionally but with less frequency than dynamic elements, the expires header can be set for a longer interval so that the page only refreshes when necessary.

An example of setting the expires headers in your .htaccess file would resemble the following.

ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 1 month"

Similarly, for Nginx users, the following example shows a quick configuration you can use to define the expires headers for certain file types.

Malicious attacks can put your website out of commission without warning. Distributed Denial-of-Service ( DDoS) attacks are particularly vicious and take advantage of the effects of high amounts of page requests to reduce site speeds. These attacks slam your site with requests from multiple IP addresses with the intent of overloading it.

Originally published at https://www.swifterm.com on January 25, 2021.

--

--

David Swift

SwiftERM hyper-personalisation SaaS for ecommerce email marketing.