Hello all!
For a STSH project, kamailio is making HTTP requests to a middleware (REST API) using HTTP_CLIENT module. I have set the parameter "timeout" to 2 second, but this increases PDD to too high levels, so I have set it to 1 second. Problem is that 1sec is also too high! The parameter only accepts integer values, so no way to set this to 0.5sec.
I thought of having a way for kamailio to be aware that HTTP node #1 is down, so next request it will use HTTP node #2 instead. And once in a while, say, every 60 seconds, kamailio would check status of HTTP node #1 and, if OK, then it will switch back to HTTP node #1 and failover to node #2 when required.
The HTTP_CLIENT, as far as I know, doesn't do that. So the question is: what would be the best approach to have this feature on Kamailio? i thought about using HTable and have a flag with value of the HTTP connection to use by default. At worst, only the 1st failover request would take 1 or 2 seconds to timeout....then the subsequent HTTP requests would use node #2.
Any ideas?
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
Hello,
maybe having a HTTP servers cluster using HA so each query from Kamailio always find a active server
Other option is using:
modparam("http_client", "timeout_mode", 2) #Timeout values are in milliseconds
modparam("http_client", "connection_timeout", 100)
Regards
--- I'm SoCIaL, MayBe
El 12/12/2024 a las 11:07 a. m., Sergio Charrua via sr-users escribió:
Hello all!
For a STSH project, kamailio is making HTTP requests to a middleware (REST API) using HTTP_CLIENT module. I have set the parameter "timeout" to 2 second, but this increases PDD to too high levels, so I have set it to 1 second. Problem is that 1sec is also too high! The parameter only accepts integer values, so no way to set this to 0.5sec.
I thought of having a way for kamailio to be aware that HTTP node #1 is down, so next request it will use HTTP node #2 instead. And once in a while, say, every 60 seconds, kamailio would check status of HTTP node #1 and, if OK, then it will switch back to HTTP node #1 and failover to node #2 when required.
The HTTP_CLIENT, as far as I know, doesn't do that. So the question is: what would be the best approach to have this feature on Kamailio? i thought about using HTable and have a flag with value of the HTTP connection to use by default. At worst, only the 1st failover request would take 1 or 2 seconds to timeout....then the subsequent HTTP requests would use node #2.
Any ideas?
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
Kamailio - Users Mailing List - Non Commercial Discussions --sr-users@lists.kamailio.org To unsubscribe send an email tosr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
On 12 Dec 2024, at 17:48, Social Boh via sr-users sr-users@lists.kamailio.org wrote:
The HTTP_CLIENT, as far as I know, doesn't do that. So the question is: what would be the best approach to have this feature on Kamailio? i thought about using HTable and have a flag with value of the HTTP connection to use by default. At worst, only the 1st failover request would take 1 or 2 seconds to timeout....then the subsequent HTTP requests would use node #2.
The failover option in the connection object is used for failover. As far as I remember (but it was some time ago I wrote that code) there’s no monitoring like we do with OPTIONS for SIP. Guess that can be implemented so that failover happens faster than now.
/O
Hi Olle!
That would be a nice feature, indeed. Also, a nice to have, would be a parameter to limit the number of failover retries. For example, say you have HTTP1 and HTTP2 and Kamailio connects to HTTP1 first. HTTP1 has a failover on HTTP2 and HTTP2 has a failover on HTTP1 . If both HTTP servers are offline, there will be an "infinite" loop between the 2 HTTP servers. Limiting the number of failover retries will limit the failover loop.
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
On Fri, Dec 13, 2024 at 8:25 AM Olle E. Johansson via sr-users < sr-users@lists.kamailio.org> wrote:
On 12 Dec 2024, at 17:48, Social Boh via sr-users < sr-users@lists.kamailio.org> wrote:
The HTTP_CLIENT, as far as I know, doesn't do that. So the question is: what would be the best approach to have this feature on Kamailio? i thought about using HTable and have a flag with value of the HTTP connection to use by default. At worst, only the 1st failover request would take 1 or 2 seconds to timeout....then the subsequent HTTP requests would use node #2.
The failover option in the connection object is used for failover. As far as I remember (but it was some time ago I wrote that code) there’s no monitoring like we do with OPTIONS for SIP. Guess that can be implemented so that failover happens faster than now.
/O __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Hi there
On 12/12/24 17:07, Sergio Charrua via sr-users wrote:
Hello all!
For a STSH project, kamailio is making HTTP requests to a middleware (REST API) using HTTP_CLIENT module. I have set the parameter "timeout" to 2 second, but this increases PDD to too high levels, so I have set it to 1 second. Problem is that 1sec is also too high! The parameter only accepts integer values, so no way to set this to 0.5sec.
https://www.kamailio.org/docs/modules/devel/modules/http_client.html#http_cl...
That's already there since 5.8.0
https://github.com/kamailio/kamailio/commit/b882db36bbb7f7f13366bcc8f1db9f50...
dooooh! :o]
I was looking at 5.6x docs .... but i'm using kamailio 5.8.2 ! Thanks for the reminder
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
On Thu, Dec 12, 2024 at 6:11 PM Victor Seva via sr-users < sr-users@lists.kamailio.org> wrote:
Hi there
On 12/12/24 17:07, Sergio Charrua via sr-users wrote:
Hello all!
For a STSH project, kamailio is making HTTP requests to a
middleware (REST API) using HTTP_CLIENT module.
I have set the parameter "timeout" to 2 second, but this increases PDD
to too high levels, so I have set it to 1 second. Problem is that 1sec is also too high!
The parameter only accepts integer values, so no way to set this to
0.5sec.
https://www.kamailio.org/docs/modules/devel/modules/http_client.html#http_cl...
That's already there since 5.8.0
https://github.com/kamailio/kamailio/commit/b882db36bbb7f7f13366bcc8f1db9f50...
--
| ,''`. Victor Seva | | : :' : linuxmaniac@torreviejawireless.org | | `. `' PGP: 8F19 CADC D42A 42D4 5563 730C 51A0 9B18 CF5A 5068 | | `- Debian Developer |
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!