Discussion:
[SR-Users] app_perl persistent database connection
Vik Killa
2014-09-15 15:03:08 UTC
Permalink
hello, does kamailio start/run the perl script defined by
modparam("app_perl", "filename", "/usr/local/test/bin/sips.pl") at startup
and constantly run in background?

I want a persistent database connection rather than having to constantly
re-connect to database on each transaction.
Is this possible?

I'm connecting to postgres with

use DBI;
my $dsn = "DBI:Pg:database=$database;host=$host;port=$port";
my $dbh = DBI->connect($dsn, $user, $pass) || die "Could not connect to
database: $DBI::errstr";
Daniel-Constantin Mierla
2014-09-15 15:44:31 UTC
Permalink
Hello,
Post by Vik Killa
hello, does kamailio start/run the perl script defined by
modparam("app_perl", "filename", "/usr/local/test/bin/sips.pl
<http://sips.pl>") at startup and constantly run in background?
yes.

The upcoming 4.2 has the option to reload the script (and reset the perl
interpreter) periodically.

Cheers,
Daniel
Post by Vik Killa
I want a persistent database connection rather than having to
constantly re-connect to database on each transaction.
Is this possible?
I'm connecting to postgres with
use DBI;
my $dsn = "DBI:Pg:database=$database;host=$host;port=$port";
my $dbh = DBI->connect($dsn, $user, $pass) || die "Could not connect
to database: $DBI::errstr";
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany
Vik Killa
2014-09-15 16:44:53 UTC
Permalink
Interesting but could you elaborate on how that will answer my question?

On Mon, Sep 15, 2014 at 11:44 AM, Daniel-Constantin Mierla <
Post by Daniel-Constantin Mierla
Hello,
hello, does kamailio start/run the perl script defined by
modparam("app_perl", "filename", "/usr/local/test/bin/sips.pl") at
startup and constantly run in background?
yes.
The upcoming 4.2 has the option to reload the script (and reset the perl
interpreter) periodically.
Cheers,
Daniel
I want a persistent database connection rather than having to constantly
re-connect to database on each transaction.
Is this possible?
I'm connecting to postgres with
use DBI;
my $dsn = "DBI:Pg:database=$database;host=$host;port=$port";
my $dbh = DBI->connect($dsn, $user, $pass) || die "Could not connect to
database: $DBI::errstr";
_______________________________________________
--
Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla
2014-09-15 17:09:33 UTC
Permalink
The answer to the question was: yes, after your question, in a dedicated
fhrase/paragraph. I expected you wanted to know if the perl script is
loaded at startup and then run from memory (precompiled form) at runtime
-- sparing another email to ask what you really mean by "constantly run
in background", which has different meaning in my understanding, but has
no relation with the purpose of Kamailio and its app_perl module.

The following remark (on separate paragraph) was an addition to say
that, if you need to refresh the the loaded perl script in memory, can
be done periodically if using upcoming 4.2. I added it, not strictly for
reloading the script in memory, but apparently perl was not designed for
long recursive running of scripts (or maybe developers of some libs
didn't have that in mind), resulting in system memory leak after long
interval of runing (reported by others, as I am not really using app_perl).
Post by Vik Killa
Interesting but could you elaborate on how that will answer my question?
On Mon, Sep 15, 2014 at 11:44 AM, Daniel-Constantin Mierla
Hello,
Post by Vik Killa
hello, does kamailio start/run the perl script defined by
modparam("app_perl", "filename", "/usr/local/test/bin/sips.pl
<http://sips.pl>") at startup and constantly run in background?
yes.
The upcoming 4.2 has the option to reload the script (and reset
the perl interpreter) periodically.
Cheers,
Daniel
Post by Vik Killa
I want a persistent database connection rather than having to
constantly re-connect to database on each transaction.
Is this possible?
I'm connecting to postgres with
use DBI;
my $dsn = "DBI:Pg:database=$database;host=$host;port=$port";
my $dbh = DBI->connect($dsn, $user, $pass) || die "Could not
connect to database: $DBI::errstr";
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 -http://www.asipto.com
Sep 22-25, Berlin, Germany
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany
Continue reading on narkive:
Loading...