Question

i have a dedicated server that run a chat server made by me. But the server is almost overloaded and i want add another server to balance the users.

The servers are both a Linux Ubuntu 12.04 server and the chat program made by me was developed with c# and .NET with Mono.

The problem is that if i open another chat server on the other computer how can i make that the users can communicate between the two servers?

I will try to explain better:

User A is connected to Server A.
User B is connected to Server B.

If the user A send a message to user B that is connected to server B how i can redirect the message to the other server? What is the best solution?

Thank you in advance.

Was it helpful?

Solution

Firstly, whenever you have a performance problem, you should first try to measure where exactly it lies. Maybe you can improve the performance of your system dramatically in some way by looking into why and where it is slow. This way you might not need to scale your system at all. You could also try to scale up instead of out, which is generally easier.

If that fails I would suggest to switch to an existing chat system like XMPP or IRC. There are great XMPP libraries for C# so this would be the best solution I think.

Lastly, when you really want to scale out your own chat system in the way you described, I would suggest to just send messages as JSON over TCP. You can use fancy RPC stuff or REST APIs but for this use case I think you should keep it as simple and lightweight as possible.

OTHER TIPS

It depends which part exactly is missing. There a many parts to a load balanced system.

My guess is that you are missing the backing part, which might not be so obvious.

IPAddress -> Load Balancer <= x-Servers => Backplane

This is simliar to what we used in our case for the back part:

http://www.tugberkugurlu.com/archive/scaling-out-signalr-with-a-redis-backplane-and-testing-it-with-iis-express

I hope it points you in the right direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top