Enable Dark Mode!
how-to-reduce-page-size-in-odoo-website-backend-using-gzip-with-nginx.jpg
By: Muhammed Nishad

How to Reduce Page Size in Odoo Website & Backend Using Gzip with NGINX

Odoo 13 Odoo 14 Odoo 15 Odoo 16

Odoo is one of the most prominent and reliable ERP solutions of the modern era. It is equipped with a wide range of features and a strong community. One of the biggest advantages of Odoo compared to other ERP solutions is it comes with a built-in website and eCommerce solution, which is easy to set up and deploy. Having all the accounting, inventory, and subscription features integrated with the website makes Odoo, not just a great ERP solution but also a convenient eCommerce solution.

There are a lot of companies worldwide using Odoo’s eCommerce module as their primary selling platform. For an eCommerce company, their key selling points are speed, reliability, and user experience of their platform. However, in some cases, Odoo’s eCommerce has been blamed as a slow-performing solution with a great user experience. To be fair, most of the complaints are due to the mistakes in configuring Odoo. Once properly configured, Odoo eCommerce competes with the most popular and specialized eCommerce solutions like Woocommerce and Shopify. In this blog, we are going to discuss one of the easiest ways to optimize your Odoo in terms of page size and latency, which is compressing the HTTP content. 

So, if the content is compressed, how can the user see or interact with the content? One of the biggest advantages of Gzip compression is that it is supported by 99% of modern browsers including, but not limited to the below

a) Chrome (All versions)

b) Firefox 0.9.5 and above versions

c) Safari (All versions)

d) Microsoft Edge (All Versions)

Gzip is a popular tool used to compress and deliver HTTP content over the internet. It compresses the content as per the configurations provided on the server. Since it compresses the content, the bandwidth and the time used to deliver the content is a lot less than the regular method. Small data packets reach faster and in effect, reduce the latency. In this blog, we will configure Gzip with one of the popular and recommended (for Odoo) reverse proxy servers, NGINX. Let’s take a look at how we can turn on Gzip compression in NGINX.

To turn on Gzip compression, you have to give the following configuration in the Server block of the NGINX file (you can give it in the /etc/nginx/nginx.conf file as well as in the files in/etc/nginx/sites-enabled or /etc/conf.d/nginx).

gzip on;

This allows Nginx to compress the content transmitted with the default configurations. Let’s see what common configurations we can specify to change how the content is compressed.

Gzip Types

gzip_types parameter is used to set what content types are needed to be compressed. We can specify all the common content types like below

gzip_types text/css;

This configuration compresses only the CSS files. We can provide content types like text/scss text/javascript and so on, if no gzip_types are provided, NGINX will be responding with text/html content type the most favorable configuration for Odoo is below

 gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;

Gzip Min Length

The gzip_min_length directive is used to set the minimum size of content to compress; by default, the value is 20 bytes. You can update it by providing in the following example

gzip_min_length 1050;

Here, we made NGINX compress all the content with a size of 1050 bytes or more.

Gzip Compression Level

The gzip_compression_level directive defines the level of compression. The values for this directive can vary from 1 to 9, where 1 is the least level of compression and 9 is the most level of compression. By default, it is set to be 6. However, we can change it by following the example below.

gzip_comp_level 7

In summary, gzip compression helps to reduce the page size of websites and improve their efficiency. For more information, you can refer to https://docs.nginx.com/


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message