[R] R under JVM
R. Michael Weylandt
michael.weylandt at gmail.com
Fri Jun 15 17:16:07 CEST 2012
On Fri, Jun 15, 2012 at 9:36 AM, <ANGELO.LINARDI at bancaditalia.it> wrote:
> Dear all,
>
>
>
> first of all I apologize for not having changed the object.
Subject you mean. Linguistically, it is perhaps a little arbitrary,
but that's the name the email gods chose long ago and I tend to agree
with them. I tend to think more "subject" as in "subject matter" than
"subject of a sentence" here.
>
> I just re-used an old email I sent some time ago.
>
> The let us go into the question.
>
> Our architecture is the following:
>
>
This photo didn't make it past the mailing list servers [which also
don't like HTML] Going on what you sent me privately though, I'm
still not sure why you have R in the JVM box or why the JVM box is so
much bigger than the Java box. Pending correction [as often happens],
I'm pretty sure that R on the JVM just doesn't exit. I think that
would require almost an entire rewrite of the system.
If I understand your architecture correctly, I'd imagine something
more like this: [ASCII art time!]
------- JVM -----------
---- JAVA ----
JDBC
|
|
Algoritmo
|
---- JAVA ----
------- JVM -----------
|
RNI
|
R
and you want something like
------- JVM -----------
---- JAVA ----
JDBC
|
|
Algoritmo
|
---- JAVA ----
------- JVM -----------
|
RNI
/ | \
R R R
I'd really like to draw RNI right on the JVM border, but my skills are
rather limited in this particular undertaking.
>
> A (set of) java programs running under a jvm that passes data and instructions to an R instance via RNI
>
> and at the end of the process extracts calculated data from R.
>
>
>
>
>
> The question is: can I define a new JVM with a new instance of R on the same machine ?
See remark above regarding R. It should be possible to have multiple
JVMs on a single server.
>
> How can I spawn multiple R independent instances using the same package libraries ?
If you are using the regular (CRAN-build) interpreter [though on RHEL
you might not be -- I don't know who does that build, but it shouldn't
be relevant] simply starting two processes "the old fashioned way"
_does_ create independent instances. As I said before, everything is
"in-memory" for R, so as long as you don't write to the package
library or the data sets, they will be totally independent. (Even the
RNGs will be independent by default)
>
> Should I instead "duplicate" the initial R installation to get different
>
> instances with different libraries ? Is it enough or even in this case
>
> the different instances "share" something so they are not really "fully
>
> independent" ?
As noted above, they both read the same package library but because
they are in-memory, they should be independent unless you go out of
your way to mess things up.
Incidentally, you may wish to look at Simon Urbanek's fantastic work
on rJava which allows both-way connectivity and probably places nicer
with R than proprietary windows projects.
Best,
Michael
>
>
>
> Thanks again
>
>
>
> Angelo
>
> -----Messaggio originale-----
> Da: R. Michael Weylandt [mailto:michael.weylandt at gmail.com]
> Inviato: venerdě 15 giugno 2012 16.16
> A: LINARDI ANGELO
> Cc: r-help at r-project.org
> Oggetto: Re: [R] R: Securities earning covariance
>
>
>
> I'm somewhat confused:
>
>
>
> i) What does this have to do with your subject line?
>
>
>
> ii) There does not exist -- to my knowledge -- an implementation of R
>
> which runs on the JVM.
>
>
>
> iii) Have you simply looked into R's native parallel computing
>
> options? That seems to be (maybe?) what you are trying to do.
>
>
>
> Incidentally, thanks to the in-memory model, it is possible to spawn
>
> multiple R processes which use the same package libraries [the package
>
> is the thing in the library, which is tied to the filesystem] on the
>
> same machine (I'm thinking real, but this shouldn't be a problem with
>
> a reasonable VM setup either)
>
>
>
> Michael
>
>
>
> On Fri, Jun 15, 2012 at 3:05 AM, <ANGELO.LINARDI at bancaditalia.it> wrote:
>
>>
>
>> Good morning.
>
>>
>
>> I have a real fuzzy question to ask; we have a calculation engine which
>
>> is composed by n virtual machines each of them with a jvm 2GB of memory
>
>> on Linux Red Hat each of them with the "R" package which comes along
>
>> with the Red Hat Linux distribution.
>
>> We have now to increase the number of "nodes" trying to avoid to use new
>
>> virtual or physical machines. So my question is: is it possible to
>
>> install multiple jvm on the same machine each of them with its
>
>> independent instance of R ?
>
>> Should I "duplicate" the initial R installation to get different
>
>> instances with different libraries ? Is it enough or even in this case
>
>> the different instances "share" something so they are not really "fully
>
>> independent" ?
>
>> Thanks so much for you help
>
>>
>
>> Angelo Linardi
>
More information about the R-help
mailing list