- SQL Server 2017 Machine Learning Services with R
- Toma? Ka?trun Julie Koesmarno
- 433字
- 2021-06-24 19:03:44
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:

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:

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:

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)
- Hands-On Intelligent Agents with OpenAI Gym
- 大數據管理系統
- 平面設計初步
- Go Machine Learning Projects
- Visual FoxPro 6.0數據庫與程序設計
- 西門子S7-200 SMART PLC從入門到精通
- Linux服務與安全管理
- SAP Business Intelligence Quick Start Guide
- R Machine Learning Projects
- AVR單片機工程師是怎樣煉成的
- Unreal Development Kit Game Design Cookbook
- Raspberry Pi 3 Projects for Java Programmers
- 暗戰強人:黑客攻防入門全程圖解
- 從虛擬化到云計算
- 系統與服務監控技術實踐