For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

You are reading Travelping Open Subscriber Server 6.19, an older release. The newest release is 6.20. Read this page in 6.20

Database settings

TPOSS must be able to connect to the MySQL database during startup. The following configuration defines the database connection settings for TPOSS:

yaml

TPOSS uses the first four configuration options to connect to the MySQL database. Before TPOSS connects to the MySQL server for the first time, you must create:

  • Database name specified in database.name
  • User specified in database.user
  • User password specified in database.password

Be careful when assigning permissionsOpens in a new tab for the TPOSS database user. At minimum, the user needs permissions for all basic operations like CREATE, ALTER, SELECT, INSERT, UPDATE, DELETE, and EVENT. You can simplify this by granting ALL permissionsOpens in a new tab to the TPOSS database using the following query:

sql

If the TPOSS cluster is launched using a fresh MySQL instance, it needs to run the database migrations on the new database. For this, set the following option to true:

yaml

The size of the database connection pool is specified with the database.connections configuration option. It is recommended not to set a big number because increasing the number of connections towards the database may decrease the database performance. Also, the sum of all connections used by all TPOSS instances within the TPOSS cluster should not be bigger than the value of the max_connectionsOpens in a new tab database configuration option.

If there is no free connection in the database connection pool, TPOSS waits for a period equal to twice the value of the database.queue_target configuration option. If a connection still isn’t available after this time, the query is aborted, and TPOSS returns an error for the incoming request. Additionally, the maximum time that TPOSS waits for a database response is controlled by the database.timeout configuration option. If the database does not respond within this time, TPOSS aborts the query and returns an error.

TPOSS exposes different database metrics. You can control the behaviour of some of these metrics using the database.queue_histogram_buckets and database.query_histogram_buckets configuration options. For more information about the values for these configuration options, see Prometheus histogramsOpens in a new tab.

You can control the behaviour of MySQL client sockets in TPOSS using these configuration options:

  • Use database.recbuf to set the size of the socket receive buffer.
  • Use database.keepalive and database.tcp_user_timeout options to detect disconnects as early as possible.

If database.keepalive is set to true, TPOSS MySQL clients send TCP keepalive packets. While you can’t configure the keepalive messages interval directly through the database configuration options, you can set the security context.

Note

It is highly recommended to set the value of the database.keepalive to true. The value of the database.tcp_user_timeout is worth setting low – for example, around 1 second – to catch disconnects as fast as possible, as it may impact TPOSS performance and resource consumption.

The database.tcp_user_timeout option specifies how long (in milliseconds) transmitted data can remain unacknowledged. If this timeout is reached, the MySQL client sockets are closed.

Database health check

Important

You should configure values of the following metrics based on the regular network round-trip time (RTT) to the database server:

  • database.health_check.ping_timeout must be greater than the network RTT to avoid false-positive failures. For example, if the RTT to the database is 50ms, set database.health_check.ping_timeout to at least 100-200ms to account for network jitter and database processing time.
  • database.health_check.ping_interval determines how frequently health checks are performed. Lower values detect failures faster but may lead to false positives if the network is not stable.
  • database.health_check.consecutive_failures_threshold combined with database.health_check.ping_interval determines the total failure detection time. For example, with database.health_check.ping_interval set to 500 and database.health_check.consecutive_failures_threshold set to 3, the database will be marked unhealthy after 1.5 seconds of consecutive failures.

Measure the actual network RTT to your database server and adjust these values accordingly for your deployment environment.

TPOSS provides a database health checker process which looks for the status of connectivity to the database and the database pool. If this process sees that something is wrong with the database, it notifies TPOSS sub-systems to start rejecting any incoming requests (RADIUS, Diameter, HTTP, and CDMP) until connectivity is restored. You can control the health check process using the following configuration options:

yaml

The database.health_check.ping_interval is a time interval for which the health checker process sends a COM_PING MySQL protocol-level message to the MySQL server. Then, the health checker process waits for a response for a maximum time specified by the database.health_check.ping_timeout. If the number of COM_PING requests equals the database.health_check.consecutive_failures_threshold failed, TPOSS stops handling any incoming (RADIUS, Diameter, HTTP or CDMP) requests and marks the database as unavailable until the next MySQL COM_PING request succeeds.

In addition to the COM_PING requests, TPOSS checks the size of the queue in the database connection pool. If there are more queries in the queue than the size of the database connection pool (specified by the database.connections) multiplied by the max_queued_queries_per_connection, TPOSS stops to handle the incoming requests until the queue size is back within regular conditions.

When the database health checker sees that the connections to the database can be restored, it constantly checks the number of active connections to the database. As soon as the percentage of active connections is higher than the database.health_check.healthy_pool_ratio, the database is marked as available, and TPOSS can proceed to handle incoming requests. The value of this configuration option must be any floating point value from 0.0 to 1.0.