Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

5

minify Js and Css Files Optimizing Download of webclient

By
Nhomar Hernandez
on 9/1/13, 10:04 PM 4,548 views

Hello.

1.- Where is.

Every time we declare a new library, in OpenERP it is downloaded evry time the client refresh itself, where is the algorithm of join the Js and Css file in the core to see if it can be cached/improved in some way I can not find them.

2.- Caching.

There is some configuration special, to avoid reload all the client reading all files that controllers generate and be sure openerp read the cached ones?

The problem to solve is that the first load expend a lot of time and in some enviroments where the internet is not good enought it is really painful.

Regards.

Thanks Oliver.

As always. Great answer... seeing a way to improve our deployments with this information.

REgards.

Vauxoo S.A. de C.V., Nhomar Hernandez
on 9/9/13, 6:02 PM
7

Olivier Dony (odo)

--Olivier Dony (odo)--
2112
| 7 6 7
--Olivier Dony (odo)--

 

Olivier Dony (odo)
On 9/2/13, 2:36 PM

The web client uses the standard ETag HTTP header to enable browsers to properly cache the minified version of all the JS, CSS and QWeb files used by the web client. This is handled by the /js, /css and /qweb controllers, which will return an empty 304 Not Modified response if the cached file is fresh enough, saving the bandwidth. This was introduced in OpenERP 6.1 at this revision.

You can watch this mechanism in action using the Network tab of your browser's debugging tools (For Chrome): when the server returns the minified file it also sends an ETag header with the checksum of the minified files. Later when your browser tries to reload this file it will send an extra If-None-Match header when with the ETag value of the cached file. If the checksum has not changed (no file was modified/added), the response will be an empty 304 Not Modified, otherwise a normal 200 with the file contents and the new ETag header.

Note that in debug mode there is no minification of the source files, so you may easily compare both situations.

It is important to force a new download of the minified bundle as soon as any of the underlying files is modified/added, otherwise the web client will not work as expected, obviously.

In terms of bandwidth the minified version should take roughly half the size of the typical plain source, and if you really want to save on bandwidth you should really deploy OpenERP behind an nginx reverse-proxy with gzip compression enabled. This will make a big difference for slow links.

You are the best Olivier! It would be very helpful an updated "official" guide on nginx + multicore setup for v7 and trunk... similar to https://doc.openerp.com/trunk/server/deployment-gunicorn/

Mario Arias Badila
on 9/3/13, 4:58 AM

Brilliant! Many thanks!

Cameron
on 9/12/13, 8:07 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/1/13, 10:04 PM
Seen: 4548 times
Last updated: 10/11/16, 10:05 AM