In part 2 of this series of posts on RStudio Server, I commented that I suspected that RStudio Server would be fast. The first time I tried this from a remote connection, I was disappointed with the performance. Many companies filter their http traffic, for example to be able to block Youtube. This takes time ofcourse, and reduces performance. If the company allows ssh connections, you can use a neat trick to get much better performance with RStudio Server by using an ssh tunnel. Assuming you have access to a bash shell (Linux, Mac, and Cygwin should work), open an ssh tunnel like this:
ssh -f -N -L 1234:localhost:443 [email protected]
The ssh command is built up like this (partly from the manpage of ssh):
-f: Requests ssh to go to background just before command execution
-N: Do not execute a remote command. This is useful for just forwarding ports.
-L:Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.
1234: local port
443: remote port
- [email protected]: username and hostname of the server where RStudio Server is running
Accessing RStudio can now be done be typing
localhost:1234 into your web browser. Now the connection is secure through ssh, and fast because it is not seen as http traffic. This vastly increased performance in my case.