# Scalability best practice

**URL:** <https://discourse.lynckia.com/t/scalability-best-practice/141>\
**Category:** Uncategorized\
**Created:** [March 4, 2016, 2:53pm UTC](https://discourse.lynckia.com/t/scalability-best-practice/141 "2016-03-04T14:53:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesco\_Durighetto](https://avatars.discourse-cdn.com/v4/letter/f/a9a28c/32.png) [@Francesco\_Durighetto](https://discourse.lynckia.com/u/Francesco_Durighetto)\
**Post date:** [March 4, 2016, 2:53pm UTC](https://discourse.lynckia.com/t/scalability-best-practice/141/1 "2016-03-04T14:53:08Z")

</div>

Hi everyone,  
I’m new and I’m “playing” with licode to build an infrastructure for our  
webrtc call environment.

I’m a little bit confused:  
What’s the difference between ErizoController and ErizoAgent?  
I mean, I have a main server with nuve and an erizo controller. In another  
server, just to make few test, I only deployed the erizoAgent.  
When I start the agent on the second server, the first (thanks to rabbit)  
will see and register the new agent BUT as ErizoController\_someId, not  
ErizoAgent\_someId.

Is there a benefit to deploy various controller instead of Agents only?  
I’m trying to figure out what’s the best configuration for the scalability.

At this point I’ve imagined one main server with Erizo controller, nuve and  
an Agent (will be the main agent which never shutdown).  
I’ve also modified the agentReporter.js to include some other info such as  
network conditions etc. and modified the erizo\_controller default policy to  
route all the traffic to the main agent until the machine reach some  
parameters (cpu\_load, memory load network load, etc).  
Then, when the limits are reached, a new machine will spawn with only an  
agent wich will automatically connect to the “cluster” thanks to rabbit.  
I’m in an early stage of developement but it seems working.  
Am I on the right track?

Another Question:  
I’m not able to find out how to scale down. I’m implementing this feature  
as application logic. When the Agent has 0 active JS, the machine will  
shutdown.  
Is there a nicer method instead of killing the erizo Agent process? How can  
I deregister it from nuve with amqper?

Last Question:  
I know it’s a “funny” question, but I’ll try: is there a way to switch an  
active stream from an erizo Agent to another erizo agent? without interrupt  
the stream?

Many Thanks,  
Francesco.
