[R] R Production Performance

Joe Conway mail at joeconway.com
Thu Sep 25 07:00:44 CEST 2003

Zitan Broth wrote:
> That sounds cool, it also avoids the file IO.  I'm an R newbie, but could I
> achieve something similar with pure PHP.

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 am currently working with MySQL for a demo project,
> but we have always been considered Postgres as a more robust
> database (it actually has stored procedure languages for example).

Yes, in fact that is exactly what PL/R is -- a handler that allows your 
stored procedures to be written in R.

> I think I may have to give your PL/R a serious look (although I
> can't access you site just now).

Sorry about that. I've been having hardware problems with my server 
lately. It's back up now, and hopefully will stay up until I have a 
chance to replace a bad drive this coming weekend.

> Are you 'process managing' your calls to R to ensure that it is thread safe
> or have you found this unnecessary with the php/postgres/R combo?

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.

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.


More information about the R-help mailing list