[R] R as a daemon?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 3 13:47:48 CET 2001


On 3 Jan 2001, MJ Ray wrote:

> kmself at ix.netcom.com writes:
> 
> > I have a GNU/Linux / Unix application in which I'd like to have an R
> > process running in a persistant state, while receiving instructions (and
> > data) from another process, and returning results to this process.
> [...]
> > Has anyone experimented with this or developed a similar solution?
> 
> I intend to work on a similar thing from Perl for release 5 of Rcgi,
> but that's a little way off just yet.  (Release 4 should be out this
> week.)  The benefits of this are obvious: one of the heaviest bits of
> Rcgi is the repeated start-up of R; if maybe not as great as first
> thought: after the first start, most of R will be cached in memory if
> you have a reasonable amount and there's a performance loss from the
> extra housekeeping.
> 
> My first thought is to connect it to a local socket via a process
> doing access control, some stupidity checking (such as not passing
> EOFs on to R) and housekeeping.  Is that sane?

That's been done a few times.  R --slave is there for such purposes: just
connect stdin and stdout/err to pipes, feed a command to stdin and read
the output on stdout (if any), watching that you send complete
expressions.  As of 1.2.0 you can embed Unix R (you have been able to do
so for ages on Windows) and that might be a neater solution.

For an cgi version I would be worried about statefulness.
How are you going to stop one command doing something (overwriting
system functions, for example) that does not affect later ones
submitted by other people?   This applies to DCOM servers etc too,
but there one usually has more idea of what might happen.

There are more possibilities using Omegahat componentry: look on
www.omegahat.org.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list