SQL Server on Linux
-
Upload
fabricio-catae -
Category
Technology
-
view
395 -
download
0
Transcript of SQL Server on Linux
![Page 1: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/1.jpg)
SQL Server on Linux
Fabricio CataeTechnical Evangelist
MVP Open Connection 2017
![Page 2: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/2.jpg)
SQL vNext on LinuxDeep Dive
![Page 3: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/3.jpg)
Agenda
SQL Operating System
Projeto MSR: Drawbridge
Docker Containers
![Page 4: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/4.jpg)
Pré-Requisitos (SQL Linux)
Suporte:
• OS: RHEL 7.3, SLES v12 SP2, Ubuntu 16.04
• Docker Engine 1.8
Mínimo 3.25 GB (testado até 1TB)
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup
![Page 5: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/5.jpg)
Instalação: Passo a Passo
1. Registrar o repositório
curl https://packages.microsoft.com/keys/microsoft.asc
| sudo apt-key add -
curl https://packages.microsoft.com/.../mssql-server.list
| sudo tee /etc/apt/sources.list.d/mssql-server.list
2. Instalar o SQL Server: apt-get (Ubuntu)
![Page 6: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/6.jpg)
Demo
![Page 7: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/7.jpg)
SQL OSSQL knows better...
![Page 8: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/8.jpg)
Escalabilidade Negativa
1
2
4
8
![Page 9: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/9.jpg)
História do SQL OS
User Mode Scheduling (UMS)
SQL OS
Inside the SQL Server 2000 User Mode SchedulerBetween versions 6.5 and 7.0, however, it became evident that SQL Server was beginning to hit a "scalability ceiling." Its ability to handle thousands of concurrent users and efficiently scale on systems with more than four processors was hampered by the fact that the Windows scheduler treated SQL Server like any other application
UMS: https://technet.microsoft.com/en-us/library/aa175393(v=sql.80).aspx
![Page 10: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/10.jpg)
Gerenciamento de Recursos
Free Memory = Bom ou Ruim?
SQL 2000 (pre-SP3):
if ( GetAvailableMemoryMB() < 4 )
...
SQL 2000 Memory Management: https://technet.microsoft.com/en-us/library/aa175282(v=sql.80).aspx
![Page 11: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/11.jpg)
Evolução do SQLOS
Onipresente: Atua como um Sistema Operacional
Processamento Cooperativo e Preemptivo
Dynamic Management Views
- Materizalição das informações em memória
- Semelhante ao /proc do Linux
![Page 12: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/12.jpg)
Estratégia de Migração
Exemplos:
• Core CLR
https://github.com/dotnet/coreclr
• ChakraCore
https://github.com/Microsoft/ChakraCore
![Page 13: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/13.jpg)
BackgroundSe você fosse o Líder Técnico...
![Page 14: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/14.jpg)
Cenário de 2015
SQL Server é um produto consolidado
Escrito em C++
40 milhões de linhas
Ferramenta de build e teste
Complexidade de projeto
![Page 15: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/15.jpg)
Grandes Desafios
Duração do projeto (3 anos?)
Manter diferentes branches
Incorporar novas funcionalidades
Legado: MSDTC, .NET, COM
![Page 16: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/16.jpg)
DrawbridgeProjeto Microsoft Research
![Page 17: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/17.jpg)
CenárioProblema: Máquina virtual requer muito disco e memória
Proposta: Aumentar densidade de máquinas virtuais
Rethinking the Library OS from the Top Down (2011)
This paper revisits an old approach to operating system construction, the library OS, in a new context. The
idea of the library OS is that the personality of the OS on which an application depends runs in the address
space of the application. A small, fixed set of abstractions connects the library OS to the host OS kernel,
offering the promise of better system security and more rapid independent evolution of OS components.
We describe a working prototype of a Windows 7 library OS that runs the latest releases of major
applications such as Microsoft Excel, PowerPoint, and Internet Explorer.
https://www.microsoft.com/en-us/research/publication/rethinking-the-library-os-from-the-top-down/
![Page 18: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/18.jpg)
Library OS
NT User Mode (NTUM)
-ntoskrnl.exe
CreateProcess
-csrss
- lsass
-svchost
-Application.exe
![Page 19: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/19.jpg)
Objetivo Inicial
Sandbox de Aplicação
Leveraging legacy code to deploy desktop applications
on the Web (2008)
John (JD) Douceur, Jeremy Elson, Jon Howell, Jay Lorch, in
Proceedings of the 8th USENIX Symposium on Operating Systems
Design and Implementation (OSDI), USENIX, December 1, 2008
https://www.microsoft.com/en-us/research/publication/leveraging-legacy-code-to-deploy-desktop-
applications-on-the-web/
![Page 20: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/20.jpg)
Powerpoint, Excel, Paint, IE
![Page 21: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/21.jpg)
Picoprocess
![Page 22: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/22.jpg)
Processo NT
Inicialização
-ntdll.dll
-PEB
-TEB
-LdrInitialize
-CreateThread
https://www.microsoft.com/mspress/books/sampchap/4354.aspx
![Page 23: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/23.jpg)
Demo
![Page 24: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/24.jpg)
SQLPALPlataform Abstraction Layer (PAL)
![Page 25: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/25.jpg)
Application Binary Interface (ABI)
800+ Win32 calls
400+ NT calls
--------------------
45 ABI calls (Drawbridge)
![Page 26: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/26.jpg)
Formatos Binários
ELF PE
![Page 27: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/27.jpg)
SQLSERVR.EXE on Linux
Binário ELF
Linux
sqlservr
(ELF)“NTUM” (ABI)
sqlservr.exe (PE format)
PAL
![Page 28: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/28.jpg)
SQLSERVER.SFP
Arquitetura
sqlservr
(ELF)
sqlservr.exe
sqlos.dll
sqldk.dll
sqlmin.dll
sqllang.dll
...
“SQLPAL”
“NTUM”
“Drawbridge”
![Page 29: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/29.jpg)
Pacotes SFPEmpacotamento de arquivos
- Semelhantes ao TAR
File System composto por múltiplos arquivos
- sqlpackage.sfp
- sqlservr.sfp
- system.certificates.sfp
- system.common.sfp
- system.netfx.sfp
- system.sfp
![Page 30: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/30.jpg)
Demo: Hekaton
In-Memory Tables
- Tables with no latch/lock
Native Stored Procedure
- Compiler: \Xtp\VC\bin\cl.exe
- Input: *.c
- Output: *.dll
![Page 31: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/31.jpg)
Demo
![Page 32: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/32.jpg)
Docker ContainersComparando Drawbridge e Docker
![Page 33: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/33.jpg)
Containers
Sandbox (Segurança)
Densidade de containers
![Page 34: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/34.jpg)
Windows Containers
Sandbox de Aplicação
- App-V
- Internet Explorer
- Container Windows
Redirecionamento de arquivos
Virtualização do File System e Registry
![Page 35: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/35.jpg)
Drawbridge x Docker
Drawbridge
- Kernel (Windows) em User Mode
Docker
-Virtualização da rede
-Redirecionamento de arquivos
-Particionamento do Namespace de objetos
https://channel9.msdn.com/Blogs/containers/DockerCon-16-Windows-Server-Docker-The-Internals-Behind-Bringing-
Docker-Containers-to-Windows
![Page 36: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/36.jpg)
SQL on Linux
![Page 37: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/37.jpg)
Picoprocess
Windows Bash
![Page 38: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/38.jpg)
SQL Server on Docker
OSX Ubuntu sqlservr
NTUM
![Page 39: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/39.jpg)
Docker SQL on Windows 10
Bash (Picoprocess)
Linux Subsystem
Hyper-V
MobyLinuxVM
Linux Ubuntu 16.04
Drawbridge
SQL Server vNext
![Page 40: SQL Server on Linux](https://reader034.fdocuments.net/reader034/viewer/2022051101/58e8a1d41a28ab291c8b611b/html5/thumbnails/40.jpg)
Conclusão
SQL + (Windows ou Linux)
SQLPAL: Platform Abstraction
SQL Server + Docker Containers