Still investigating the issue, using the debug_sql, I notice that the connection is correctly open and release - my script is doing what is expected:
Which explain why the max_db_handle setting is not affecting the number of connections opened in postgres,
During the start of sipp it works as expected I don't see more than 3 open connections to postgresql but during the increase of new stablished calls, it starts to open more connections to postgresl and don’t re-use the open handlers. I can’t find out why...
And freeswitch db_cache status: (for sofia I use a different connection than the used for lua script)
**************
2021-03-29 11:17:45
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 14296
Flags: Unlocked, Detached(0)
Creator: mod_callcenter.c:609
Last User: src/switch_console.c:253
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 13359
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 7333
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 1020
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 42779
Flags: Unlocked, Detached(0)
Creator: mod_callcenter.c:609
Last User: sofia_glue.c:2833
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 13398
Flags: Unlocked, Detached(0)
Creator: sofia_glue.c:2833
Last User: mod_callcenter.c:609
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3469
Total used: 5
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2833
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3471
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3471
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3471
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3471
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3471
Total used: 1
Flags: Locked, Attached(1)
Creator: src/switch_core_sqldb.c:2276
Last User:
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3471
Total used: 3
Flags: Locked, Attached(1)
Creator: src/switch_core_sqldb.c:3636
Last User: src/switch_core_sqldb.c:2276
13 total. 7 in use.
**************
2021-03-29 11:17:46
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 14725
Flags: Unlocked, Detached(0)
Creator: mod_callcenter.c:609
Last User: src/switch_console.c:253
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 13580
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 7402
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 1027
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 42823
Flags: Unlocked, Detached(0)
Creator: mod_callcenter.c:609
Last User: sofia_glue.c:2833
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 13408
Flags: Unlocked, Detached(0)
Creator: sofia_glue.c:2833
Last User: mod_callcenter.c:609
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3470
Total used: 5
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2833
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 1
Flags: Locked, Attached(1)
Creator: src/switch_core_sqldb.c:2276
Last User:
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 3
Flags: Locked, Attached(1)
Creator: src/switch_core_sqldb.c:3636
Last User: src/switch_core_sqldb.c:2276
13 total. 7 in use.
**************
2021-03-29 11:17:47
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 8
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 16
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 18
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 18
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 13
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 8
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 0
Total used: 15211
Flags: Unlocked, Detached(0)
Creator: mod_callcenter.c:609
Last User: src/switch_console.c:253
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 13747
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 7485
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/postgresql/ user=postgres dbname=cmcore",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 1035
Flags: Unlocked, Detached(0)
Creator: freeswitch_lua.cpp:371
Last User: freeswitch_lua.cpp:371
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 42864
Flags: Unlocked, Detached(0)
Creator: mod_callcenter.c:609
Last User: sofia_glue.c:2833
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 1
Total used: 13426
Flags: Unlocked, Detached(0)
Creator: sofia_glue.c:2833
Last User: sofia_glue.c:2833
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3472
Total used: 5
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2833
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3474
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3474
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3474
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3474
Total used: 2
Flags: Locked, Attached(1)
Creator: sofia_glue.c:2602
Last User: src/switch_core_sqldb.c:2276
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3474
Total used: 1
Flags: Locked, Attached(1)
Creator: src/switch_core_sqldb.c:2276
Last User:
db="host=/var/run/pgsql-fs user=freeswitch password=",type="database_interface"
Type: DATABASE_INTERFACE
Last used: 3474
Total used: 3
Flags: Locked, Attached(1)
Creator: src/switch_core_sqldb.c:3636
Last User: src/switch_core_sqldb.c:2276
19 total. 7 in use.