Skip to content
  • P. Christeas's avatar
    Release idle connections to the database · 289c775d
    P. Christeas authored and Daniel Vrátil's avatar Daniel Vrátil committed
    For Postgres, each DB client connection corresponds to a process
    being spawn and kept alive. May even mean some SHM allocated for
    it, on pre-9.3 versions of postgres.
    On a system (desktop) with many akonadi resources, we may end up
    occupying most/all available Postgres backends just keeping idle
    agents.
    This patch tries to address that, by releasing the DB connection
    for those idle agents. This comes to the expense of some wake-up
    latency (connect, setup db and prepare queries again). It is not
    limited to QPSQL DBs yet, as to explore its effects on the other
    storage engines.
    
    Note that I had to change the `DataStore::database()` API from a
    const to a regular method, because it would wake-up a connection.
    
    With the help of Daniel Vrátil <dvratil@redhat.com> , who showed
    me the way.
    
    REVIEW: 121120
    289c775d