[R] R Production Performance

Zitan Broth zitan at mediasculpt.net
Tue Sep 30 22:03:27 CEST 2003

Hi Joe,

Thanks for your follow up note ....

> I don't know of a way to achieve it with pure PHP short of writing your
own C extension to PHP. I had considered that at one point, but have found
it unnecessary since my data is already in Postgres and PL/R lets me do what
I need.

I could use swig (http://swig.sourceforge.net/) but I'd need to understand
how to access R's c functions directly, which could be a little tricky. We
may well go with the Postgres Option you have provided, my only reservation
is that using PHP makes for an easy LVS (Linux Virtual Server) roll out if
we need to scale.  However the counter to this argument is that the database
is more robust and faster - so its a toss up ;-)

> There are no thread safety issues because Postgres is multi-process, not
> multi-threaded. Each database connection gets its own private copy of R,
> and only does one thing at a time.

Right but R is only "preloaded" once?  I personally think multi-processing
is a definite enterprise alternative to multi-threading, given the right
technology ;-)

> There may be some considerations if you do connection pooling or use
> persistent connections though. I haven't needed that so far, so I can't
> say I've thought much about it yet.

Yeah persistent connections are nice for performance, but I can't see how
this (or pooling db connections) would affect the database or the
architecture of PL/R.


More information about the R-help mailing list