SQL queue is growing in a peaktime: Difference between revisions
(Add symptoms of database delays including 'Crontab log is too old' warning (ticket #82237)) |
(Add section on when hardware upgrade is required (CPU at 100%)) |
||
| Line 31: | Line 31: | ||
However, if the database is waiting for storage I/O, increasing the number of threads will not help. | However, if the database is waiting for storage I/O, increasing the number of threads will not help. | ||
== When Configuration Tuning Is Not Enough: Hardware Upgrade Required == | |||
If you have applied all the configuration optimizations above and the SQL queue continues to grow or the database remains significantly behind the processing queue, the underlying issue may be insufficient hardware. | |||
=== Signs That Hardware Upgrade Is Necessary === | |||
* '''CPU load is consistently at or near 100%''' on both the database and GUI servers, even during normal traffic patterns | |||
* '''Old or aging hardware''' - Servers with CPUs more than several years old may lack the performance of modern processors | |||
* '''Configuration tuning provides only marginal improvement''' - After applying MySQL and VoIPmonitor optimizations, the delay between the "Last CDR in processing queue" and "Last CDR in database" remains significant | |||
=== Diagnosing Hardware Limitations === | |||
Monitor CPU usage on both the database and GUI servers: | |||
<syntaxhighlight lang="bash"> | |||
# Check CPU load during peak traffic | |||
top | |||
# Or use sar for historical data | |||
sar -u 1 10 | |||
# Check CPU core usage per process | |||
mpstat -P ALL 1 5 | |||
</syntaxhighlight> | |||
If the CPU load is consistently at or near 100% across multiple cores, the hardware cannot keep up with the traffic load. No amount of configuration tuning will solve this issue - the servers themselves need to be upgraded. | |||
=== Hardware Upgrade Recommendations === | |||
Upgrade to a more modern CPU architecture with significantly better performance: | |||
* '''CPU''' - Modern AMD EPYC or Intel Xeon Gold/Silver processors with more cores | |||
* '''RAM''' - Ensure sufficient memory for the database buffer pool (see [[Scaling#Memory_Configuration|Memory Configuration]]) | |||
* '''Storage''' - Use NVMe SSDs for the database to eliminate I/O bottlenecks | |||
=== Architecture Consideration: Merge GUI and Database === | |||
In some cases, merging the GUI and database roles onto a single, powerful new server can be more efficient than maintaining separate, underpowered servers. A single modern server with sufficient CPU cores and RAM can often handle both workloads more effectively than multiple older servers. | |||
For hardware sizing examples, see the [[Hardware]] page, which includes real-world deployments for various call volumes. | |||
== AI Summary for RAG == | |||
'''Summary:''' This page explains the delay between Active Calls view and CDR view, which occurs when the database cannot keep up with CDR insertion rates. Symptoms include slow CDR appearance, "Crontab log is too old" warning, lag between call end and reporting. The SQLq/SQLf metric indicates queue size before CDRs are pushed to the database. Configuration fixes include: ensuring MySQL config follows recommendations from Scaling page (especially innodb_flush_log_at_trx_commit and innodb_buffer_pool_size), increasing database connection threads via mysqlstore_max_threads_cdr and mysqlstore_max_threads_sip_msg in voipmonitor.conf. CRITICAL: If CPU load is consistently at or near 100% on database/GUI servers even after configuration tuning, this indicates insufficient hardware and requires hardware upgrade. Monitor CPU usage using top, sar, or mpstat. Upgrade to modern AMD EPYC or Intel Xeon Gold/Silver with more cores, sufficient RAM for buffer pool, and NVMe SSD storage. Consider merging GUI and database onto a single powerful server instead of maintaining separate underpowered servers. See Hardware page for sizing examples. | |||
'''Keywords:''' SQL queue, SQLq, SQLf, delay, active calls, CDR, database bottleneck, mysqlstore_max_threads_cdr, mysqlstore_max_threads_sip_msg, innodb_flush_log_at_trx_commit, innodb_buffer_pool_size, Crontab log, hardware upgrade, CPU 100%, aging hardware, inadequate hardware, server upgrade, modern CPU, AMD EPYC, Intel Xeon, NVMe SSD, merge GUI and database, insuff hardware limit, configuration not enough | |||
Revision as of 05:09, 6 January 2026
Delay between active call and cdr view
The Active Calls view in the GUI displays the timestart of a calls(INVITEs) obtained from the VoIPmonitor sniffer service, whereas the CDR view shows the stored CDRs (after the call ends) from the database.
Symptoms of Database Delays
When the database cannot keep up with CDR insertion rates, you may experience:
- Slow CDR appearance in GUI - New calls take minutes to appear after they end
- "Crontab log is too old" warning - The cron job runs slowly (every 5-10 minutes or more) instead of every minute due to database overload
- Lag between call end and reporting - Daily reports and alerts process outdated data
To diagnose cron-related delays specifically, see "Crontab log is too old" troubleshooting.
SQLq/SQLf
In the service status (expanded status, status line) under GUI -> Settings -> Sensors : status, the SQLq/SQLf values represent the size of the queue before the CDRs are pushed to the database. When SQLq/SQLf is high, it usually indicates that the database is unable to process requests in a timely manner, causing them to queue. Logging#SQLq/SQLf
Make sure that db config is not causing io overhead
If the MySQL configuration already follows the recommendations from the scaling section of our documentation (especially innodb_flush_log_at_trx_commit and innodb_buffer_pool_size):
https://www.voipmonitor.org/doc/Scaling#SSDs
More threads/connections to a db
you can also increase the number of threads used for connection to a db for particular use like CDRs - the VoIPmonitor sniffer service in /etc/voipmonitor.conf uses the option
mysqlstore_max_threads_cdr = 4
If you are processing a high volume of SIP OPTIONS, SUBSCRIBE, or NOTIFY messages and see the sip_msg queue growing, you can increase threads specifically for those messages:
mysqlstore_max_threads_sip_msg = 4
However, if the database is waiting for storage I/O, increasing the number of threads will not help.
When Configuration Tuning Is Not Enough: Hardware Upgrade Required
If you have applied all the configuration optimizations above and the SQL queue continues to grow or the database remains significantly behind the processing queue, the underlying issue may be insufficient hardware.
Signs That Hardware Upgrade Is Necessary
- CPU load is consistently at or near 100% on both the database and GUI servers, even during normal traffic patterns
- Old or aging hardware - Servers with CPUs more than several years old may lack the performance of modern processors
- Configuration tuning provides only marginal improvement - After applying MySQL and VoIPmonitor optimizations, the delay between the "Last CDR in processing queue" and "Last CDR in database" remains significant
Diagnosing Hardware Limitations
Monitor CPU usage on both the database and GUI servers:
# Check CPU load during peak traffic
top
# Or use sar for historical data
sar -u 1 10
# Check CPU core usage per process
mpstat -P ALL 1 5
If the CPU load is consistently at or near 100% across multiple cores, the hardware cannot keep up with the traffic load. No amount of configuration tuning will solve this issue - the servers themselves need to be upgraded.
Hardware Upgrade Recommendations
Upgrade to a more modern CPU architecture with significantly better performance:
- CPU - Modern AMD EPYC or Intel Xeon Gold/Silver processors with more cores
- RAM - Ensure sufficient memory for the database buffer pool (see Memory Configuration)
- Storage - Use NVMe SSDs for the database to eliminate I/O bottlenecks
Architecture Consideration: Merge GUI and Database
In some cases, merging the GUI and database roles onto a single, powerful new server can be more efficient than maintaining separate, underpowered servers. A single modern server with sufficient CPU cores and RAM can often handle both workloads more effectively than multiple older servers.
For hardware sizing examples, see the Hardware page, which includes real-world deployments for various call volumes.
AI Summary for RAG
Summary: This page explains the delay between Active Calls view and CDR view, which occurs when the database cannot keep up with CDR insertion rates. Symptoms include slow CDR appearance, "Crontab log is too old" warning, lag between call end and reporting. The SQLq/SQLf metric indicates queue size before CDRs are pushed to the database. Configuration fixes include: ensuring MySQL config follows recommendations from Scaling page (especially innodb_flush_log_at_trx_commit and innodb_buffer_pool_size), increasing database connection threads via mysqlstore_max_threads_cdr and mysqlstore_max_threads_sip_msg in voipmonitor.conf. CRITICAL: If CPU load is consistently at or near 100% on database/GUI servers even after configuration tuning, this indicates insufficient hardware and requires hardware upgrade. Monitor CPU usage using top, sar, or mpstat. Upgrade to modern AMD EPYC or Intel Xeon Gold/Silver with more cores, sufficient RAM for buffer pool, and NVMe SSD storage. Consider merging GUI and database onto a single powerful server instead of maintaining separate underpowered servers. See Hardware page for sizing examples.
Keywords: SQL queue, SQLq, SQLf, delay, active calls, CDR, database bottleneck, mysqlstore_max_threads_cdr, mysqlstore_max_threads_sip_msg, innodb_flush_log_at_trx_commit, innodb_buffer_pool_size, Crontab log, hardware upgrade, CPU 100%, aging hardware, inadequate hardware, server upgrade, modern CPU, AMD EPYC, Intel Xeon, NVMe SSD, merge GUI and database, insuff hardware limit, configuration not enough