[R] how to run R as a daemon

Laurent Faisnel laurent.faisnel at ariase.com
Mon May 19 14:21:45 CEST 2003

I  just visited the link you gave me. One of the problems that could 
occur using NuSOAP is that I do not intend using Python. Thanks anyway. 
I would also like to ask more precise questions :
- is it possible to run R as a standalone service, which runs in 
background indefinitely, waiting for instructions ? This would be a 
great improvement for me, since each time it is launched R has to 
re-load a (constant) matrix generated thanks to a database connection 
(takes a very long while)
- my R script is object-oriented; I define classes and methods, but I'm 
not so sure about how methods should be declared; I usually write 
something like :

mymethod <- function(.Object) UseMethod("mymethod",.Object);

            # instructions

Perhaps is this not the best way to write methods ? Could this explain 
the following fact : when I run the script, R spends about 1/3 of its 
thinking time creating the generic functions linked with my methods. 
Isn't this wasted time ? The same script may be executed many times 
consecutively by different users, and each time R has to re-define the 
generic functions ! (are always the same)

I use R 1.6.2 on a Linux server (Red Hat - soon Debian)

Marsland, John wrote:

>Why not run R as a separate process using the RSOAP package.
>You can then converse with R as a web service using the NuSOAP PHP class as
>described in the case of the Amazon example below:
>John Marsland
>>-----Original Message-----
>>From: Laurent Faisnel [mailto:laurent.faisnel at ariase.com]
>>Sent: 19 May 2003 11:43
>>To: r-help at stat.math.ethz.ch
>>Subject: [R] how to run R as a daemon
>>Hi all,
>>Using R a as a real-time application called by Php for a website, I 
>>would like to run one R process only, which would manage user 
>>connections. For the time each user who asks for an analysis causes a 
>>new R process to start, which is not suitable in prevision of many 
>>users. R needs about 30 seconds to run the script which makes the 
>>analysis. The problem is that this waiting time is n times more 
>>important when n users ask for an analysis...
>>Thanks for any help.
>>R-help at stat.math.ethz.ch mailing list
>This is a commercial communication from Commerzbank AG.
>This communication is confidential and is intended only for the person to
>whom it is addressed.  If you are not that person you are not permitted to
>make use of the information and you are requested to notify
><mailto:LONIB.Postmaster at commerzbankib.com> immediately that you have
>received it and then destroy the copy in your possession.
>Commerzbank AG may monitor outgoing and incoming e-mails. By replying to
>this e-mail you consent to such monitoring. This e-mail message and any
>attached files have been scanned for the presence of computer viruses.
>However, you are advised that you open attachments at your own risk.
>This email was sent either by Commerzbank AG, London Branch, or by
>Commerzbank Securities, a division of Commerzbank.  Commerzbank AG is a
>limited liability company incorporated in the Federal Republic of Germany.
>Registered Company Number in England BR001025. Our registered address in
>the UK is 23 Austin Friars, London, EC2P 2JD. We are regulated by the
>Financial Services Authority for the conduct of investment business in the
>UK and we appear on the FSA register under number 124920. 

More information about the R-help mailing list