RServe生成的进程是否可能共享一些加载到内存中的公共库?假设我需要在100个不同的RConnections上同时执行下面的代码。
library(libraryOfSize40MB)
fun()这意味着我需要3.9GB的内存来加载库。我希望加载一次库,然后执行fun() 100次,这样我就可以在廉价的主机上运行这个库了。
也许这有用吗?https://github.com/s-u/Rserve/blob/master/NEWS#L40-L48
发布于 2015-07-17 08:20:29
这是可能的。您必须使用加载库前面的RServe从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 availablehttps://stackoverflow.com/questions/31433840
复制相似问题