Blog

Linux ThinLinc

Resource challenges in multi-session environments

Feb, 13, 25

As software applications grow more complex, the need for efficient resource management becomes increasingly important. From rendering complex graphics to AI model training and large-scale simulations, modern applications often push the limits of system resources. In multi-session environments — such as those found in ThinLinc clusters — multiple users share the same hardware, leading to challenges in managing CPU cycles, memory allocation, and file system access. Ensuring an efficient and secure resource sharing is essential to maintaining system stability and delivering a smooth user experience.

One solution to manage system resources in multi-user environments is through cgroups (control groups). Cgroups are a Linux kernel feature that allows administrators to allocate and limit system resources like CPU, memory, disk I/O, and network bandwidth for process groups. Think of cgroups as virtual containers that enforce resource rules, ensuring critical applications get what they need while preventing others from overusing the system.

In multi-session environments, where users compete for resources, cgroups help maintain stability. If a process exceeds its memory limit, it is terminated by the Out-of-Memory (OOM) killer, while excessive CPU usage is throttled. However, even with cgroups, resource contention can still occur. If an extra user logs in beyond the system’s capacity, the increased demand can degrade performance for everyone, potentially slowing down or crashing critical applications.

While CPUs and system memory are designed to handle multi-user workloads, GPUs are generally not. GPUs excel at parallel computations, making them essential for scientific modeling, AI training and rendering tasks. However, many GPU-accelerated applications are designed with the assumption that they have exclusive access to the GPU and its full pool of memory. This lack of flexibility can lead to memory allocation issues that become a major problem in multi-session environments. VirtualGL offers a potential workaround for classic rendering and real-time graphics, but in many situations enforcing a hard limit of one user per GPU may be necessary to avoid resource conflicts.

$ sudo /opt/thinlinc/bin/tl-config \
       /vsmserver/subclusters/Default/max_users_per_agent=1

In ThinLinc clusters, the lack of memory-sharing capability can affect both stability and user experience. We’ve seen growing customer demand for solutions that enforce hard limits on the number of users per agent to prevent resource conflicts. As mentioned in Introducing ThinLinc 4.18.0, ThinLinc 4.18 introduces a feature to limit concurrent users per agent in a subcluster. Configurable through both the web-based administration interface and configuration files, this ensures the load balancer does not allow additional users to connect to an agent that has reached its user limit, preserving performance and preventing resource exhaustion. This capability, combined with cgroups for CPU and memory management, helps ensure fair distribution of computing power and prevents system overload. By enforcing these limits, multi-session environments can achieve better performance stability and an improved user experience.