RStudio Desktop slow and laggy when project is on a network drive

I have found that when I open an RStudio proj that's located on my corporate network, RStudio behaves very erratically and laggy. Creating a new file is slow... anything with git is painfully slow. I've monitored CPU and also network traffic and nothing is getting pegged out. There is hardly any network traffic and typical blips of CPU usage. But it's painful on a network drive. Note that my network drive is > 700 miles away but it's typically very usable. I regularly open large files and copy/save across the wire with other applications.

I've seen in old RStudio support periodic comments about RStudio being slow on a network connection, but nothing recently. Is this something others see?

I recorded a screencast so you all can witness what I'm talking about:

https://www.useloom.com/share/873c8875da824c1e9228cf879943e50f

I'm not sure if this is related, but I've found that R's file commands, file.copy for example are terribly slow across my network. Much more so than file system commands using the same machine. I would not think this would be related, but I thought I'd mention it. Here's a SO question where I illustrate the file system commands.

I am running RStudio Version 1.1.442

2 Likes

We had a similar issue that was reportedly fixed in the latest patch releases of RStudio (which it looks like you do have installed):

Could you also share the network log? In a newly launched RStudio session, try playing around a bit until you run into RStudio sluggishness, and then try pressing Ctrl + `. A screenshot of the longest bars you see in there would be helpful.

Kevin, thanks for nudging me to the network log. I didn't know that existed. seems my long bars are all get_events:

I'm happy to send you a full log, but it seems the forum does not support attaching text files to a message.

Is git any faster for you when you run it on command line? In my experience (mostly NFS) git is just much slower on a networking file systems. There are some tweaks you can try like Git - git-config Documentation.

yep. It's reasonable from the command line. In my example all the files are VERY small because I'm just illustrating the problem. If I tick a box in RStudio to select a file in the git pane, it takes >20 seconds for the little box to tick. And that's not really asking git to do anything, just selecting the file in the UI.

@jdlong In that particular case it is not that simple. When you click on the checkbox in the git pane RStudio runs git commands immediately. For instance if it is a new file I think it runs git add and git status.

yeah that makes total sense. Good point.

Thanks for the extra information! One thing to note is that RStudio (synchronously) runs git status every time an RStudio window gains focus, to ensure that the Git pane is up-to-date. If the attempt to call out to git is slow for some reason, that could definitely be a culprit.

Do you see the same kind of slowness in projects not managed by git?

It might also be useful to use something like procmon to see if RStudio appears to be calling out to a particular child process when this sluggishness occurs (if possible in your environment).

The full event log might not be useful quite yet -- the waiting on get_events likely implies that the rsession process was stuck doing something (or waiting for something); hopefully we'll be able to figure out what that is.

(As an aside, if possible, you might try installing a daily build of RStudio from https://dailies.rstudio.com just to see if the experience is any better.)

2 posts were split to a new topic: RStudio Desktop - Networked drive, laggy response

Hey @kevinushey, I have similar issues, i.e. sluggishness of RStudio while working in Projects on a network drive. A few things:

  • Not using git, and no hidden git files
  • Running the newest Rstudio daily build 1.2.862 right now
  • Windows 7
  • My Project is on the network drive

I mainly have issues in 3 places:

  • Using the File pane both for the first time and for general navigation is slow, and I get the spinning wheel a lot
  • Executing code often results in the Console just sitting there, with no red Stop sign (Using CTRL+ backtick I see "console_input" as the likely culprit) and then finally it all executes at once really quickly (meaning the R code itself wasn't the slow part, and RStudio was preventing the executed code from actually getting to R)
  • Saving / Deleting / Renaming files is also pretty slow occasionally (these might all be separate issues).

For the most part, can deal with 1 and 3 and blame my network drive for being slow, but 2 seems interesting. If you want screen shots of any of these, I can try and get you some.

Update) Including a few screenshots. I'll add more as I hit them in regular use.

Sluggishness when saving

Sluggishness with tab completion from a non-libraried package

Extreme sluggishness on startup

  • I was clicking around in this one trying to make it do anything so maybe that skewed the results, but essentially I opened RStudio and then tried to click around and see if different Panes were loaded (Files, Plots, Packages, etc) and they just showed a blue screen with nothing there until whatever is happening in the picture finished (took probably 30+ seconds). Maybe the check_for_external_edit is doing something?

Sluggishness with executing R code that should be fast

This specific example happened when running devtools::load_all(), but the package loads extremely fast so this shouldn't be an issue. I pressed Play to watch the live feed of this one, and as soon as lint_r_source_document turned blue the rest of the stack finished quickly, if that helps (took around 15 seconds).

Or maybe the common theme in all of these is a slow modify_document_properties?

Does disabling the Prompt to install missing R packages discovered in R source files option here help?

I'd also be curious to know whether .rs.listInstalledPackages() runs quickly for you, or if that's slow (e.g. because your R packages live on an NFS)

Disabling [x] Prompt to install missing R packages discovered in R source files doesn't seem to do a whole lot here.

But WOW .rs.listInstalledPackages() is slow. Yes, my R packages live on a network drive, and I think this is 95% of the issue with everything to do with the laggy Console.

Running:

# with network drive .libPaths()
.rs.listInstalledPackages() 
.libPaths("local/R/package/lib")
.rs.listInstalledPackages() 

This is night and day. In fact, I can barely even get the network drive version of .rs.listInstalledPackages() to run because it takes so long. Immediately after switching .libPaths(), it runs almost instantaneously.

Sadly I really like the network drive pkg setup because I have write access and my colleagues have read-only access and we all use the same library. This get's around a number of missing or clashing problems when others have to run my scripts.

The next slowest thing is the Files pane, but I could see that being separate from the network drive package library one. And it is much less intrusive. It is definitely also a network drive issue because if I open the same Project on my C drive it is blazing fast again.

I should also note that this network drive slowness is not unique to the new daily builds of RStudio. My 1.1.456 version experiences this slowness as well.

There are two places where RStudio attempts to list installed packages within the library paths:

  1. On startup, for population of the Packages pane;
  2. During dependency discovery, as in this particular case.

If the slowness is caused by this particular action I'd expect to see a one-time cost on RStudio initialization that goes away after this is done; disabling the aforementioned preference should avoid the cost on future calls.

1 Like