saltyrtc / saltyrtc-server-python

SaltyRTC signalling server implementation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] Load balancing

opened this issue · comments

This question is not directly related to server.

Best practice about load balancing multiple server instances on different regions ?
How is it done in Threema ? (if not a secret)

What I know now:
Same user device A must connect to same server with device B
May be there are other pitfalls, any information is welcome.

We use DNS based load balancing at Threema. The hostname looks like saltyrtc-XX.example.com, where XX are the first two digits of the initiator's permanent public key (which is transferred in the QR code). We then direct the DNS hostnames to multiple servers, but the same hostname always points to the same server.

The clients allow constructing a hostname dynamically using a callback function.

Does that help?

We use DNS based load balancing at Threema. The hostname looks like saltyrtc-XX.example.com, where XX are the first two digits of the initiator's permanent public key (which is transferred in the QR code)

I understand that you transfer hostname from web(initiator) to client(responder) in QR code.
Now web knows that it must connect to saltyrtc-00.example.com and client(device) knows that he too must connect to saltyrtc-00.example.com, this is clear

We then direct the DNS hostnames to multiple servers, but the same hostname always points to the same server.

But this one is unclear.

You can point saltyrtc-00.example.com through saltyrtc-7f.example.com to server1 and saltyrtc-80.example.com through saltyrtc-ff.example.com to server 2 by creating different A records. You can also create more than 2 server groups (up to 255 if you use 2 hex digits).

$ dig A +short saltyrtc-00.threema.ch
212.103.68.10
$ dig A +short saltyrtc-80.threema.ch
185.88.236.80

Does that clear things up?

@dbrgn Thanks, now it's clear.

Are you using geolocation routing ?

No, that would break things if your mobile device and browser would be detected to be in different geolocations.

There are probably some network-level load balancing solutions that would address this issue. So far we haven't needed them though.

@dbrgn Thank you for sharing this info.