Opensips caching

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Opensips caching

Vishal Pai
Hello everyone

what is the best way to implement the caching in opensips. I am doing following

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?


Vishal Pai 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

Khalil Khamlichi
Are you using dr_rules table ?

On Thu, Jan 17, 2019, 8:18 AM Vishal Pai <[hidden email] wrote:
Hello everyone

what is the best way to implement the caching in opensips. I am doing following

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?


Vishal Pai 
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

S. Rosenberg
In reply to this post by Vishal Pai
In the script you have multiple caching options, cache_store and cache_fetch from cachedb_mamcached work without external servers like cachedb_mongo that requires mongodb or other nosql modules.

On Thu, Jan 17, 2019, 9:18 AM Vishal Pai <[hidden email] wrote:
Hello everyone

what is the best way to implement the caching in opensips. I am doing following

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?


Vishal Pai 
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

S. Rosenberg
I believe that dynamic routing runs a SQL query every time, I don't think that can be cached, but if you do your own logic in opensips, you should be able to use cashedb_memcached

On Thu, Jan 17, 2019, 9:40 AM Schneur Rosenberg <[hidden email] wrote:
In the script you have multiple caching options, cache_store and cache_fetch from cachedb_mamcached work without external servers like cachedb_mongo that requires mongodb or other nosql modules.

On Thu, Jan 17, 2019, 9:18 AM Vishal Pai <[hidden email] wrote:
Hello everyone

what is the best way to implement the caching in opensips. I am doing following

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?


Vishal Pai 
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

Jon Abrams
There is the sqlcacher module in 2.2+ which will cache whole or parts of sql tables into OpenSIPs memory.
There is also the excellent drouting module which caches routing data on startup (or command) into local memory. You could store the rate in the attributes field of the dr_rules table with each NPANXX.
Redis and memcached modules are available too.

That said, if you don't need hundreds of CPS throughput, you can probably get by with mysql if you make sure you have the table cached in mysql correctly and don't have a lot of other things going on in the database.

- Jon

On Thu, Jan 17, 2019 at 1:46 AM Schneur Rosenberg <[hidden email]> wrote:
I believe that dynamic routing runs a SQL query every time, I don't think that can be cached, but if you do your own logic in opensips, you should be able to use cashedb_memcached

On Thu, Jan 17, 2019, 9:40 AM Schneur Rosenberg <[hidden email] wrote:
In the script you have multiple caching options, cache_store and cache_fetch from cachedb_mamcached work without external servers like cachedb_mongo that requires mongodb or other nosql modules.

On Thu, Jan 17, 2019, 9:18 AM Vishal Pai <[hidden email] wrote:
Hello everyone

what is the best way to implement the caching in opensips. I am doing following

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?


Vishal Pai 
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

Ben Newlin
In reply to this post by S. Rosenberg

No, the dynamic routing module will cache the entire configuration and only read from memory. It must be reloaded when the configuration changes. It’s very quick.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Schneur Rosenberg <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Thursday, January 17, 2019 at 2:44 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] Opensips caching

 

I believe that dynamic routing runs a SQL query every time, I don't think that can be cached, but if you do your own logic in opensips, you should be able to use cashedb_memcached

 

On Thu, Jan 17, 2019, 9:40 AM Schneur Rosenberg <[hidden email] wrote:

In the script you have multiple caching options, cache_store and cache_fetch from cachedb_mamcached work without external servers like cachedb_mongo that requires mongodb or other nosql modules.

 

On Thu, Jan 17, 2019, 9:18 AM Vishal Pai <[hidden email] wrote:

Hello everyone

 

what is the best way to implement the caching in opensips. I am doing following

 

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

 

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?

 

 

Vishal Pai 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

Ben Newlin

Hi,

 

Since upgrading to 2.4.4 we are seeing the following logs scrolling nearly continuously on our servers:

ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
WARNING:core:do_action: error in expression at opensips.cfg:583
ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
WARNING:core:do_action: error in expression at opensips.cfg:583
ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
WARNING:core:do_action: error in expression at opensips.cfg:439
 

 

It seems to be related to our use of the json module. We often pass json variable types as parameters to other routes and I believe the errors are caused by that. But it’s hard to say as there are a few different script lines referenced in the errors, but some of them point to return statements and other code sections that don’t really make sense. For example, line 583 referenced in the error above is:

 

  return(-1);

 

Any ideas?

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Ben Newlin <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Thursday, January 17, 2019 at 8:51 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] Opensips caching

 

No, the dynamic routing module will cache the entire configuration and only read from memory. It must be reloaded when the configuration changes. It’s very quick.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Schneur Rosenberg <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Thursday, January 17, 2019 at 2:44 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] Opensips caching

 

I believe that dynamic routing runs a SQL query every time, I don't think that can be cached, but if you do your own logic in opensips, you should be able to use cashedb_memcached

 

On Thu, Jan 17, 2019, 9:40 AM Schneur Rosenberg <[hidden email] wrote:

In the script you have multiple caching options, cache_store and cache_fetch from cachedb_mamcached work without external servers like cachedb_mongo that requires mongodb or other nosql modules.

 

On Thu, Jan 17, 2019, 9:18 AM Vishal Pai <[hidden email] wrote:

Hello everyone

 

what is the best way to implement the caching in opensips. I am doing following

 

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

 

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?

 

 

Vishal Pai 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips caching

Ben Newlin

Apologies, that shouldn’t have been added to this thread. Will post again separately.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Ben Newlin <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Tuesday, January 22, 2019 at 1:57 PM
To: OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] Opensips caching

 

Hi,

 

Since upgrading to 2.4.4 we are seeing the following logs scrolling nearly continuously on our servers:


ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
WARNING:core:do_action: error in expression at opensips.cfg:583
ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
WARNING:core:do_action: error in expression at opensips.cfg:583
ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
ALERT:core:pv_get_param: BUG: invalid parameter type 1836017711
ERROR:core:comp_scriptvar: cannot get left var value
WARNING:core:do_action: error in expression at opensips.cfg:439
 

 

It seems to be related to our use of the json module. We often pass json variable types as parameters to other routes and I believe the errors are caused by that. But it’s hard to say as there are a few different script lines referenced in the errors, but some of them point to return statements and other code sections that don’t really make sense. For example, line 583 referenced in the error above is:

 

  return(-1);

 

Any ideas?

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Ben Newlin <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Thursday, January 17, 2019 at 8:51 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] Opensips caching

 

No, the dynamic routing module will cache the entire configuration and only read from memory. It must be reloaded when the configuration changes. It’s very quick.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Schneur Rosenberg <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Thursday, January 17, 2019 at 2:44 AM
To: OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] Opensips caching

 

I believe that dynamic routing runs a SQL query every time, I don't think that can be cached, but if you do your own logic in opensips, you should be able to use cashedb_memcached

 

On Thu, Jan 17, 2019, 9:40 AM Schneur Rosenberg <[hidden email] wrote:

In the script you have multiple caching options, cache_store and cache_fetch from cachedb_mamcached work without external servers like cachedb_mongo that requires mongodb or other nosql modules.

 

On Thu, Jan 17, 2019, 9:18 AM Vishal Pai <[hidden email] wrote:

Hello everyone

 

what is the best way to implement the caching in opensips. I am doing following

 

we have a rate table with NPANXX with rate per minute. Every time when we do outbound calls we get NPANXX of dialed number and search it in database. Since in this way it will create a load on cpu for each select query.

 

Can anyone help me in this also let me know if there is any caching functionality is available in opensips ?

 

 

Vishal Pai 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users