SQL Server on Linux

Preview:

Citation preview

SQL Server on Linux

Fabricio CataeTechnical Evangelist

MVP Open Connection 2017

SQL vNext on LinuxDeep Dive

Agenda

SQL Operating System

Projeto MSR: Drawbridge

Docker Containers

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

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)

Demo

SQL OSSQL knows better...

Escalabilidade Negativa

1

2

4

8

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

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

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

Estratégia de Migração

Exemplos:

• Core CLR

https://github.com/dotnet/coreclr

• ChakraCore

https://github.com/Microsoft/ChakraCore

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

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

Grandes Desafios

Duração do projeto (3 anos?)

Manter diferentes branches

Incorporar novas funcionalidades

Legado: MSDTC, .NET, COM

DrawbridgeProjeto Microsoft Research

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/

Library OS

NT User Mode (NTUM)

-ntoskrnl.exe

CreateProcess

-csrss

- lsass

-svchost

-Application.exe

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/

Powerpoint, Excel, Paint, IE

Picoprocess

Processo NT

Inicialização

-ntdll.dll

-PEB

-TEB

-LdrInitialize

-CreateThread

https://www.microsoft.com/mspress/books/sampchap/4354.aspx

Demo

SQLPALPlataform Abstraction Layer (PAL)

Application Binary Interface (ABI)

800+ Win32 calls

400+ NT calls

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

45 ABI calls (Drawbridge)

Formatos Binários

ELF PE

SQLSERVR.EXE on Linux

Binário ELF

Linux

sqlservr

(ELF)“NTUM” (ABI)

sqlservr.exe (PE format)

PAL

SQLSERVER.SFP

Arquitetura

sqlservr

(ELF)

sqlservr.exe

sqlos.dll

sqldk.dll

sqlmin.dll

sqllang.dll

...

“SQLPAL”

“NTUM”

“Drawbridge”

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

Demo: Hekaton

In-Memory Tables

- Tables with no latch/lock

Native Stored Procedure

- Compiler: \Xtp\VC\bin\cl.exe

- Input: *.c

- Output: *.dll

Demo

Docker ContainersComparando Drawbridge e Docker

Containers

Sandbox (Segurança)

Densidade de containers

Windows Containers

Sandbox de Aplicação

- App-V

- Internet Explorer

- Container Windows

Redirecionamento de arquivos

Virtualização do File System e Registry

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

SQL on Linux

Picoprocess

Windows Bash

SQL Server on Docker

OSX Ubuntu sqlservr

NTUM

Docker SQL on Windows 10

Bash (Picoprocess)

Linux Subsystem

Hyper-V

MobyLinuxVM

Linux Ubuntu 16.04

Drawbridge

SQL Server vNext

Conclusão

SQL + (Windows ou Linux)

SQLPAL: Platform Abstraction

SQL Server + Docker Containers

Recommended