官术网_书友最值得收藏!

The Microsoft Machine Learning R Services architecture

The architecture of R Server covers many components needed in order for the communication between R IDE or SQL Server and R engine to work properly.

Several components are involved in order to properly execute Transact SQL, R script, and return all the results back to T-SQL:

Figure 7

Launchpad is a new service in SQL Server 2016 that supports execution of external scripts using the external stored procedure from SQL Server. However, in SQL Server 2017, the Python launcher has also been introduced, making Launchpad generally available to the second non-SQL Server language. The idea behind Launchpad is that since the infrastructure is already prepared, the SQL Server should, in the future, support other languages as well, such as JavaScript and C++, opening this service not only to predictive analytics and machine learning, but also to other standalone languages.

The Launchpad service (service name: MSSQLLaunchpad) is dependent on the SQL Server service (service name: MSSQLSERVER), which means that, when restarting or stopping a SQL Server service, the Launchpad service will be restarted or stopped also.

In addition, the R language has also brought two additional services: R Terminal service (abbreviated as RTerm) and BxlServer, which use SQL Satellite, an additional extension to SQL server that communicates between external runtime (correlating to the Launchpad service) and SQL Server; both can be found as processes.

For easier understanding of these correlations, let's start a simple PowerShell script to see all the components of Launchpad and BxlServer:

Get-Process -Name Launchpad | Select-Object * 
Get-Process -Name BxlServer | Select-Object *  

Additionally, with a simple T-SQL code, we can include the R script:

EXEC sp_execute_external_script 
    @language = N'R' 
   ,@script = N'library(RevoScaleR) 
OutputDataSet <- data.frame(rxInstalledPackages())' 

Additionally, observe the Process Explorer and Launchpad Process:

Figure 8

It is obvious how communication creates the entire circle from SQL Server to R and back.

Furthermore, the Command Line also reveals that the Launchpad process uses the RLauncher.dll library and launches sqlsatelitelaunch using sqlsatellite.dll:

CommandLine: "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\bin\launchpad.exe" -launcher RLauncher.dll -pipename sqlsatellitelaunch -timeout 600000 -logPath "C:\Program Files\Microsoft  SQL Server\MSSQL14.MSSQLSERVER\MSSQL\LOG\ExtensibilityLog" -workingDir "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\ExtensibilityData" -satelliteDllPath
"C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Binn\sqlsatellite.dll"   

Many more configurations will tell you where and how communication in this architecture is set up. Opening the RLauncher.config file will show you the following configuration:

Figure 9

Additionally, by changing the TRACE_LEVEL parameter, it can also reveal potential logs, showing same path and communication between the systems, as the RevoScaleR log also shows information on each worker session:

library(RevoScaleR); sessionDirectory <- 'C:\\PROGRA~1\\MICROS~3\\MSSQL1~1.MSS\\MSSQL\\EXTENS~1\\MSSQLSERVER01\\0FEB1004-867F-4AB6-B9CC-E1C824596645';sessionId <- '0FEB1004-867F-4AB6-B9CC-E1C824596645';scriptFile <- file.path(sessionDirectory, paste(sessionId, '.R', sep=''));rxIgnoreCallResult <- .Call('RxSqlSessionStart', list(sessionDirectory=sessionDirectory, sessionId=sessionId, waitTime=-1));source(scriptFile) 
主站蜘蛛池模板: 巴中市| 泗洪县| 榆树市| 镇原县| 兰考县| 成都市| 轮台县| 金昌市| 湖北省| 儋州市| 巫山县| 当阳市| 沙洋县| 建德市| 临汾市| 台中市| 东光县| 宁蒗| 城市| 永顺县| 呼玛县| 巍山| 金华市| 海口市| 监利县| 鄂尔多斯市| 耒阳市| 武宣县| 句容市| 饶阳县| 丰宁| 那坡县| 襄城县| 瓦房店市| 沙田区| 习水县| 社旗县| 手机| 西乌珠穆沁旗| 根河市| 阿拉善右旗|