coturn icon indicating copy to clipboard operation
coturn copied to clipboard

Question - Can we do autoscaling of coturn server running on EC2 Instance ?

Open Govind10g opened this issue 3 years ago • 4 comments

Hello Team,

Is it possible to enable auto scaling on turn server ? We deployed coturn on AWS EC2 instance and trying to use auto scaling group to add more coturn server in the load balancer target group.

Please let us know if this is feasible solution to auto scale coturn ?

@eakraly

Govind10g avatar Dec 09 '22 05:12 Govind10g

Yes possible. So you could scale out based on CPU or network capacity

How do you plan to load balance traffic across those instances?

eakraly avatar Dec 10 '22 16:12 eakraly

We are using Network load balancer to auto scale coturn ec2 instance.

Govind10g avatar Dec 29 '22 10:12 Govind10g

Are you trying to route all the traffic through NLB? Or just using ASG and LB as a scaling mechanism? One thing is scaling but another thing is how the traffic is getting in and out

If you are trying following:

  • NLB and EC2 ASG for turn address (so you have a single turn "endpoint")
  • Maybe you can even have NLB terminate SSL
  • Your EC2 (and turnservers) have public IPs and those are the actual relay candidates that will be used
  • ASG scales based on CPU

Sounds like something that can work. Never tried it myself.

An important point to look out for in any scaling mechanism - draining during scale in. When you take an instance offline (scaling in) you want it to have 0 sessions (ideally) to get best UX. Of course depends on your application - some are more sensitive than others to disconnects.

eakraly avatar Dec 30 '22 21:12 eakraly

Hi @eakraly

Does the application work if we use the TCP protocol and port 3478? I notice that the application is listening on both protocols, i.e., UDP and TCP. It is working with the UDP protocol on port 3478, but it fails when I use the TCP protocol on port 3478. Therefore, I was wondering if TCP on port 3478 is supported? And because of that my TLS encryption at NLB is not working as I registered the coturn server on port TCP 3478 behind the NLB.

Govind10g avatar Mar 05 '24 10:03 Govind10g