A production instance is expected to handle a significant workload. By default, the server runs one process and can use only one CPU core for processing, because of the Python language GIL. However, a multiprocess mode is available so that concurrent requests can be handled. The option workers=N sets the number of worker processes to use. As a guideline, you can try setting it to 1+2*P, where P is the number of processors. The best setting to use needs to be tuned for each case, since it depends on the server load and what other load intensive services are running on the server, such as PostgreSQL.

It is better to set workers too high for the load than too low. The minimum should be 6 due to the parallel connections used by most browsers, and the maximum is generally be limited by the amount of RAM on the machine.

There a few limit-* config parameters to tune the workers. Workers are recycled when they reach these limits—the corresponding process is stopped, a new one is started. This protects the server from memory leaks and from particular processes overloading the server resources.

The official documentation already provides good advice on the tuning of the worker parameters, and you may refer to it for more details, at https://www.odoo.com/documentation/10.0/setup/deploy.html.

If you are using an older operating system, such as Debian 7, Ubuntu 15.04, or even 14.04, chances are that your system is sysvinit on Upstart. For this purpose, both should behave the same way. Many cloud VPS services are still based on Ubuntu 14.04 images, so this might be a scenario you may encounter when deploying your Odoo server.

Many cloud VPS services are still based on Ubuntu 14.04 images, so this might be a scenario you may encounter when deploying your Odoo server.

The Odoo source code includes an init script used for the Debian packaged distribution. We can use it as our service init script with minor modifications, as follows:

$ sudo cp /home/odoo/odoo-10.0/debian/init /etc/init.d/odoo
$ sudo chmod +x /etc/init.d/odoo

At this point, you might want to check the content of the init script. The key parameters are assigned to variables at the top of the file. A sample is as follows:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin 
DAEMON=/usr/bin/odoo 
NAME=odoo 
DESC=odoo 
CONFIG=/etc/odoo/odoo.conf 
LOGFILE=/var/log/odoo/odoo-server.log 
PIDFILE=/var/run/${NAME}.pid 
USER=odoo 

These variables should be adequate and we will prepare the rest of the set up with their default values in mind. But of course, you can change them to better suit your needs.

The USER variable is the system user under which the server will run. We have already created the expected odoo user.

The DAEMON variable is the path to the server executable. Our actual executable to start Odoo is in a different location, but we can create a symbolic link to it:

$ sudo ln -s /home/odoo/odoo-10.0/odoo-bin /usr/bin/odoo
$ sudo chown -h odoo /usr/bin/odoo

The CONFIG variable is the configuration file to use. In a previous section, we created a configuration file in the default expected location: /etc/odoo/odoo.conf.

Finally, the LOGFILE variable is the directory where log files should be stored. The expected directory is /var/log/odoo that we created when we were defining the configuration file.

Now we should be able to start and stop our Odoo service as follows:

$ sudo /etc/init.d/odoo start
Starting odoo: ok

Stopping the service is done in a similar way, as shown in the following:

$ sudo /etc/init.d/odoo stop
Stopping odoo: ok

In Ubuntu, the service command can also be used:

$ sudo service odoo start
$ sudo service odoo status
$ sudo service odoo config

We now only need to make this service start automatically on system boot:

$ sudo update-rc.d odoo defaults

After this, when we reboot our server, the Odoo service should be started automatically and with no errors. It's a good time to check that all is working as expected.