The power of a cluster comes from its ability to determine which system to start sessions on so that the load of the cluster is evenly distributed across all systems. Furthermore, in a heterogeneous environment, some servers may have applications that others do not. Or administrators may want to only allow a subset of users to launch sessions on a specific server while at the same time maintaining the same access point for all users to log in at. There are two ways to accomplish this: load balancing and job scheduling
Load balancing
The goal of load balancing is to determine the proper server to start a session on. Load balancing makes use of custom javascript functions that are executed in the web server using server data supplied from the cluster. The javascript function returns the serverId of the system that will launch the session. The session is them launched immediately.
Load balancing can also be used to determine on which system a user should log in when logging in via ssh.
Configuring load balancing
- Create a cluster
- Go to the System > Clustering > Load Balancing
- Select a script
- Click the Actions > Set Default Start Script
- If you want to load balance the user at login, click Actions > Set Default Login Script
The system will now load balance when starting a session based on the script you selected.
Creating custom load balancing functions
FastX ships with some basic predefined load balancing functions that are useful in simple situations. However, load balancing can be extended by creating your own custom functions. Basic scripting knowledge is required and javascript knowledge is preferred. Contact support for help creating the load balancing function
- Create a cluster
- Go to the System > Clustering > Load Balancing
- Click New Script
- Enter a name
- Add your javascript function. See this load balancing tutorial for examples
- Save
Static data and metrics
Each FastX server periodically updates the cluster with its current status. The status gives basic information such as number of Sessions running and Available RAM, but this data may not be enough to properly choose the right server to launch a new session on. Static data and metrics expand the server information by allowing administrators to create custom parameters to attach to the server update (for example, does this server contain a specific application, or how many licenses of a CAD application are in use on this system). Using these custom parameters, administrators can create elaborate load balancing scripts for maximum customization
Static data
Static data is a simple JSON object that never changes. The exact same object is sent on every update. Static data is good if you want to group specific servers together, or you want to advertise applications on a system. It can also be used as a way to reject users from launching sessions on the server
- Create a cluster
- Go to the System > Clustering > Static Data
- Edit the JSON Object. Verify that the object is valid JSON
- Save
The object will be sent on every update and will be available under the static parameter
Metrics
Static data works well in defining what exists on a system, but the real power of load balancing occurs when you can understand the current state of the system. Metrics accomplishes this task by allowing custom javascript functions to be executed on update and the results sent along with the update. With a few lines of code, you can execute commands that can query the current state of the system and pass them to the cluster. Examples include, query the number of licenses available on a server, finding which users have accounts on this system, or even polling to see when the server is ready to accept new sessions. Anything that can be scripted can be customized into a metric!
- Create a cluster
- Go to the System > Clustering > Metrics
- Click New Metric
- Edit the Name
- Add the javascript function. See this metrics tutorial for examples
- Save
Each of the metrics functions will be executed on every update. Functions that properly resolve will be added to the metrics object.
Note: Do not give the same name to multiple metrics. There is no way to determine which one will be sent on an update.
Job scheduling
Load balancing is effective at determining where a session should start at the time the user launches the session. However, proper resources may not be available at that time. In cases like this, job scheduling is the proper solution. FastX allows administrators to offload jobs onto their third-party job scheduling tools (e.g lsf, moab, slurm etc) to be launched at a later time. FastX will execute the job as the logged in user and return any output back to the user. The third-party job scheduling script can then start a FastX session from the command line once the proper resources are available and the session will display in the user’s session when ready.
Creating a job scheduling script
- Create a cluster
- Go to the System > Clustering > Load Balancing
- Click New Script
- Enter a name
- Enter the job scheduling command, See this job scheduling tutorial for examples
- Save
Using a job scheduling script
FastX gives administrators the option to create multiple job schedulers and attach them to different bookmarks. Some bookmarks can start immediately while others can be scheduled. This allows greater flexibility in customizing the way sessions are launched. To use a scheduling script,
- Go to the System > Sessions > Bookmarks
- Edit a bookmark
- Change the Job Scheduling option to your script
- Save
A user who launches this bookmark will launch it using the job scheduler. If the bookmark is set to Start Immediately the FastX Load balancer will be used instead.
Note: Job schedulers as executed as the logged in user on the system the user has logged in to.