[SR-Users] Kamailio delayed reponse in case of database load

Ali Taher ataher at vanrise.com
Tue Dec 10 16:44:33 CET 2019


It normally takes few milliseconds to execute the query.

The issue is occurring only at specific times where another application is inserting data into routing tables (not the live tables used by Kamailio, which will be swapped later to the live tables) , where 300 CPS is flowing into kamailio.

Ali Taher

From: sr-users <sr-users-bounces at lists.kamailio.org> On Behalf Of David Villasmil
Sent: Tuesday, December 10, 2019 5:04 PM
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Subject: Re: [SR-Users] Kamailio delayed reponse in case of database load


Have you checked yourself how long PGSQL takes to answer a query from a different host?
This really doesn't seem Kamalio-related, but PGSQL-related.


David Villasmil
email: david.villasmil.work at gmail.com<mailto:david.villasmil.work at gmail.com>
phone: +34669448337

On Tue, Dec 10, 2019 at 12:41 PM Ali Taher <ataher at vanrise.com<mailto:ataher at vanrise.com>> wrote:

I have Kamailio installed as SIP redirect for an SBC to make routing decisions.
I’m using SQLOps module with postgresql 11.5 where I have multiple tables containing each around 6M record of routing codes:
Code       options
392342  sup1|sup2|sup3

Where code field is of prefix_range data type and has a gist index.
I’m sending traffic of 300 CPS to SBC which is forwarding it to Kamailio, and Kamailio respond with 300 multiple choice with the routing decision.
In normal cases, everything is going smoothly where Kamailio repsonds up to 50 ms.
But during the process of loading data to the routing tables, Kamailio response to SBC is dramatically delayed , where for some calls it takes up to 7 seconds to respond.
Noting that during this process the data are loaded to staging tables and not to live tables used by Kamailio.
Kamailio is installed on a VM with 32GB RAM and 16 vcores.
Following configuration is used in Kamailio:

following are the customized parameters in postgresql.conf
max_connections = 100
shared_buffers = 8GB
effective_cache_size = 24GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 5242kB
min_wal_size = 1GB
max_wal_size = 2GB
max_worker_processes = 16
max_parallel_workers_per_gather = 8
max_parallel_workers = 16

Kamailio (SER) - Users Mailing List
sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191210/69eb87a8/attachment.html>

More information about the sr-users mailing list