RServe share library code

前端 未结 1 424
暗喜
暗喜 2021-01-06 09:26

Is it possible that processes spawned by RServe share some common libraries loaded once into memory? Imagine that I need to execute bellow code on 100 different RConnections

相关标签:
1条回答
  • 2021-01-06 10:20

    It is possible. You have to run RServe from R shell using run.serve preceded by loaded libraries:

    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")
    

    Every new connection will be able to see this libraries

    library(RSclient)
    con = RS.connect(host='10.1.2.3')
    RS.eval(con, quote(search()))
    > #lots of libraries available
    
    0 讨论(0)
提交回复
热议问题