Yeah, problem comes when calls draining last longer than the drain time
(which in aws is max 3600). Then I need to figure out something different.
Like iptables or something like that.
Unless Daniel has a better way from within Kamailio?
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337
On Tue, 6 Feb 2024 at 14:35, Sebastian Damm via sr-users <
sr-users(a)lists.kamailio.org> wrote:
Yes, that's a successful connection first. But it
helps to get rid of the
existing connections as well, since there is no new SYN for
re-registrations. And yes, I want the clients to reconnect. If have
disabled the node in the loadbalancer before enabling maintenance mode,
There won't be any new requests, and the existing connections will drain
slowly.
------------------------------
*From:* David Villasmil <david.villasmil.work(a)gmail.com>
*Sent:* Tuesday, February 6, 2024 13:49
*To:* Sebastian Damm <sdamm(a)pascom.net>
*Cc:* Kamailio (SER) - Users Mailing List <sr-users(a)lists.kamailio.org>
*Subject:* Re: [SR-Users] Get the amount of open TCP connection from
routing logic
Thanks for the tips. But wouldn’t that be considered by the load balancer
a successful connection since there was an ACK to the SYN in order to send
the 503 data? Or does that work for you because you’re relying on the
client to retry and the load balancer sending to a different server?
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337
On Tue, 6 Feb 2024 at 13:45, Sebastian Damm <sdamm(a)pascom.net> wrote:
We usually already have a high enough number of max tcp connections.
However, there are certain scenarios when restarting some of our servers
the loadbalancer sends all the clients previously connected to these
servers to the remaining ones, leading to really full and really empty
nodes. And sometimes we see Kamailio rejecting connections, and sometimes
maybe the client can still connect, but the outgoing connection to the next
hop is not possible anymore.
But maybe you're right. Manually dropping the connection would probably
not be any better than what Kamailio does after really reaching the limit.
We have already implemented the maintenance mode draining, this would work
as follows:
Add a shared var named "MAINTENANCE_MODE", set it to 0 in config. Then,
when handling the REGISTER, add something like this:
if msg.is_method("REGISTER"):
if KSR.pv.get("$shv(MAINTENANCE_MODE)") == 1:
msg.log("In maintenance mode, rejecting registration")
KSR.set_reply_close()
KSR.hdr.append_to_reply("Retry-After: 3\r\n")
KSR.sl.sl_send_reply(503, "Draining")
return False
You can set the value of the shared var to 1 via kamcmd. After that, on
the next re-registration, the client will be disconnected, ending up
hopefully on a different node after reconnect.
Regards,
Sebastian
------------------------------
*From:* David Villasmil <david.villasmil.work(a)gmail.com>
*Sent:* Tuesday, February 6, 2024 13:11
*To:* Kamailio (SER) - Users Mailing List <sr-users(a)lists.kamailio.org>
*Cc:* Sebastian Damm <sdamm(a)pascom.net>
*Subject:* Re: [SR-Users] Get the amount of open TCP connection from
routing logic
Why not just increase the max tcp connections? Also, once you hit it,
Kamailio will reset the syn and the load balancer should try on a different
server.
I am look for something like what you’re looking for but reset the sub
on-demand so I can put the server in maintenance mode.
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337
On Tue, 6 Feb 2024 at 12:47, Sebastian Damm via sr-users <
sr-users(a)lists.kamailio.org> wrote:
Hello,
My plan is to reject new inbound requests if there is already a
certain number of open connections on one Kamailio server. I could answer
with a 503 and directly close the connection forcing the client to
reconnect and the loadbalancer to send traffic to a different node on the
next connect. It's just a last-resort measure to prevent Kamailio from
running into the configured TCP connection limit (workarounding a
poorly-implemented external load balancer).
Since I didn't find anything in the docs: Is there a pseudovariable
containing the current number of open tcp/tls connections on this Kamailio?
I can (and already do) query them via kamcmd or rpc, but can I access the
variable from inside the routing script as well?
Regards,
Sebastian
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe:
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe: