# freenx loadbalancing, how to?

## Januszzz

hi,

I'm trying to set up freenx load balancing without luck. I have 3 nxservers, they are working fine. /home dir is the same on all hosts (NFS). I've setup like it is said:

# To do load balancing setup some hosts in LOAD_BALANCE_SERVERS and

# make:

#

#   - either sure that all incoming connections are sent to the master

#     server by using forwarding directives on the "slave" servers.

So I did on master (load balancer) server:

```

SERVER_LOADBALANCING="1"

LOAD_BALANCE_SERVERS="nx1 nx2 nx3"

```

and on slaves I did:

```

ENABLE_SERVER_FORWARD="1"

SERVER_FORWARD_HOST="192.168.1.210"

SERVER_FORWARD_PORT=22

SERVER_FORWARD_KEY="/etc/nxserver/lb.key"
```

When I try to connect all I see on master server is: 

```
-- NX SERVER START: -c /usr/bin/nxserver - ORIG_COMMAND=

HELLO NXSERVER - Version 2.1.0-72 OS (GPL, using backend: 3.2.0)

NX> 105 hello NXCLIENT - Version 1.5.0

NX> 134 Accepted protocol: 1.5.0

NX> 105 SET SHELL_MODE SHELL

NX> 105 SET AUTH_MODE PASSWORD

NX> 105 login

NX> 101 User: rest

NX> 102 Password:

NX> 103 Welcome to: nxlb user: rest

NX> 105 listsession --user="rest" --status="suspended,running" --geometry="1280x800x24+render" --type="unix-kde"

NX> 127 Sessions list of user 'rest' for reconnect:

Display Type             Session ID                       Options  Depth Screen         Status      Session Name

------- ---------------- -------------------------------- -------- ----- -------------- ----------- ------------------------------

NX> 148 Server capacity: not reached for user: rest

NX> 105 startsession --session="nxlb" --type="unix-kde" --cache="32M" --images="32M" --link="adsl" --kbtype="pc102/pl" --nodelay="1" --encryption="1" --backingstore="when_requested" --geometry="1280x770" --media="0" --agent_server="" --agent_user="" agent_password="******""  --screeninfo="1280x770x24+render"

Info: Load-Balancing (if possible) to 127.0.0.1 ...

Password:

pid 2031's current affinity list: 0-3

pid 2031's new affinity list: 1-3

NX> 1000 NXNODE - Version 2.1.0-72 OS (GPL, using backend: 3.2.0)

NX> 700 Session id: nxlb-1000-EC7CFC1E9417D92E2896A40EDC7CEBFC

NX> 705 Session display: 1000

NX> 703 Session type: unix-kde

NX> 701 Proxy cookie: b03b05916ff9853a549ff79fa47ebf45

NX> 702 Proxy IP: 127.0.0.1

NX> 706 Agent cookie: b03b05916ff9853a549ff79fa47ebf45

NX> 704 Session cache: unix-kde

NX> 707 SSL tunneling: 1

NX> 1009 Session status: starting

NX> 710 Session status: running

NX> 1002 Commit

NX> 1006 Session status: running

NX> 105 bye

Bye

NX> 999 Bye

NX> 1009 Session status: terminating

NX> 1006 Session status: closed

NX> 1001 Bye.

```

Actually, I think the client connects, but to the loadbalancer itself, not to the nodes. As there is no KDE or whatsoever so it immediately disconnects. But why tf it doesn't do loadblance?

During this connection there is absolutely nothing happening on nodes.

Any ideas? Thank you!

----------

## gerdesj

Normally I (and I'm sure many others) would have a go at query like this but it is pretty esoteric.  Have you requested assistance from an NX source?

Cheers

Jon

----------

## Januszzz

esoteric, you say...

well, I'm not very good at shell programing and until now I assumed that config file would make the job done...  :Smile: 

No, I didn't investigate code yet. I will try to do this in next few days then. Anyway if you spot some error in between, please drop me a line  :Smile: 

----------

## Januszzz

OK, i got this f... server a little bit further  :Smile: 

It still doesn't loadbalance yet, but changing 

```
LOAD_BALANCE_ALGORITHM="round-robin"
```

to

```
LOAD_BALANCE_ALGORITHM="random"
```

Surprisingly it did the loadbalancing at least started. I'm investigating further.

EDIT: Well it works  :Smile:  I also needed change nx1 nx2 to ip addresses, it was clearly from the nxserver log. I'm still unable to connect to the session with the same user to the same machine using load "scheduler", I'm going...

----------

## sgao

round-robin seems broke. It does not work for me either.  Only random works.

----------

## sgao

A patch for FreeNX-0.7.3 fixed the round-robin problem. See bug#235204.

----------

