Package availability on the server

R packages are deployed on the server by the package developer, who must decide when and how the package can be accessed by the code.

Developers can use the Administration APIs to deploy, update, or remove their packages from the server. In a clustered environment, when a package is deployed to a Manager node, the package is automatically made available to all Worker nodes in the cluster.

Every time a request is sent to the server, an available engine starts to process the request.

You can ensure that a package is available in the running engine in one of two ways:

  • Loads when needed: To load the package only when an application requires it, the client developer can add a call to library(packagename) in the application prior to accessing any of the package functions.
  • Always loaded when an engine starts: To ensure that a package always loads whenever an engine starts, set the server property engine.init.expr or engine.init.file to define initialization code. (To use engine.init.file, you must create an initialization file and specify its path in engine.init.file. See the description of this server property for more information.)
    Note: This method should be used only if needed, because loading a package every time the engine starts can have a detrimental effect on performance.