Top Banner
SQL Server on Linux Fabricio Catae Technical Evangelist MVP Open Connection 2017
40

SQL Server on Linux

Jan 22, 2018

Download

Technology

Fabrício Catae
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SQL Server on Linux

SQL Server on Linux

Fabricio CataeTechnical Evangelist

MVP Open Connection 2017

Page 2: SQL Server on Linux

SQL vNext on LinuxDeep Dive

Page 3: SQL Server on Linux

Agenda

SQL Operating System

Projeto MSR: Drawbridge

Docker Containers

Page 4: SQL Server on Linux

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

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

Demo

Page 7: SQL Server on Linux

SQL OSSQL knows better...

Page 8: SQL Server on Linux

Escalabilidade Negativa

1

2

4

8

Page 9: SQL Server on Linux

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

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

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

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

BackgroundSe você fosse o Líder Técnico...

Page 14: SQL Server on Linux

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

Grandes Desafios

Duração do projeto (3 anos?)

Manter diferentes branches

Incorporar novas funcionalidades

Legado: MSDTC, .NET, COM

Page 16: SQL Server on Linux

DrawbridgeProjeto Microsoft Research

Page 17: SQL Server on Linux

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

Library OS

NT User Mode (NTUM)

-ntoskrnl.exe

CreateProcess

-csrss

- lsass

-svchost

-Application.exe

Page 19: SQL Server on Linux

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

Powerpoint, Excel, Paint, IE

Page 21: SQL Server on Linux

Picoprocess

Page 22: SQL Server on Linux

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

Demo

Page 24: SQL Server on Linux

SQLPALPlataform Abstraction Layer (PAL)

Page 25: SQL Server on Linux

Application Binary Interface (ABI)

800+ Win32 calls

400+ NT calls

--------------------

45 ABI calls (Drawbridge)

Page 26: SQL Server on Linux

Formatos Binários

ELF PE

Page 27: SQL Server on Linux

SQLSERVR.EXE on Linux

Binário ELF

Linux

sqlservr

(ELF)“NTUM” (ABI)

sqlservr.exe (PE format)

PAL

Page 28: SQL Server on Linux

SQLSERVER.SFP

Arquitetura

sqlservr

(ELF)

sqlservr.exe

sqlos.dll

sqldk.dll

sqlmin.dll

sqllang.dll

...

“SQLPAL”

“NTUM”

“Drawbridge”

Page 29: SQL Server on Linux

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

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

Demo

Page 32: SQL Server on Linux

Docker ContainersComparando Drawbridge e Docker

Page 33: SQL Server on Linux

Containers

Sandbox (Segurança)

Densidade de containers

Page 34: SQL Server on Linux

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

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

SQL on Linux

Page 37: SQL Server on Linux

Picoprocess

Windows Bash

Page 38: SQL Server on Linux

SQL Server on Docker

OSX Ubuntu sqlservr

NTUM

Page 39: SQL Server on Linux

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

Conclusão

SQL + (Windows ou Linux)

SQLPAL: Platform Abstraction

SQL Server + Docker Containers