Skip to content

SQL Server

Lime CRM uses Microsoft SQL Server as database.

Configuration

Each Lime Application on a Lime Server can have different connection details.

They can be configured as follows:

database:
    # Should database info from registry be cached
    cache_databases_in_registry: True
    # Switch if database info should be loaded from registry or
    # application.yaml. This setting is ignored on UNIX
    load_databases_from_registry: True
    engine:
        pool_size: 20
        max_overflow: 5
        pool_pre_ping: true
        isolation_level: READ UNCOMMITTED

pool_size

Sets the number of available connections in the connection pool. This is the maximum number of connections that will be kept persistently in the connection pool.

It is not possible to disable the pool by setting the pool_size to 0.

max_overflow

Defines how many additional connection, on top of pool_size, that can be active. This means that the maximum number of active connections per process is pool_size + max_overflow.

Note that services using multiprocessing, such as having uWSGI as the webserver, means the maximum number of connections has to be multiplied by the process count. For example, each worker processes forked from the uWSGI main process will have its own connection pool. Lime CRM normally uses 2 worker processes when running uWSGI and a pool size of 10 will show up to 20 persistent connections on the database server.

pool_pre_ping

Performs a simple SELECT 1 when a connection checked out from the pool to ensure it is still alive. If it fails the connection is quietly re-established.

When disabled, checking out a dead connection will instead give an error the first time it is used.

isolation_level

The isolation level defines how, and if, users can access the same data at the same time.

The default value, READ UNCOMMITTED, defines that statements can read rows that have been modified by other transactions but not yet committed.

More information about isolation levels can be found on Microsoft Learn.