how to run R as a daemon
As far as I am aware NuSOAP is pure PHP and not based on Python. The RSOAP server is based on Python. My understanding is that, if you want your R server to have some sort of longevity and manage lots of competing incoming requests or possibly to keep a session for one user over time, you will need to embed R into something capable of doing this. It could be a queue of some description or a database (there's an example using Postgres on the omegahat site) or a server of some sort (RSOAP uses python here for the things R doesn't have). You could even embed R in a PHP or an apache module, but as far as I am aware these don't yet exist yet and would require a fair bit of programming. R doesn't have an queue manager, but you could just leave R monitoring a port or a stdin and just refuse requests while the R session is busy - you run the risk of failing to satisfy some of your web requests. John Marsland
-----Original Message-----
From: Laurent Faisnel [mailto:laurent.faisnel at ariase.com]
Sent: 19 May 2003 13:22
To: Marsland, John
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] how to run R as a daemon
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);
setMethod("mymethod","myclass",
function(.Object)
{
# instructions
return(.Object);
}
);
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: http://www.devshed.com/Server_Side/PHP/AmazonAPI/AmazonAPI1/page3.html 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. Laurent
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
*************************************************************
*********
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. *************************************************************
*********
**********************************************************************
This is a commercial communication from Commerzbank AG.\ \ This ... {{dropped}}