在会话中预加载包和模型,以加快Web服务响应时间 [英] Preload packages and models in a session for faster web-service response time
问题描述
我正在将R脚本(数据转换+评分)部署为机器学习服务器中的Web服务并减少处理时间,我想预先加载包,模型对象和其他配置文件/数据只需
一次并保留在内存中。有办法吗?我读到可以创建专用会话池,但找不到传递初始化脚本的选项,该脚本将执行此工作一次。
预加载库的方法是通过用户特定的.Rprofile脚本或通过系统范围的Rprofile.site文件,存储在:
C:\ Program Files\Microsoft\Machine Learning Server \ R_SERVER \etc\Rprofile.site
在文件末尾放入你的library()语句预加载计算节点上的特定软件包。
您需要在所有计算节点上安装库。
有关Rprofile的更多信息,请参阅以下参考:
https:// www.r-bloggers.com/fun-with-rprofile-and-customizing-r-startup /
https://docs.microsoft.com/en-us/machine-learning-server/operationalize/confi古尔-管理-R-封装
I am in the process of deploying a R script (data transformations + scoring) as a web service in the machine learning server and to cut down on the processing time, I would like to preload the packages, model objects and other config files/ data just once and keep in memory. Is there a way to do it? I read that dedicated session pools can be created but could not find an option to pass an initialization script which will do this work one time.
The way to preload libraries is via a user-specific .Rprofile script or via the system-wide Rprofile.site file, stored under:
C:\Program Files\Microsoft\Machine Learning Server\R_SERVER\etc\Rprofile.site
At the end of the file put your library() statements to preload a specific package(s) on the compute nodes.
You will need to install the libraries on all the compute nodes to begin with.
For more information on Rprofile see these references:
https://www.r-bloggers.com/fun-with-rprofile-and-customizing-r-startup/
https://docs.microsoft.com/en-us/machine-learning-server/operationalize/configure-manage-r-packages
这篇关于在会话中预加载包和模型,以加快Web服务响应时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!