news / Developer

Configuring Koo for maximum performance

Configuring Koo for maximum performance

There's nothing new in this blog post, but it will be useful to anyone who wants to try or deploy Koo.

In order to make Koo fly, you'll need two server modules: pyro and koo. Let's see how they can be installed and how they should be configured for the best results.

Pyro

The pyro module is very easy to use. You can download it from the usual location. Once it is on your server, you only need to install it in a database.

From then on, every time you start that database, the Pyro protocol will be available on port 8071.

It is important to note that you need to start the server with that database in order for Pyro to be available. You will need something like this:

bash ./openerp-server.py -d "database_with_pyro_installed"

Otherwise, you will need to log in to the database using another protocol before the service becomes available.

It is possible to change the port on which the module listens by adding the following line to the OpenERP server configuration file:

ini pyroport = 4500

Installing this module and using it in Koo will provide a significant performance boost by itself. You need to select the protocol using the Change button in the login dialog.

The improvement is especially noticeable on slow networks—or, more precisely, networks with high latency—such as ADSL or 3G.

It is also worth using on a LAN, even when there are no apparent performance problems, because it gives users a noticeable sense of immediacy.

Koo

Like pyro, the koo module can be downloaded from the usual location.

Simply installing the module, without any additional configuration, already provides benefits to Koo.

In some cases, users may try to sort a list view using a field that cannot be sorted, usually because it is a functional field that does not exist in the database.

Without the koo module, Koo has no way of knowing this in advance and will simply attempt to sort the list. When it receives an exception from the server, it ignores it and informs the user that the field cannot be used for sorting.

The problem is that current OpenERP versions can take a long time to return an exception, which may make Koo unusable in some circumstances.

So remember: at the very least, install the module if you intend to use the Koo client.

Another advantage obtained simply by installing the module is the storage of view settings on a per-user basis.

This means that the following information is stored on the server and restored the next time the user opens the view:

  • The order and width of columns in list views.
  • The last location used to open a file from a binary field.
  • Cookies received while browsing the web through an embedded web field.

However, this blog post is about Koo performance, so let's see how it can be tuned to run much faster.

You will need to create a new entry in the Koo Settings dialog, located at:

text Administration → Configuration → Koo → Settings

Koo Settings dialog

Koo Settings Dialog

Allow client caching

If you are concerned about performance, you will probably want to enable Allow Client Caching.

This allows Koo to keep views, actions and other information in memory, so the server only needs to be queried once.

You can configure which views should not be cached at:

text Administration → Configuration → Koo → View Cache Exceptions

This can be useful because some views may be altered by user input. Excluding them from the cache avoids requiring users to select User → Clear Cache every time they make a change affecting the view.

This is the case with the partner view, where users can change the available company or contact titles at:

text Partners → Configuration → Titles

The appropriate configuration depends on your needs. We do not usually add any exceptions because the performance improvement provided by cached views is quite significant.

Limit

Another setting you may want to adjust is Limit.

This tells Koo how many records it should load at once.

In some cases—for example, list views containing fields that are slow to process—you may see an improvement by lowering this value.

However, the value should not be lower than the number of rows that fit on the screen. Otherwise, Koo will make two server calls whenever a list view is opened, making the problem worse instead of improving it.

The default value is 80.

Sorting mode

In some cases, you may want to set Sorting Mode to visible items only.

This makes Koo behave more like the GTK client, loading only the number of records specified by Limit, instead of making all records available to the user.

We never use this setting ourselves, and very good results can be achieved with the default All Items option.

Requests refresh interval

In some cases, you may also want to set Requests refresh interval to 0.

This disables the requests Koo makes to update the information displayed in the status bar.

Assigning settings to roles

Once you have configured all the desired settings, you need to assign them to one or more roles.

This is something we will probably improve in the future. For now, I recommend assigning the settings to only one role and assigning that role to the user.

If you created the settings for your own user, you will need to log out and log back in before the changes take effect.

I hope this clarifies how to configure Koo for a production environment!