WCS high availability and load balancing

mbedial

Member
Hi,
we are testing WCS 5.2 and we are planning to adquire a new license in order to have 2 WCS nodes.

I've been reading https://docs.flashphoner.com/display/WCS52EN/Configuring+and+starting+the+balancer but I have some doubts.
We mainly want to use WCS as webrtc/sip gateway for voice calls in iOS and android app.
According to the documentation, if we have 2 LB nodes, you can ask LB1 about the less loaded node. My first question is, does the sdk for android or iOS include any specific method or service for that? How would it work?
On the other hand, for us is really important to have high availability of the systems. We currently have a licensed old version of WCS (WCS5.0) and we have many problemas with this, so we want to upgrade to 5.2 but also to include HA. Here the second question, is there any specific method in the sdk to deal with it? We are testing it, and we basically try first with one wss://lb1 first and if we get a callback disconnect, we try with the second one wss://lb2. Is this the best way to do this in android and iOS apps?
I know that we can use haproxy (in fact we use it for othe apps), but actually it's a SPOF, so we prefer the other way. Whats your recommendation?

Thanks a lot in advance.
 

Max

Administrator
Staff member
Good day.
Load balancing function in WCS is obsolete now and may not work properly. You can use HAProxy for load balancing or, if you're using AWS instances, you can use AWS load balancer.
but actually it's a SPOF
Any load balancer can be a SPOF, even AWS LB, if DNS fails.
We are testing it, and we basically try first with one wss://lb1 first and if we get a callback disconnect, we try with the second one wss://lb2. Is this the best way to do this in android and iOS apps?
If your approach is to iterate through websocket entry points on clients side until successful connection, you can use callback both in Android SDK and iOS SDK to detect disconnetion and/or connection failure. Look at Media Devices Android example on GitHub:
Code:
                    session = Flashphoner.createSession(sessionOptions);

                    session.on(new SessionEvent() {
                        ...
                        @Override
                        public void onDisconnection(final Connection connection) {
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    mStartButton.setText(R.string.action_start);
                                    mStartButton.setTag(R.string.action_start);
                                    mStartButton.setEnabled(true);
                                    mSwitchCameraButton.setEnabled(false);
                                    mSwitchRendererButton.setEnabled(false);
                                    mStatusView.setText(connection.getStatus());
                                    mTestButton.setEnabled(true);
                                }
                            });
                        }
                    });
and to Media Devices iOS example
Code:
        _session = [FPWCSApi2 createSession:options error:&error];
        ...
           
        [_session on:kFPWCSSessionStatusDisconnected callback:^(FPWCSApi2Session *session){
            [self changeConnectionStatus:[session getStatus]];
            [self onStopped];
        }];
      
        [_session on:kFPWCSSessionStatusFailed callback:^(FPWCSApi2Session *session){
            [self changeConnectionStatus:[session getStatus]];
            [self onStopped];
        }];
 
Top