Project

General

Profile

Tigase Database Connections

Mohammed Azhar
Added over 2 years ago

Hi all,

I am running the tigase v7.0.3 on the EC2 instance with a PostgreSQL DB in the Amazon RDS. I have a few concerns about the DB connections

  1. Once the server is up and running i see about 21 connections established to the PostgreSQL. Is this normal? How many max connections will be established? Is there a way to limit those connections?

  2. Once the server is stopped, sometimes i could see some of the connections are not released and the process is still running. I have force kill the process then.

  3. I have a custom component (extending AbstractMessageReceiver) where i opens and keeps the connection open to the PostgreSQL. is there a callback on the component once it stops where i could close and release that connection.or else what is the best way to close it.

I appreciate any help from you guys.

Thank you.


Replies (1)

Added by Wojciech Kapcia TigaseTeam over 2 years ago

Mohammed Azhar wrote:

  1. Once the server is up and running i see about 21 connections established to the PostgreSQL. Is this normal? How many max connections will be established? Is there a way to limit those connections?

Tigase XMPP Server uses connection pool when accessing the database. In version 7.0.3 the default value was 10 (and in latest versions this depends on the hardware specification of the machine on which Tigase is running). You can configure it with following properties:

--auth-repo-pool-size

--data-repo-pool-size

--user-repo-pool-size

Number of connections looks ok (and I guess it includes this 1 connection that you open).

  1. Once the server is stopped, sometimes i could see some of the connections are not released and the process is still running. I have force kill the process then.
  • How do you stop the server?

  • Can you check what's bocking the shutdown? Which thread or accessed resource?

  • Does it happen with your custom component disabled?

  1. I have a custom component (extending AbstractMessageReceiver) where i opens and keeps the connection open to the PostgreSQL. is there a callback on the component once it stops where i could close and release that connection.or else what is the best way to close it.

First of all - you should use tigase.db.RepositoryFactory when accessing the database - it makes it easier to handle connections.

As described in Component Startup Sequence there is start() and stop() methods available (i.e.: @tigase.server.AbstractMessageReceiver#stop@)

    (1-1/1)