Get a faster web site

 

Slow web sites are irritating, decreases revenue and productivity. Our web platform is therefore designed to be very, very fast.
With an optimal configuration in our cloud, your start site will be rendered by the browser after 1ms for http-pages and 4ms for https-pages.


PHP / dynamic content

1. Is the same content viewed by all / most users ?
Make sure you do not set any cookies as the WebCDN cache can't pre-cache your dynamic content. If you use cookies, you are nevertheless most likely in violation of GDPR without something which is equal annoying as slow pages: The infamous GDPR/cookie consent popup.
An alternative to cookies if you only need to store states is to use the web storage api. Make sure your code can handle that both cookies and web storage api is blocked by the user.
WebCDN can also be configured to ignore cookies sent by the browser. This is useful if the cookie is only used inside the browser by javascript.

2. Remove pragma/cache-control- and expire-headers which disables caching. WebCDN will figure out if the content can be cached or not.

If you run a WooCommerce store, talk to us and we can optimize caching for it. Many plugins behave irrational when it comes to optimisation.
If you run other types of portals with a login, make sure cookies are used after you login. You might also want to explicitly set cache-control headers for cachable-content after login/cookie is set.

3. Make sure your service works with the newest PHP-version 8.1.
WebCDN runs the newest PHP-version by default, but some customers have configured for older versions due to compability issues.
Running an up-to-date PHP-version will make sure the site runs as fast as possible.

Static content

You don't need to do much in order to get an optimal configuration. Static content is pre-cached and compressed by WebCDN as default.
For javascript files you may minify your files, but it doesn't increase performance much unless you have huge 5mbyte+ files. And if you do have huge javascript files, you should consider reducing it as huge js-files is quite often considered bloatware.
Don't try to compress image resolution too much. Most monitors today is 4-5k and your web site will look bad with low resolution images. Use a modern image format instead, like AVIF.
If you point images to a .jpg-file and the web browser support .avif, WebCDN will check if the file .jpg.avif exists and use that instead of .jpg. This could boost your web site substantially.

Third party content

Using third party CDNs to host your content, like javascript, images or video, will slow down your web site and decrease your uptime. Static files never cause performance issues.
Make sure all content is hosted on your own site, including video files. For video files, use the <video> HTML tag instead of Youtube or similar. Do not install software or plugins telling you how to improve performance or speed up your site.
They are usually always wrong, makes your web site slower and can additionally cause issues related to security, stability and uptime.


CSP Content-security-policy
Some CMS plugins attempt to load resources on third party sites. This is both unsecure, increases risk of code injection and hacking, may violate your DPA / GDPR / privacy policy and will slow down your web site.
WebCDN enforces 2 solutions to prevent malicious behaviour from such plugins

  1. WebCDN can enforce a no-third-party / content-security policy on web sites to prevent the web site from loading resources and communicating with foreign locations.
  2. WebCDN supports WAF Web Application Firewall which will also prevent script code running on the webserver from loading third party resources. The WAF operate a whitelist of hostnames.



Tracking / plugins

All advanced plugins designed to track the user will reduce the performance if your web site. Tracking is also blocked by default in most browsers.



Database queries

The less queries a web page does, the faster a dynamic page will load.
If you are doing many db queries to render a single page you can save significant amount of loading time if you join as many queries as possible into a single query. You can also use union all queries. Also make sure your page is using indexed queries.

Many CMS-systems are poorly designed for optimal database queries. WordPress is one of them, and you usually can't do much about this. It is therefore important that WebCDN can cache the page for you.

.htaccess

If you are still relying on this file, you need to stop. Htaccess will slow down any system because it needs to be parsed for every single request.
If you need a catch-all fall back page, this is already configured with WebCDN. The root /index.php will always be executed as fallback, and you can use the environment variable REDIRECT_STATUS to check if the user hit a 404/non-existant page.

Relative URLs

Although not very important for fast page load, use relative URLs (/folder/picture.jpg) and not absolute URLs (https://example.com/folder/picture.jpg) when creating HTML content.
Using absolute URLs quickly becomes a total mess when dealing with multiple subdomains.