Help

4

Is it useful to use Varnish, Nginx, and ngx_pagespeed with Odoo v8?

Avatar
Luke Branch

I'm interested to know if anyone has any insight on whether or not using the Nginx version of Google's pagespeed module (https://github.com/pagespeed/ngx_pagespeed) would be useful in an Odoo v8 CMS/E-commerce implementation and whether or not it would affect the backend functionality or performance in a negative way.

From my understanding certain applications/modules such as Varnish, Nginx, HAProxy and Pagespeed theoretically should work with Odoo's own built-in webserver and with the correct configuration all of these applications could be used to enhance the performance of Odoo (eg. Varnish serving cached objects such as css, js, images, and html from RAM).

I'm looking to do a test implementation of Odoo v8 with all of the above applications installed and configured as I would with a Magento instance as well as running an identical implementation of Odoo v8 minus the above applications (Nginx, Varnish, Pagespeed) to benchmark the performance and see if there are changes that need to be made to the configuration. I'll post back here with what I discover, however if anyone has any insight on using these applications in combination with Odoo/OpenERP v7 or the master branch (v8 alpha) I would be interested to hear back on what you have found when implementing any of these applications on an Odoo instance.

Odoo's performance is already pretty good, i'm just interested in using the tools I know for optimising Magento to make Odoo implementations that I setup in the future operate as quickly and efficiently as possible in regards to frontend performance.

9 Comments
Avatar
Discard
Avatar
Shimon
-

Let us know what you deciding on doing!!

Avatar
Ben Bernard
-

varnish doesn't support https. And varnish behind nginx is not a good idea. Anyhow, I look forward for the benchmark and willing to help.

Avatar
Luke Branch
-

Hi Shimon, I'll post back here as soon as I have a config that's working well with details of what I have found.

Avatar
Luke Branch
-

Hi Ben, I'm thinking of using Pound (http://www.apsis.ch/pound) with Varnish for SSL support. Have you had any experience with it? I may try a Pound > Varnish > Odoo setup first for testing first. I'd definitely be interested in hearing any suggestions yourself or anyone else in the forums have regarding this though. Odoo's already pretty quick, i'd just like to have the frontend serving pages as fast as possible.

Avatar
Ben Bernard
-

@Luke I never heard Pound until now. Thanks for the info. Usually I'm happy with just nginx and I never hit scalability issue. What i'm thinking to optimize odoo is from the side of python web server and Python implementation itself.

Avatar
Luke Branch
-

@Ben, Any idea what python webserver Odoo uses, or whether there is a caching layer built-in by default? I'd definitely be interested in any input you have on this as well as optimisations within the python webserver as well.

Avatar
Luke Branch
-

I believe it is based on Werkzeug (http://werkzeug.pocoo.org/), however i'm not sure what the functional differences are between the two.

Avatar
Ben Bernard
-

@Luke, between werkzeug and what? I never use the server other than the default, werkzeug. But, Odoo use wsgi standard. There is a lot of wsgi server on the internet. For example gunicorn (http://gunicorn.org/) and CherryPy (http://www.cherrypy.org/).

Avatar
Luke Branch
-

@Ben, I had read somewhere in some old forum posts regarding 6.1 that the python webserver was based on werkzeug. I was under the impression that it was a fork of werkzeug. If it is werkzeug by default this will make it much easier to work with.

1 Answer
5
Avatar
Luke Branch
Best Answer

Further to this thread I have installed Varnish in it's default configuration as follows:

1) sudo apt-get install varnish
2) sudo pico -w /etc/varnish/default and replace the contents of backend default { } with the following lines:

backend default {
    .host = "127.0.0.1";
    .port = "8069";
}

3) sudo pico -w /etc/default/varnish  and replace the following:

DAEMON_OPTS="-a :6081 \
              -T localhost:6082 \
            -b localhost:8080 \
            -u varnish -g varnish \
            -S /etc/varnish/secret \
            -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"

with this:

DAEMON_OPTS="-a :80 \
              -T localhost:6082 \
            -b localhost:8080 \
            -u varnish -g varnish \
            -S /etc/varnish/secret \
​            -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"

which will have varnish serving content on port 80 by default.

4) sudo ufw allow 80

I've done an extremely basic page speed test on webpagetest.org and found the speed between content served on port 80 (ie. varnish port) and content served on port 8069 (ie. Odoo port) and found the page load time to be around 16.5-18% faster when being passed through varnish for first time page load and between 18-18.5% faster when on the second (cached) page load.

Once I have put together a working optimised VCL for Odoo I will post back here again with the results.

2 Comments
Avatar
Discard
Avatar
Luke Branch
-

Further to this, i've just come across this python module: https://github.com/justquick/python-varnish I will try to integrate this with the varnish setup to allow for purging from within Odoo for better varnish cache management. If anyone has any suggestions please comment below.

Avatar
Anders Wallenquist
-

I have also done some basic tests with Varnish 4, without any luck. Varnish are 5 % slower than direct Odoo.