LTSPLoadBalancing

Differences between revisions 1 and 2
Revision 1 as of 2007-04-18 15:05:29
Size: 4646
Editor: ipn36372-c52610
Comment:
Revision 2 as of 2007-04-18 15:06:49
Size: 4715
Editor: ipn36372-c52610
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
 * '''Launchpad entry''':  * '''Launchpad entry''': https://blueprints.launchpad.net/ubuntu/+spec/edubuntu-load-balancing

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

We will make it easy for a system administrator to configure several edubuntu servers to divide TCs among them evenly.

Rationale

Schools with more thin clients (TCs) than one server can handle currently have to physically partition their networks or use DHCP failover to "load balance" their TCs across multiple servers. Both methods have limitations, because only so much physical partitioning is possible and desirable, and ISC DHCP only supports two failover peers (and the "balancing" with DHCP failover is often uneven).

Use cases

  • Freida is the system administrator for a school with 500 TCs, and she regularly has 300 concurrent users. She has three Edubuntu servers accessing common /home directories via NFS, and authenticating via LDAP. She configures the three Edubuntu servers to divide whole login sessions among themselves to share the load of running user applications across the three servers.
  • Remus is the system administrator for a school with only 40 TCs, but they are spread out in 12 different classrooms, and he can't afford a fast/big enough system to run Edubuntu for all 40 TCs when they are concurrently used. However, he has four relatively recent desktop systems that he can reprovision to be Edubuntu servers. Remus configures these four systems to divide the TC login sessions among themselves so 40 concurrent sessions will be feasible.

Scope

This "load balancing" spec is concerned with whole login sessions being directed to one server or another. This "load balancing" spec assumes that authentication and /home are taken care of by other means (such as NFS and LDAP). This "load balancing" spec does NOT address migration of any sessions or processes from one Edubuntu server to another.

Design

The ltsp_config script sets an environment variable ($SERVER) which is then used by ldm to initiate user sessions on the specified $SERVER. ltsp_config could process a list of Edubuntu servers specified in lts.conf and set $SERVER according to criteria defined by the system administrator.

A reasonable default criterion may be to munge the TC MAC address and deterministically connect to a particular server in the list (if that server is currently available).

Here's some untested sample code for the sake of discussion:

pick_app_server() {
    # If this is empty we'll detect that below and print a message.
    APP_SERVERS="$*"

    # The character range in the sed command here intentionally has a real tab
    # character in it because busybox sed doesn't understand the \t
    # metacharacter.
    APP_SERVERS=`echo ${APP_SERVERS} | sed 's/[ ��������,]\+/ /g'`
    APP_DONE=0
    while [ "${APP_DONE}" -ne 1 ]; do
        APP_NUM_SERVERS=`echo "${APP_SERVERS}" | wc -w | sed 's/ //g'`

        if [ "${APP_NUM_SERVERS}" -eq 0 ]; then
            echo "No application server found; rebooting in 1 minute." 1>&2
            sleep 60
            reboot
        fi

        if [ "${APP_RANDOM}" = "true" ]; then
            APP_SERVER_IDX=$((${RANDOM}%${APP_NUM_SERVERS}))
        else
            # Do some deterministic munging of the macaddr
            APP_SERVER_IDX=$((1`ifconfig  | grep HWaddr | head -n1 | sed 's/[^0-9]//g' | sed 's/^0*//'`%${APP_NUM_SERVERS}))
            APP_SERVER_IDX=$((${APP_SERVER_IDX}%${APP_NUM_SERVERS}))
        fi

        # Increment by one so we don't end up with an index of 0
        APP_SERVER_IDX=$((${APP_SERVER_IDX}+1))
        APP_SERVER=`echo ${APP_SERVERS} | cut -d\  -f ${APP_SERVER_IDX}`

        if [ "${APP_PING}" != "false" ]; then
        # Ping the app server to be sure it's up.
            echo "Pinging $APP_SERVER..." 1>&2
            ping -c 1 "${APP_SERVER}" >/dev/null 2>&1
            if [ "$?" != "0" ]; then
                # Drop the bad server out of our list of potential servers
                APP_SERVERS=`echo ${APP_SERVERS} | sed 's/'${APP_SERVER}' *//'`
                continue
            fi
        fi
        APP_DONE=1
    done
    echo Selected APP_SERVER: ${APP_SERVER} 1>&2
    echo ${APP_SERVER}
}

Implementation

Code

Data preservation and migration

None.


CategorySpec

Edubuntu/Specifications/LTSPLoadBalancing (last edited 2010-01-21 17:47:17 by 196-210-177-89-wblv-esr-3)