我試圖從flexsurv包使用opencpu調用一個函數。我在OSX Sierra上運行。Opencpu調用需要比預期更長的時間
我已經修改了我的opencpu .conf文件包含在預加載的軟件包列表flexsurv:
{
"enable.api.library": true,
"enable.api.apps": true,
"enable.api.bioc": true,
"enable.api.cran": true,
"enable.api.gist": true,
"enable.api.github": true,
"enable.api.user": true,
"enable.api.tmp": true,
"enable.cors" : true,
"enable.post.code": true,
"error.showcall": true,
"gist.cache": 300,
"github.cache": 86400,
"cran.cache": 86400,
"public.url" : "https://public.opencpu.org/ocpu",
"smtp.server" : "localhost",
"httpcache.post": 300,
"httpcache.lib": 86400,
"httpcache.git": 900,
"httpcache.gitapi": 120,
"httpcache.tmp": 86400,
"httpcache.cran": 86400,
"httpcache.static": 31536000,
"httpcache.bioc": 31536000,
"key.length" : 9,
"appspaths": "/usr/local/lib/opencpu/apps-library",
"repos": "http://cran.rstudio.com",
"rlimit.as": 2e9,
"rlimit.fsize": 1e8,
"rlimit.nproc": 50,
"timelimit.get": 600,
"timelimit.post": 90,
"timelimit.webhook": 900,
"preload": ["ggplot2", "lattice","survival","flexsurv"]
}
我然後開始開放的CPU,並在捲曲以下電話:
curl localhost:7210/ocpu/library/flexsurv/R/pgompertz/json -d "q=[0,1,2,3]&shape=0.001&rate=0.001" -w "%{time_total}\n" -o /dev/null
這個調用大概需要1.4秒,儘管它是一個非常簡單和快速的函數調用,應該不會花費任何時間。
相比之下,呼籲RNORM繪製萬個隨機樣本的正常回報,在不到半秒:
curl localhost:7210/ocpu/library/stats/R/rnorm/json -d "n=100000" -w "%{time_total}\n" -o /dev/null
爲什麼會比較簡單flexsurv電話用不了這麼多更多的時間?預加載不工作?如果是這樣,我該如何解決這個問題?如果不是,導致額外延遲的是什麼?
任何幫助深表感謝......