alexyoung / ircd.js

A Node ircd (IRC daemon)
GNU General Public License v3.0
528 stars 90 forks source link

Load balancing on multiple servers #52

Closed ping86 closed 11 years ago

ping86 commented 11 years ago

I've been doing some research on messaging systems. I think all commands commands can be replicated to multiple servers whit a messaging system like redis or rabbitmq.

You can also keep a table of nicks, channels, users in a room, and all the information that needs to be shared among multiple servers in a key-value memory database distributed (http://redis.io/)

I think it would be the simplest way to load balance.

Any more ideas?

alexyoung commented 11 years ago

Redis seems easier than implementing the IRC server to server protocol

ping86 commented 11 years ago

The problem is you have to change all the functions that access to information,

For example:

Deop a user from a channel with redis

  deop: function(channel) {
        var client = this;

                channelUtil.userExists(channel, this.nick , function(exists) {
        if(exists) {

                   //redis logic
           redisPub.hdel("Set:" + channel.normalizeChan, client.nick.toLowerCase());
           redisPub.hmset("Set:" + channel.normalizeChan, client.nick.toLowerCase(), client.nick);

        } 

    });
  }, 

now:

  deop: function(channel) {
    if (this.channelModes[channel])
      this.channelModes[channel] = this.channelModes[channel].replace(/o/, '');
  },

I have a small example running redis, we could make a new branch and continue with the system.

neiltron commented 11 years ago

I'd like to help with this if the two of you decide you want to go down that path. Seems like this would also make services easier to implement.

ping86 commented 11 years ago

I work in this feature, I have some code. In a few days I publish it.

We need more people for this proyect. I will invited some friends.

ping86 commented 11 years ago

@alexyoung @neiltron

I create a experimental proyect. Used redis to balance messages between multiple servers.

The code is not right, it's just a prototype, it would be necessary to do well.

https://github.com/ping86/ircd.js

What do you think?