Hello,
I have an installation using usrloc + db_mode=1.
If I want on db_mode=1 or db_mode=2 the expired contacts to be cleaned up I have to enable the modparam db_timer_clean:
https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_...
The docs say:
"*Enable (1) or disable (0) cleaning of expired db records on timer basis for db_mode WRITE-BACK and WRITE-THROUGH. It uses the secondary timer process.*"
I have the following doubts:
1- What does the reference "it uses *the* secondary timer process" mean? Is there a specific secondary timer just for this purpose? 2- Is #1 related to the modparam timer_procs? (so it uses one of those when enabled?) 3- Why/When would you need a timer_proces modparam with a value higher than "1"?
Thanks, Joel.
Hi Joel,
$ root@proxy-1:~# kamcmd ps |grep second 31314 secondary timer
Basically it makes sense to use a dedicated timer if you have a large DB and/or a DB which is not particularly fast for the expiration, to not block the core timer to long.
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Joel Serrano Sent: Thursday, February 20, 2020 1:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Understanding some usrloc modparams
Hello,
I have an installation using usrloc + db_mode=1.
If I want on db_mode=1 or db_mode=2 the expired contacts to be cleaned up I have to enable the modparam db_timer_clean:
https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_...
The docs say:
"Enable (1) or disable (0) cleaning of expired db records on timer basis for db_mode WRITE-BACK and WRITE-THROUGH. It uses the secondary timer process."
I have the following doubts:
1- What does the reference "it uses the secondary timer process" mean? Is there a specific secondary timer just for this purpose? 2- Is #1 related to the modparam timer_procs? (so it uses one of those when enabled?) 3- Why/When would you need a timer_proces modparam with a value higher than "1"?
Thanks, Joel.
Thanks, Henning.
But I thought Joel’s question about multiple processes was interesting. Is the workload somehow split up among them? If not, why have multiple ones?
— Sent from my iPad
On Feb 20, 2020, at 2:00 AM, Henning Westerholt hw@skalatan.de wrote:
Hi Joel,
$ root@proxy-1:~# kamcmd ps |grep second 31314 secondary timer
Basically it makes sense to use a dedicated timer if you have a large DB and/or a DB which is not particularly fast for the expiration, to not block the core timer to long.
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.com
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Joel Serrano Sent: Thursday, February 20, 2020 1:12 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Understanding some usrloc modparams
Hello,
I have an installation using usrloc + db_mode=1.
If I want on db_mode=1 or db_mode=2 the expired contacts to be cleaned up I have to enable the modparam db_timer_clean:
https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_...
The docs say:
"Enable (1) or disable (0) cleaning of expired db records on timer basis for db_mode WRITE-BACK and WRITE-THROUGH. It uses the secondary timer process."
I have the following doubts:
1- What does the reference "it uses the secondary timer process" mean? Is there a specific secondary timer just for this purpose? 2- Is #1 related to the modparam timer_procs? (so it uses one of those when enabled?) 3- Why/When would you need a timer_proces modparam with a value higher than "1"?
Thanks, Joel.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
the workload is split between the processes created due to param timer_procs>1. If timer_procs=0, is the primary timer that takes care of checking for and cleaning expired records.
If timer_procs=1, then a dedicated timer process is created by usrloc and this timer process is doing the cleanup job for all location records. If timer_procs>1, then the workload is split among those processes, each process gets assigned a list of slots from the internal hash table storing the location records and they do cleanup on those slots.
Cheers, Daniel
On 20.02.20 08:50, Alex Balashov wrote:
Thanks, Henning.
But I thought Joel’s question about multiple processes was interesting. Is the workload somehow split up among them? If not, why have multiple ones?
— Sent from my iPad
On Feb 20, 2020, at 2:00 AM, Henning Westerholt hw@skalatan.de wrote:
Hi Joel,
$ root@proxy-1:~# kamcmd ps |grep second
31314 secondary timer
Basically it makes sense to use a dedicated timer if you have a large DB and/or a DB which is not particularly fast for the expiration, to not block the core timer to long.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com https://gilawa.com/
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Joel Serrano *Sent:* Thursday, February 20, 2020 1:12 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* [SR-Users] Understanding some usrloc modparams
Hello,
I have an installation using usrloc + db_mode=1.
If I want on db_mode=1 or db_mode=2 the expired contacts to be cleaned up I have to enable the modparam db_timer_clean:
https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_...
The docs say:
"/Enable (1) or disable (0) cleaning of expired db records on timer basis for db_mode WRITE-BACK and WRITE-THROUGH. It uses the secondary timer process./"
I have the following doubts:
1- What does the reference "it uses */the/* secondary timer process" mean? Is there a specific secondary timer just for this purpose?
2- Is #1 related to the modparam timer_procs? (so it uses one of those when enabled?)
3- Why/When would you need a timer_proces modparam with a value higher than "1"?
Thanks,
Joel.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Thu, Feb 20, 2020 at 04:21:21PM +0100, Daniel-Constantin Mierla wrote:
If timer_procs>1, then the workload is split among those processes, each process gets assigned a list of slots from the internal hash table storing the location records and they do cleanup on those slots.
Thanks, that's good info! I've updated the usrloc docs with this if you don't mind.
Thanks Alex, Daniel and Henning!
Joel.
On Thu, Feb 20, 2020 at 7:38 AM Alex Balashov abalashov@evaristesys.com wrote:
On Thu, Feb 20, 2020 at 04:21:21PM +0100, Daniel-Constantin Mierla wrote:
If timer_procs>1, then the workload is split among those processes, each process gets assigned a list of slots from the internal hash table storing the location records and they do cleanup on those slots.
Thanks, that's good info! I've updated the usrloc docs with this if you don't mind.
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
the db_timer_clean is actually needed only you face situations when some contact records remain in the database after they expired. Normally should be deleted by the process detecting that they are deleted, however, there are some corner cases when the operation to database failed when the record in memory is removed (e.g., you restart mysql server). Over long time, if Kamailio is not restarted, but the "corner" cases keep happening, many invalid records can accumulate to database.
The "secondary" timer is from core and was added to execute the tasks that are not "real-time" critical and can take longer time to execute, to offload the primary timer system (composed by fast+slow timer processes), which is more sensitive as it takes care of retransmissions, etc ...
Many modules started to create own timer processes to offload primary timer, and that can still be useful when dealing with some heavy tasks, but for some modules, creating a dedicated timer process just to execute a lengthy task from time to time is a waste of resource, so they can use the secondary timer.
The timer_procs is not related to db_timer_clean. Set timer_procs>=1 when having to manage a lot of active contacts, no matter is just in-memory storage or together with database. For write back (sycn the db peridiocally) it would be probably better to have at least timer_proc=1, so the db sync operations are done by this timer, provided you have more than a few active contacts.
Cheers, Daniel
On 20.02.20 01:11, Joel Serrano wrote:
Hello,
I have an installation using usrloc + db_mode=1.
If I want on db_mode=1 or db_mode=2 the expired contacts to be cleaned up I have to enable the modparam db_timer_clean:
https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.db_...
The docs say:
"/Enable (1) or disable (0) cleaning of expired db records on timer basis for db_mode WRITE-BACK and WRITE-THROUGH. It uses the secondary timer process./"
I have the following doubts:
1- What does the reference "it uses */the/* secondary timer process" mean? Is there a specific secondary timer just for this purpose? 2- Is #1 related to the modparam timer_procs? (so it uses one of those when enabled?) 3- Why/When would you need a timer_proces modparam with a value higher than "1"?
Thanks, Joel.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users