Improve /web/webclient/js browser caching

Bug #1120321 reported by Adam Bridger
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP R&D Web Team

Bug Description

openerp build: openerp-7.0-20130209-002058
browser: chrome

/web/webclient/js is >1MB and HTTP Cache-Control:must-revalidate, max-age=0. So this means every time I go to the web index page it always downloads this file.

Is there a way to improve the cache-control so that browser checks to see if the file has changed and only then downloads the file?

Can we make the default Cache-Control for this file to be more optimal?

There are quite a few other files in the /web directory which do not make use of the browser cache also.

Thanks.

Related: https://bugs.launchpad.net/openerp-web/+bug/1286668
Related: https://bugs.launchpad.net/openerp-web/+bug/1283905

Revision history for this message
Adam Bridger (adambridger) wrote :
Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
indra kurniawan (kkaite2) wrote :

same issue here branch 7.0 july 22 2013;
whenever user log out,
the whole 1.8 MB javascript code is downloaded from server. We are in Indonesia and internet speed is kinda slow.

any workarround we can do while waiting?

Thank you

Revision history for this message
Casper Madsen (maveas) wrote :

Indeed needed, especially on a VPS with limited bandwith/month.

Revision history for this message
Chang Phui-Hock (phuihock) wrote :

I know this is a bit old, but while we wait, here's what I'd suggest.

First thing that you may try is to serve OpenERP with gunicorn and use nginx as reverse proxy. Then, in your nginx.conf (/etc/nginx/nginx.conf), enable on-the-fly gzip compression. Make sure that "applications/javascript" is added to gzip_types because javascripts (like this one) are served with this mimetype, like the following:

gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

I manage to reduce the download time of webclient/js/?db=... from 17s to under 5s.

Revision history for this message
LisAndi - Andi Becker - http://lisandi.com (lisandi) wrote :

Better would be to integrate a caching mechanism into OpenERP which concatenates and compresses JS and CSS files. Right now much to much file requests are delivered so the first step would be to concatenate those scripts to one single script and than comperess them to one single css and to one single js in the header and another compressed one single js for the footer as some JS won't work if inserted in the footer.

Beside this is would be very beneficial if they would use an asynchron loading. The same is with all code inserted into the HTML like i.e. the google analytics code. This should be exchanged to the code which uses asynchron loading to improve loading times.

Here are some packaes which could be used for this:
https://pypi.python.org/pypi/crammit

I would suggest using:
https://pypi.python.org/pypi/Gears/0.6.1
https://github.com/gears/gears

Revision history for this message
LisAndi - Andi Becker - http://lisandi.com (lisandi) wrote :
description: updated
Revision history for this message
LisAndi - Andi Becker - http://lisandi.com (lisandi) wrote :

The caching problem is actually open since over one year right now. Is somebody still working on it as the GTMetrix tests are not to be satisfied at all with OpenERP Performances.

If somebody has already started working on the caching problems it would be nice if he or she could post a timeline and link us to their road map, so that we would know when it would be available in an alpha Version.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.