Performance Suggestions M4

From Kolmisoft Wiki
Jump to navigationJump to search

M4 Performance Tuning

Many of the settings described here will improve system performance at the cost of usability.


Use SSD disks for the Database! This will greatly improve performance.

Core configuration settings

There are several M4 configuration settings that may improve performance. These settings must be set in /etc/m2/system.conf. M4 Core restart is required when you change these settings.

cdr_batch_size = x

Here x is how many CDRs should be stored in a buffer before M4 Core inserts them into MySQL database. The default value is 30. Useful values are between 10 and 100.

It is faster to insert CDRs in batches but the bigger the batch size the less frequently CDR will be inserted to the database.

cdr_flush_time = x

Here x is how often to flush CDR batch to MySQL database (in seconds). The default value is 5 seconds. Useful values are between 1 and 60.


show_debug = 0
show_notice = 0
show_warning = 0
show_error = 0

These variables will disable M4 Core logging and thus decreases the load on HDD/SSD. If warnings and errors are important, you may leave show_warning = 1 and show_error = 1.

balance_check_period = x

Here x is how ofter to check the balance for active calls. The default value is 1 (check every second). You may set this value to higher (let’s say check every 5 seconds) but then there is a risk that calls may last 5 seconds longer than balance allows. This is not a problem if you have set a very high balance for your clients and you are not worried about balance going too low. In that case, you may set even higher value for balance check. Note that balance check is used only to prevent balance from dropping lower than the balance limit is set to. Call billing does not depend on this variable and will be accurate in all cases.

active_calls_check_period = x

Here x is how often to refresh active call information. The default value is every 5 seconds. You may increase this value to decrease the load on the database.

log_only_last_cdr = 1

M4 Core creates CDR for each call attempt through Terminators. If you enable log_only_last_cdr then only the last attempt will be stored to the database. This way CDR inserts will be less frequent and the database will be smaller.

do_not_log_system_cdrs = 1

If this setting is enabled then FAILED calls with HGC >= 300 will not be stored to the database. This will slightly improve performance by having a smaller database and less frequent inserts to the database.

do_not_log_failed_cdrs = 1

If this setting is enabled then only answered calls will be stored in the database. This will slightly improve performance by having a smaller database and less frequent inserts to the database.

disable_advanced_routing = 1

If you are not using advanced routing (routing by quality) you may disable this feature as it passively stores data required for advanced routing (even if you have not configured advanced routing in GUI).

M4 GUI configuration settings

Call limit/capacity

Enable limits if you really need them. If you don’t need concurrent call limits, set them to 0. If call limits are enabled, M4 Core has to count concurrent calls for User/Device and this takes system resources.

Failover Routing Group

M4 Core has to retrieve all required information for Failover Routing Groups (dial peers, terminators, rates) before the call is even made. If you use Failover Routing Groups, try to make them as small as possible (few dial peers and few terminators).

Destination mask in Dial Peer settings

Destination mask Lithuania% is much faster than %Lithuania%. Try to avoid wildcard % in front of the name.

Archived calls

Use the archive calls feature to keep your database small. Queries run faster on smaller databases.

Bypass Media in Connection Point settings

When set, the media (RTP) from the originating endpoint is sent directly to the destination endpoint and vice versa. The signaling (SIP) for both endpoints still goes through M4, but the media is point-to-point.

Enable this setting if you are sure that both Originator and Terminator use the same codec. This will greatly improve RPTEngine performance as the switch no longer has to process media data.