Problem
Your home directory can fill up as a result of large amounts of session or project data being written to file. The home directory is part of your server’s file system or it is mounted to it from a network file system. The home directory is essential in managing user configuration files and maintaining a consistent experience across the network. When the home directories fill up the system ceases to function properly.
Causes
RStudio Server uses the home directory as the default location for configuration files and project files. There are typically two causes for filling up the home. The first is when users write large project files to home. The second is when large sessions timeout and RStudio Server automatically writes sessions to home.
- Project files written to home. Most analytic projects require temporary scratch space and on-going project space. One feature in R is to save your workspace as an
.RData
file so that you can restore your workspace at some later date. RStudio Server gives you the option set the default (always/never/ask) when saving and restoring your workspace. By default new projects are started in home and thus.RData
files are often written to home. - Suspended sessions. RStudio Server comes with a feature to save suspended sessions by default. When a session exceeds the timeout it is automatically written into the
.rstudio
directory which is stored in home.
The .rstudio directory
All of the information pertaining to the configuration and management for a specific user is contained in the .rstudio
directory. This directory contains a lot of useful information, such as your global settings, your code history, addins, etc. It also contains all your session information including the number of sessions and active state. Session information also includes suspended data.
The .rstudio
file has two essential types of information. The first is settings and configurations. These are used for the operation of RStudio Server. The second is suspended data which includes live data from your analysis that is written to file when a session is suspended.
Solutions
If your home directory is small or has quotas and your projects or sessions are large, you may inadvertantly fill up the allocated space to your home directory. If you are filling up your home on regular basis, you have a few options for dealing with the problem.
Automatically Deleting Unused Sessions
As an administrator, you have the ability to automatically suspend sessions to disk after a certain period of inactivity by specifying the session-timeout-minutes option in /etc/rstudio/rsession.conf. RStudio Server Pro v1.1 adds the ability to also kill and delete these sessions entirely after a certain amount of hours, freeing up valuable system resources. Simply add the following line to /etc/rstudio/rsession.conf.
session-timeout-kill-hours=96
This setting will kill and delete any inactive sessions that have not been used for the specified hours. You should set a long timeout period to ensure that only sessions users have forgotten about or no longer need are deleted, as the session’s data is lost forever. Again, for more information, see the RStudio Server Pro Administration Guide.
Start new projects outside of home
You may want to start new projects in some other location outside of home. This can be done by specifying the project path in the new projects dialog box. Server administrators can select a default location for new projects by specifying the session-default-new-project-dir
option in the /etc/rstudio/rsession.conf
file. By default all .RData
files associated with the project will be routed to the project directory instead of home.
Turn off the session time out
You can turn off the session timeout by setting session-timeout-minutes
to zero minutes in the /etc/rstudio/rsession.conf
file.
session-timeout-minutes=0
Turning off the session timeout will prevent RStudio Server from automatically writing the session data to the home directory. If you are dealing with large amounts of data or a large number of sessions, turning off the session timeout could save a lot of space in your home directory. The session timeout setting can optionally be specified at the user or group level by adding session-timeout-minutes
to the /etc/rstudio/profiles
file.
Alternative Solution
Warning: The following solution is not supported. If you move .rstudio
to a new location it could potentially produce unexpected results. We recommend storing .rstudio
in your home directory.
Moving the .rstudio directory
If you are filling up the home directory because of suspended sessions and you do not wish to turn off the session timeout, you can manually move the .rstudio
directory to some other location. You first create a new target location and then move the .rstudio
under the target. Then create a symlink between the old and new locations.
$ TARGET=/tmp
$ mv ~/.rstudio/ $TARGET/.
$ ln -s $TARGET/.rstudio/ ~/.rstudio
You will have to move each user's .rstudio
directory separately or create a process to do so. When a new user logs in make sure to relocate that user's .rstudio
directory also. Logins may fail if users do not have access to the correct directory.
Comments