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.