RStudio Server part 3: using an ssh tunnel for high performance

[This article was first published on NumberTheory » R stuff, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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
  • localhost: local host
  • 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.

To leave a comment for the author, please follow the link and comment on their blog: NumberTheory » R stuff.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)