My slow Rstudio Server and DNS

I thought I'd post this to help others as well as to ask Posit to look into the number of DNS requests being made.

I'm on my home environment using a Windows 10 PC on the same switch as my Ubuntu 22.04 box which is running RStudio Server version 2023.12.1 Build 402.

It was incredibly slow. Commands like print("Hello") were taking 5 seconds at least. I was also getting error messages that the browser had lost connectivity and I should restart R in another window. This happened from my very first login attempt, which froze.

At first when having the lags and disconnects I ran nmon on the Rstudio server and looked for CPU, network and disk traffic. Essentially nada. Nothing justified 5 seconds or more lag.

To make a long story short, I gave the server a fixed IP address and added the name to my Windows hosts file (Windows/system32/drivers/etc/hosts) and it fixed the problem 100%. My DNS server is essentially my wifi router, by the way.

In production systems DNS lookups can really kill your performance, so while I have not really dug into the issue, or looked at the rendered code, I do want to suggest to the Posit team to examine if you aren't making excess DNS lookups while rending the page as well as to remember this for future users. I mean, we could argue that my wifi router is slow, but I'd argue that the code shouldn't be looking up the IP address on every request or perhaps increase the TTL for the DNS record. If I'm at all correct, then this will also affect users on slow VPN's connecting to corporate networks. Imagine what happens with the routinely variable network quality remote workers suffer from.

Anyway, good luck, I probably won't be following up on this since I got it all fixed up, if nothing else this may help others out there, and give them ideas such as setting up a local DNSmasq or whatever.

I thought I would add a little to this. My laptop (Windows 11) has an issue that the hosts file keeps getting overwritten. The entry for my RStudio Server host keeps being commented out, so every time I restart the laptop I have the problems described above.

I go to the hosts file and remove the comments and then it all works again.

Point is, I'm 100% sure that bad/slow DNS services can cause severe issues in loading RStudio Server. I'm not sure if Windows 11 is doing this or if this is caused by my anti-virus yet.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.