guacamole-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Wolfheimer <>
Subject Re: Dynamic Session Creation
Date Mon, 20 Aug 2018 15:51:31 GMT
Hi Nick and others,

I'm making some progress on the implementation of the dynamic session
handling. Basically, the backend part is completed. As I wanted to be
independent of the cloud provider and also wanted to allow the mechanism to
work for on-premises installations, I use a resource management system
common in the HPC world (SLURM) to organize the sessions on a cluster of
session host instances, i.e., I can create a session request for a user (in
fact it's a script describing how to startup the X-display, the window
manager, etc. which is submitted to the queueing system and then gets
executed on one of the session host instances). There is also a mechanism
to add the session information (remote host, display port, VNC password,
etc.) to the Guacamole database automatically once the session is ready to
accept connections. For cloud setups, instances are automatically deployed,
if there's not enough capacity on the already running instances. It works
nicely so far.

I'm now facing the challenge of triggering the backend mechanism from the
web-app as well as reporting progress information from the backend to the
client. I'd like to achieve the following:

When a user logs in to Guacamole with valid credentials and there's no
active session for this user, then the backend mechanism should be
triggered and start the session creation and, if required, the creation of
a new instance which can host the session. Although I can use an Guacamole
event listener to trigger the backend process which creates the instance
and the session for the user, the creation process can take 2-3 minutes
before it arrives at the point where the session is ready to connect
(because the instance needs some time to start up). The challenge is now to
"inform" the user about what's going on in the backend during the time
he/she waits for the desktop to appear, i.e., I'd like to just show a
dialog box which displays the information it gets from the backend, like:

Instance is created.
Desktop is prepared.

I tried to wait in the event listener, which creates the session, until the
session is ready, but this creates a horrible user experience, of course
(web app is unresponsive during that time).

I was looking in the Guacamole code and it seems that
contains the status messages displayed during the connection setup and also
the code for periodic re-connection if there is a backend issue (in my
case: session is not yet ready). Maybe someone knowing the internals of
Guacamole can enlighten me whether that's a promising place to implement
the status messages and the communication with the backend.

Thanks for any help!

Am Mi., 30. Mai 2018 um 19:08 Uhr schrieb Nick Couchman <>:

> On Sun, May 20, 2018 at 4:58 PM, Felix Wolfheimer <>
> wrote:
>> Hi Nick,
>> thanks for your answer. Yes, I was talking about VNC sessions on Linux.
>>  The scenario I have in mind is a cloud deployment with auto-scaling
>> functionality:
>> There's one instance where guacamole is installed. This instance is
>> small, cheap, and runs 24/7. The applications used in the VNC sessions
>> require decent 3D rendering performance and, thus, I want to host them
>> on GPU instances. These instances are expensive and so I would like to
>> only spin them up when there's demand for a session. I have a mechanism
>> that can submit a script (which creates a VNC session) to a scheduling
>> system (e.g. SLURM). This scheduling system is connected with an
>> autoscaling mechanism, e.g., cfncluster, which starts session host
>> instances if there's demand. The session starts on the new instance,
>> and the session information is added to the guacamole_db.
>> This is why I was thinking the it would be great to have a mechanism to
>> trigger the submission of the session creation script to the scheduling
>> system when a user logs in. As the start of an instance needs a moment,
>> I would like to have some way to inform the user about what's going on
>> in the background.
> That makes sense.  You should be able to do something like this in a
> Guacamole extension - monitor the number of users connected to a particular
> connection or connection group, and then trigger something every time
> there's a connect or disconnect.  I would imagine the most useful thing
> would be event listeners:
> If you trigger an action every time a connection is established or
> terminated, you can scale it in such a way that you always have 1 or more
> spare instances running (depending on how frequently and quickly you expect
> users to connect), and that would do the trick.  If you wanted to go even
> leaner than that, you could trigger it at user logon/logoff such that an
> instance was started when a user logged on to Guacamole, and, if there was
> sufficient time between logon and the user attempting to connect, this
> might work, as well, without having to keep as many (any?) spare instances.
> The other option is to use an external load balancer to accomplish this
> and then just point Guacamole at the load balancer.  I'm all for
> implementing cool extensions for Guacamole, but this may have some
> benefits, particularly in cloud-type environments where you're given these
> tools.  I'm thinking of AWS where you can do EC2 + Elastic Load Balancer
> (ELB) and ELB will actually manage the number of spare EC2 instances for
> you.  The plus side to this is that, at least in the case of AWS, it's
> already implemented.  You can also do some similar stuff with a load
> balancer like HAProxy, where you can look at the current user count vs.
> maximum count and start up or shut down instances with a script of some
> sort based on that.  I've done this in the past and it worked reasonably
> well.
> Anyway, plenty of possibilities for you - post back and let us know what
> you do and how it works!
> -Nick

View raw message