RServe 共享库代码

RServe share library code

RServe 生成​​的进程是否可能共享一些加载到内存中的公共库? 想象一下,我需要同时在 100 个不同的 RConnections 上执行下面的代码。

library(libraryOfSize40MB)
fun()

这意味着我需要大约 3.9GB 的内存来加载库。我宁愿加载一次库然后执行 fun() 一百次,这样我就可以 运行 在便宜的主机上执行此操作。

也许这有帮助? https://github.com/s-u/Rserve/blob/master/NEWS#L40-L48

有可能。您必须 运行 从 R shell RServe 使用 run.serve 前面加载的库:

library(Rserve)

#load libraries so all connections will share them
library("yaml")
library("reshape")
library("rjson")
library("zoo")
(...)
library("stringr")

run.Rserve(debug = TRUE, port = 6311, remote=TRUE, auth=FALSE, args="--no-save", config.file = "/etc/Rserve.conf")

每个新连接都可以看到这个库

library(RSclient)
con = RS.connect(host='10.1.2.3')
RS.eval(con, quote(search()))
> #lots of libraries available