Optimization rules and how to configure them

Modified on Tue, 4 Dec, 2018 at 5:26 PM

Fasterize allows you to simply define the optimization rules that you want to activate and to establish any applicable exceptions. This article explains, rule by rule, how to proceed.

For each rule, it is possible to define a list of pages blacklisted (the rule will not apply to these urls) or whitelisted (this rule applies only to these url).


 

Reducing the size of resources


The size of resources can be reduced on the fly by minifying JS, CSS and HTML files and optimizing images.

Minification makes it possible to compact files by removing on the fly superfluous characters (spaces, comments ...). This optimization saves several KB which has a direct impact on loading time and bandwidth.


Minification of JavaScript, CSS and HTML files

This rule is very relevant and safe for JavaScript files. There are some cases where exceptions may be relevant.


Comments with important information


Comments are sometimes used for monitoring probes or data recovery scripts in pages.

In this case, it is possible to keep the comments during the minification by ticking a box. This option appears by clicking on the "More Options" wrench.


 

Optimization of PNG, JPEG, GIF and SVG images




 

Optimizing caching


Add a version to each static resource

Adding version to static resources provides a new unique URL for each resource during a flush by adding a version parameter. During a future navigation, the browser downloads the new URL present in the page. The referencing of the new URL causes an update of all the caches (CDN, browser, ...)


Caching non-cacheable pages for anonymous users


This rule is useful for the case of users without a session. Fasterize serves the generic page from its cache that does not contain session-specific customization. As soon as a session is established, this system is inactive.


Remove static resource settings

Random settings on static resources prevent effective caching

Specify the settings that will be deleted (one per line). Leave blank to delete all settings



 

Reduction of the number of requests

This rule allows you to combine JavaScript and external CSS files in as few files as possible. Thus, the total number of requests is reduced.

There are cases where this optimization is irrelevant.


File already very big

When a JS or CSS file, even a thin one, is still very big, it becomes superfluous to concatenate it with other files: it can be more interesting to make several requests than to make requests that are too big. In this case, the file too big can be blacklisted.

 

Optimizing the rendering of the page


CSS first

This rule optimizes display performance on the browser by moving style sheet declarations to the top of the page.

 

Delayed loading of JavaScript files

Delaying the loading of JavaScript files (which are not called at launch) reduces the size of the initial download and speeds up the rendering of the page.

Deferred loading of Javascript is the most aggressive rule and most likely to break the page, especially if pages rely on Javascript for layout. In this case, you can exclude a particular script so that its loading is not deferred:

  • by adding it to the exclusion rules by URL (blacklist)
  • adding the nodefer attribute in the script tag

Two parameters make it possible to refine the deferred loading rule of the JS files, they are accessible behind the wrench.



Limit deferred loading to external domains

Delayed loading of JavaScript files will only be applied to files coming from domains outside the domain of the page (widgets, tags, ...)


Preloading deferred scripts

Add a link tag rel = preload for each deferred script

 

Inlining

Inclusions of small images in web pages

This rule includes small images directly in the HTML code and thus saves the time of queries made for each image. This is especially important for mobile sites.

 

Delayed loading of non-visible images

Downloading only visible images saves bandwidth, queries and does not block the rendering of the page.


 

Parallel loading

Parallel loading of multiple domains without cookie

Browsers only open a limited number of simultaneous requests on the same domain. Using multiple domains bypasses this limit. No cookies are placed on the new domains.


 

Sharding

Lifts an HTTP 1.1 limit

Objective: Increase the ability to download resources in parallel bypassing the limits of browsers (in HTTP 1.1, 6 to 8 resources can be called in parallel depending on the browser).

The resources are distributed over several domains (of type s0.frz.io and s1.frz.io).

Benefits to use these areas:

  • these are domains without a cookie, which saves the sending of the cookie to each request
  • these domain names can be resolved on the Fasterize CDN or the client's CDN without complex configuration

The over-use of sharding can cause too many DNS resolutions, which has a cost to load the page.



 

Unsharding

Objective: to reduce the number of domains used to take advantage of the single connection of HTTP 2 = reduce the number of DNS resolutions and TLS negotiations.

  • Fewer DNS resolutions
  • Fewer connections to establish
  • Fewer HTTPS "negotiations"

Rewrite URLs using the domain of the page

The URLs of 'unsharded' resources will be rewritten using the domain of the page to minimize the number of DNS resolutions or to reuse the CDN of the website for external resources.

 

Custom HTML tags

Optimizing images whose source is in a custom HTML tag

Extend image optimizations to custom HTML tags


 

If a page is broken

Disabling rules

It is possible to disable rules for a given page by adding a specific parameter to the url: ?frz-[rule]=true|false

[rule] is to be replaced by the correct name. The list of rule names is available here .

 

If a page is broken because of a rule, it is possible

  • to disable the rule for this page (blacklist)
  • to exclude the page from all optimizations
  • to disable the rule for all pages

The most likely rules to break the pages are in order:

  • DeferJS: if Javascript is used to build the layout
  • Concatenation: if a syntax error JS or CSS at the end of a single file (and being hidden) is in the middle of the file via the concatenation
  • Minification: Rare Cases Where Invalid HTML Causes Errors
  • Lazyloading: rare cases where lazyloading already exists but has not been detected by Fasterize

In case of real concern, there is an on / off button on the dashboard that allows to stop optimizations instantly (but the traffic still goes through the platform).

More details on this page.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article