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

February 8, 2012

(This article was first published on NumberTheory » R stuff, and kindly contributed to R-bloggers)

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. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


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)