Problem
There may be times when you might notice your RStudio Workbench server is slower than usual. This can be short & sporadic bursts of slow response, or it can be for prolonged periods of time. Rebooting the server may often resolve the issue for a short while, however, the issue can emerge again and cause an interruption to workflow.
What causes slow speed on RStudio Workbench?
If your Workbench instance has periods where it works fine but then will become slow or unresponsive at certain times, more often than not, the cause is either one of the following:
- A process running in the background is occupying compute resources such as memory or CPU.
- A user is running a resource-intensive code block that is utilizing enough compute resources to not allow other users to launch new sessions, or run their current session smoothly.
What can I do to fix the slow speed issue?
This will depend on what the root cause of the issue is, however, it doesn't hurt to follow the process of elimination to determine what's causing the slow speed issue. A good first step is to check to see if any processes are running in the background so that rogue or unwanted processes may be identified.
RStudio Workbench does not run any CPU or memory-intensive processes in the background, so this is typically external to Workbench. Usually, this is caused by backups or jobs running in the background. It is a good idea to SSH into the server and run the following command when the issue with slow speeds arises:
top
All running processes will be displayed by this command. Programs that utilize high CPU or memory will be at the top of the list and the process ID will be shown to the left of the screen.
e.g.,
By running the following command, you can terminate a process using a lot of CPU or memory:
sudo kill 806
Note: If there are multiple processes that are utilizing high CPU, then you may need to kill multiple processes.
This check will also identify if there are any users that are running large blocks of R code that are CPU intensive. If the issue appears to be related to a user on RStudio Workbench, terminating the user's process will only provide a short-term solution. When they start running the code again, then this will start to cause slow speed issues again.
Enabling the Administrative Dashboard
A good way to identify users utilizing high CPU and memory usage is to enable the administrative dashboard by modifying your /etc/rstudio/rserver.conf configuration file:
admin-enabled=1
admin-group=rstudio-admins
Then, restart RStudio Workbench as below:
sudo rstudio-server restart
More information on the admin dashboard can be found here:
https://docs.rstudio.com/ide/server-pro/server_management/administrative_dashboard.html
Setting Resource Limits
If you do find that a particular user(s) are occupying a large amount of compute resources, you can set limits on each user profile by modifying the /etc/rstudio/profiles configuration file as below:
[*]
cpu-affinity = 1-4
max-processes = 800
max-memory-mb = 2048
session-limit=5
session-timeout-minutes=60
session-timeout-kill-hours=24
[@powerusers]
cpu-affinity = 5-16
nice = -10
max-memory-mb = 4096
session-limit=10
[jsmith]
r-version = /opt/R/3.1.0
session-timeout-minutes=360
This will restrict the number of resources used by each user profile and will prevent other users being affected by each others work on the server. More information about resource limits can be found here:
https://docs.rstudio.com/ide/server-pro/r_sessions/user_and_group_profiles.html
Support Ticket
If you still have issues after completing the above, you can always lodge a support ticket, where our group of friendly, and incredibly knowledgeable staff can assist with any issues that you may be having. You can submit a ticket here:
https://support.rstudio.com/hc/en-us/requests/new
Comments