Details about database connection

From NetXMS Wiki
Jump to: navigation, search

Note

In 2.0, connections 1, 4 and 5 were moved to the connection pool (6).

All DB connection pool server config variables were also renamed to contain the "DB" prefix.
Example: "ConnectionPoolBaseSize" -> "DBConnectionPoolBaseSize", etc.

General info

NetXMS creates the following database connections:

ID Name Description
1 Bootstrap / general purpose connection A single persistent dedicated connection

Used as an initial connection to retrieve other settings from DB. Also used minimally during server run-time.

2 idata writer A single persistent dedicated connection

Used to write collected data for each DCI

3 raw_dci_values writer A single persistent dedicated connection

Used to write raw last collected value for each DCI

4 Syncer thread writer A single persistent dedicated connection

Used by the syncer thread to write object changes to the DB

5 Database writers Used for delayed writes other than DCI data

Persistent connections - number controlled by "NumberOfDatabaseWriters" server config variable

6 DB connection pool Everything else

Connection pool controlled by "ConnectionPoolBaseSize" and "ConnectionPoolMaxSize" server config variables

All data that needs to be written to a database is first put into an in-memory queue.
Database writers then pick up records from the queue and write them into the database.

Monitoring database connections

You can monitor the amount of records inserted into each queue and also the size of each queue.

Database writer counters - these count the total database writer queue insertions.

ID Internal DCI name
2 Server.DBWriter.Requests.IData
3 Server.DBWriter.Requests.RawData
5 Server.DBWriter.Requests.Other

You can then use DCI delta calculation to get the number of per second or per minute queue insertions.

Database writer queue size - these give you average queue size for the last minute.

ID Internal DCI name
2 Server.AverageDBWriterQueueSize.IData
3 Server.AverageDBWriterQueueSize.RawData
5 Server.AverageDBWriterQueueSize.Other