Project

General

Profile

Loadbalancing users pr. JID

Steffen Larsen
Added over 4 years ago

Hi,

I've been reading a bit about the --see-other-host option, and it seems to me that I actually can load balance my users based on their JID ?

This would be really nice, if I could have users using multiple clients (diff. resources) to go to the same host. Can that be done through that --see-other-host option?

Ive read the http://www.tigase.org/content/tigase-load-balancing, and am not fully convinced but it looks like if I set it to SeeOtherHostHashed, that users with multiple clients will end up on the same server.

My scenario:

user1@domain.tld/A -->server1
user1@domain.tld/B -->server1

user2@domain.tld/A -->server2
user2@domain.tld/B -->server2

Am I correct?


Replies (8)

Added by Wojciech Kapcia TigaseTeam over 4 years ago

Yes, you are correct - it will allow to group users on one node and given that the assignment is done on bareJID then all resources will get the same host assigned.

There is a catch with this approach - the support for this kind of redirection varies in libraries so not all clients may get redirected.

Added by Steffen Larsen over 4 years ago

Ah yes. I've read the doc, and it probably depends on their start of the STREAM element, right?

But what if I set c2s/cm-see-other-host/active=LOGIN. would it then do my redirect from the JID (which it should have during login)

Also is --see-other-host default setup?. Because when I join with users in my cluster (through a normal loadbalancer), its seems not to be on the same node.

Should I set

--cm-see-other-host=tigase.server.xmppclient.SeeOtherHostHashed

explicitly in the init.properties?.

Added by Wojciech Kapcia TigaseTeam over 4 years ago

One thing is presence of from in opening stream, the other is proper handling of the see-other-host (i.e. closing current connection and opening another to the suggested host).

As described in the linked document, SeeOtherHostHashed is default (in cluster mode) so there is no need to configure it explicitly. (you can check @etc/config-dump.properties@)

Added by Steffen Larsen over 4 years ago

Hi Wojciech!,

I've setup the --cm-see-other-host with two servers now (xmpp1.test.tld and xmpp2.test.tld).

I tried to login with two PSI clients (one client on each server). The first one logs in and works fine on server 1.

Now the second one tries to login and what I would expect was a redirect, which I get:

<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">ADIwMTk1MzIANXJ3NjVCNmFjNjRsVFJGdmxRZ0MwZmJ3Q1JsRFRXTklLQjBJdkJvNWl1Q2NJenVPUU8xd0VoMnp2d095ZTBFZ3FiRlRBdDBIQWpyMjlnZnU0c3FyVDZMWWJJ.......</auth>

<stream:stream version="1.0" from="domain2.tld" xml:lang="en" id="tigase-error-tigase">
<stream:error>
<see-other-host xmlns="urn:ietf:params:xml:ns:xmpp-streams">xmpp1.test.tld</see-other-host>
</stream:error>
</stream:stream>

But my login does not get through, and I can see no more logs in the console of PSI.

What concerns me is that my clients are logging into domain1 (test@domain1.tld), but the server set the "from" attribute (in stream) to another domain (domain2.tld). I have used PSI for testing, but they might now support the redirect.

It could be awesome if this worked, because I have a scenario where only the same users is talking to each others clients (through direct presence).

I could save a lot of bandwidth because the cluster do not have to send out this message to all of the nodes.

-Cheers!

/Steffen

Added by Steffen Larsen over 4 years ago

Ha ha you just barely beat me with that message. I didn't see your previous message, because I was writing mine. :-)

Ok so SeeOtherHostHashed is default in clustermode, and that is in every implementation, e.g. OnlineUsersCachingStrategy (ACS), Default etc.?

Because I haven't seen the in the stream before now, where I explicitly turned it on. But that just be my eyes that is tricking me. I'll check again.

And I expect the hosts that when running in cluster mode that the see-other-host is picking up is the one that is defined i my cluster and available in cluster_nodes tables?

/Steffen

Added by Wojciech Kapcia TigaseTeam over 4 years ago

Steffen Larsen wrote:

I tried to login with two PSI clients (one client on each server). The first one logs in and works fine on server 1.

Now the second one tries to login and what I would expect was a redirect, which I get:

But my login does not get through, and I can see no more logs in the console of PSI.

Well, this is "stream error" hence there stream is closed and session is terminated. This is what I meant by "client support" and that's why it's enabled by default for stream opening and not login - most clients doesn't set from in the former and if they do they most likely support see-other-host (jaxmpp2 for example). On the other hand after correctly establishing the logging the information about JID is known and we can generate the redirect but then again - most clients wouldn't know what to do with it and simply terminate the stream (Psi closes it and displays error dialog with the information).

What concerns me is that my clients are logging into domain1 (test@domain1.tld), but the server set the "from" attribute (in stream) to another domain (domain2.tld).

Does this applies to all stream packets or only see-other-host ones?

Steffen Larsen wrote:

Ok so SeeOtherHostHashed is default in clustermode, and that is in every implementation, e.g. OnlineUsersCachingStrategy (ACS), Default etc.?

Those are independent (in a way that they don't rely on each other, even though they operate in 'clustered realm') - you can use redirections with any clustering implementation in Tigase.

And I expect the hosts that when running in cluster mode that the see-other-host is picking up is the one that is defined i my cluster and available in cluster_nodes tables?

Not exactly - list of hosts is taken from clustering API from the list of all available and connected nodes (so it may happen this would be a subset of nodes in cluster_nodes table, if some are not available or not connected).

Added by Steffen Larsen over 4 years ago

Hi W,

Do you know any see-other-host compatible clients and libraries? .. Yes prob. Jaxmpp is compatible, but do you know others?

The domain problem I have about applied for the see-other-host only. I didn't see any with the first client logging in.

About the cluster and see-other-host property, yes that was also how I understood it. Maybe my explanation just was bad. :-)

Added by Wojciech Kapcia TigaseTeam over 4 years ago

Steffen Larsen wrote:

Do you know any see-other-host compatible clients and libraries? .. Yes prob. Jaxmpp is compatible, but do you know others?

Unfortunately no - we mostly recommend using Jaxmpp (yes, I know it can be limiting) or creating feature requests in desired clients to make them compatible.

The domain problem I have about applied for the see-other-host only. I didn't see any with the first client logging in.

I've created ticket for that: #2196 - please add yourself to watchers to monitor progress.

    (1-8/8)