greenplum: o banco de dados open source massivamente paralelo baseado em postgresql | luis macedo

36

Upload: pgday-campinas

Post on 11-Jan-2017

190 views

Category:

Technology


0 download

TRANSCRIPT

2 © 2016 Pivotal Software, Inc. All rights reserved. 2

Conhecendo o Greenplum O banco de dados Open Source massivamente paralelo baseado em PostgreSQL

Luis Macedo Arquiteto de Plataforma

3 © 2016 Pivotal Software, Inc. All rights reserved.

Quem sou eu? �  Bacharel em Física – USP

�  11 anos de experiência com VLDBs

�  Trabalhei nos projetos de DWH Telefonica, Oi, Vivo e TIM

�  Projetos de Big Data e Hadoop na TIM e Bradesco

�  Foco recente em plataformas de Nuvem

4 © 2016 Pivotal Software, Inc. All rights reserved.

Powering Digital Transformation A Pivotal ajuda empresas a prover a melhor experiência a seus clientes e

colaboradores se calcando em softwares modernos

5 © 2016 Pivotal Software, Inc. All rights reserved.

Introdução ao Greenplum DB Arquitetura do GPDB

Greenplum <> PostgreSQL Casos de Uso

6 © 2016 Pivotal Software, Inc. All rights reserved. 6

Introdução ao GPDB

7 © 2016 Pivotal Software, Inc. All rights reserved.

http://greenplum.org/

Intodução ao Greenplum Database

8 © 2016 Pivotal Software, Inc. All rights reserved.

https://github.com/greenplum-db/gpdb

Intodução ao Greenplum Database

9 © 2016 Pivotal Software, Inc. All rights reserved.

Intodução ao Greenplum Database ”Mudar para sempre o Data Warehousing oferecendo um sistema abrangente e

comprovado em código aberto”

•  Totalmente ACID Compliant •  Focado em “Big Structured Data” •  ANSI SQL Standard Compliant (PostgreSQL) •  Solução de Sofware •  Implementação em HW comodite, appliance ou em nuvem •  15+ anos de P&D •  Herança do PostgreSQL e Open Source •  Mais de 1000+ clientes enterprise pelo mundo

10 © 2016 Pivotal Software, Inc. All rights reserved.

Intodução ao Greenplum Database

11 © 2016 Pivotal Software, Inc. All rights reserved.

Procedural Languages •  C •  pgSQL •  R •  Python •  Java •  Perl

PostGIS Fuzzy String Functions

NJSQL Not Just SQL

12 © 2016 Pivotal Software, Inc. All rights reserved. 12

Arquitetura do GPDB

13 © 2016 Pivotal Software, Inc. All rights reserved.

Arquitetura do Greenplum Database Arquitetura MPP Shared Nothing

Ø  Master Host

Ø  Coordenador

Ø  Segment Host

Ø  Executor

Ø  Interconnect

Ø  Barramento de conexão entre

os servidores

Ø  Segment Instance

Ø  Similar ao processo postgres

Standby Master

Master Host

SQL

Interconnect

Segment Host Segment Instance Segment Instance Segment Instance Segment Instance

Segment Host Segment Instance Segment Instance Segment Instance Segment Instance

node1

Segment Host Segment Instance Segment Instance Segment Instance Segment Instance

node2

Segment Host Segment Instance Segment Instance Segment Instance Segment Instance

node3

Segment Host Segment Instance Segment Instance Segment Instance Segment Instance

nodeN

14 © 2016 Pivotal Software, Inc. All rights reserved.

Bob 12

Steve 10

Jim 15

Carson 2

Madison 6

Thomas 8

Andrea 22

cookie_order

15 © 2016 Pivotal Software, Inc. All rights reserved.

select * from cookie_order where amt > 10

16 © 2016 Pivotal Software, Inc. All rights reserved.

Arquitetura do Greenplum Database Arquitetura MPP Shared Nothing

Ø  Carga e extração paralela

Ø  10+ TB/h taxa de carga

Ø  Escalabilidade linear

Ø  Sem necessidade de reorg ou

aregar intermediárias

Ø  Multiplas horigens/destinos

Ø  Hadoop, FS, S3 External Sources

Loading, streaming, etc.

gNet Network Interconnect

... ...

... ... Master Servers

Query planning & dispatch

Segment Servers

Query processing & data storage

SQL

ETL File

Systems

17 © 2016 Pivotal Software, Inc. All rights reserved.

Arquitetura do Greenplum Database Polymorfic Storage

•  Melhor performance de consultas OLAP

•  Melhor Compressão

•  Vários níveis: quickLZ, zLib 1 a 9, RLE

•  Melhor performance para workloadas de pequenos inserts

•  Tabelas Heap tem melhor performance para Upd/Del

Tabela ‘Vendas’ Jun

Orientado a Coluna Orientado a Linha

Out Ano -1

Ano -2

HDFS Externo

•  Dados Frios

•  Formatos: Texto, CSV, Binario, Avro, Parquet

Nov Dec Jul Ago Set

18 © 2016 Pivotal Software, Inc. All rights reserved.

Arquitetura do Greenplum Database Alta Disponibilidade

Interconnect

Segment Host Segment Instance Segment Instance Segment Instance Segment Instance

Master HA

Segment HA

19 © 2016 Pivotal Software, Inc. All rights reserved.

Arquitetura do Greenplum Database Distribuição e Particionamento

Segment 1A Segment 1B Segment 1C Segment 1D

Segment 2A Segment 2B Segment 2C Segment 2D

Segment 3A Segment 3B Segment 3C Segment 3D

Segment 1A Segment 1B Segment 1C Segment 1D

Segment 2A Segment 2B Segment 2C Segment 2D

Segment 3A Segment 3B Segment 3C Segment 3D

Segment 1A Segment 1B Segment 1C Segment 1D

Segment 2A Segment 2B Segment 2C Segment 2D

Segment 3A Segment 3B Segment 3C Segment 3D

SELECT COUNT(*) FROM orders WHERE order_date >= ‘Oct 20 2007’ AND order_date < ‘Oct 27 2007’

&

As ordens estão distribuidas nos segmentos

Somente as ordens das partições qualificadas são escaneadas

Segment 1A Segment 1B Segment 1C Segment 1D

Segment 2A Segment 2B Segment 2C Segment 2D

Segment 3A Segment 3B Segment 3C Segment 3D

20 © 2016 Pivotal Software, Inc. All rights reserved. 20

Greenplum <> PostgreSQL

21 © 2016 Pivotal Software, Inc. All rights reserved.

22 © 2016 Pivotal Software, Inc. All rights reserved.

23 © 2016 Pivotal Software, Inc. All rights reserved.

24 © 2016 Pivotal Software, Inc. All rights reserved.

$ git diff --stat REL8_2_23..REL8_3_23 2423 files changed, 461334 insertions(+), 208900 deletions(-)

25 © 2016 Pivotal Software, Inc. All rights reserved.

26 © 2016 Pivotal Software, Inc. All rights reserved.

$ git merge upstream/REL8_3_STABLE $ grep -r "<<<<<<< HEAD" . | wc -l 6653

27 © 2016 Pivotal Software, Inc. All rights reserved.

28 © 2016 Pivotal Software, Inc. All rights reserved.

Long Story Short… !

29 © 2016 Pivotal Software, Inc. All rights reserved. 29

Caos de Uso ??? Casos de Uso

30 © 2016 Pivotal Software, Inc. All rights reserved.

“Next Best Action” – Engine de Recomendação Cliente

Banco de varejo (EUA)

Problema de Negócio

Aumentar o mix de produtos financeiros adquiridos pelos clientes em especial produtos de alto retorno

Desafios

▪  Com crescimento do volume de dados o ETL so tornou um gargalo

▪  Dificuldade de evoluir os modelos estatísticos com o alto volume de dados e ferrentas tradicionais

Solução

▪  Trazer o ETL para ELT no Greenplum acelerando a carga e preparação do dado

▪  Utilizar MADlib para criar novos modelos de “Next best action” mais eficazes usando mais dados e mais granular

▪  Utilizar novo modelo para operacionalizar açoes de vendas otimizando o portifolio de cada gerente

Who? What? When? Where? Next Best Action

31 © 2016 Pivotal Software, Inc. All rights reserved.

Análise de Falha Massiva - ANATEL Cliente

Grande Telco Brasileira

Problema de Negócio

Quando ocorre uma falha de um equipamento de rede e isto afeta uma região a ANATEL define uma complexa regra de reembolso para os afetados. Solução adotara era reemboçlar todos os clientes da região no momento da falha.

Desafios

▪  Grande volume de dados não permitia a aplicação da regra ANATEL

▪  Não havia dados nos sistemas legados

Solução

▪  Trazer todo dado de xDR para um Data Lake ▪  Criar listagem, cliente a cliente, aplicando a regra

da ANTEL ▪  Alimentar sistema de billing com reembolços

corretos

32 © 2016 Pivotal Software, Inc. All rights reserved.

Prevenção a Evasão de Impostos Cliente

Secretaria de Fazenda Estadual

Problema de Negócio

Com a digitalização das notas fiscais de compra e venda o volume dados disponíveis para análise cresceu muito abrindo espaço para uma fiscalização mais estrita.

Desafios ▪  Volumes de dados não compatíveis com a arquitetura

SMP do SQLServer

▪  Cilos de dados (diferentes SQLServers)

▪  Processo de fraude demorava 2 meses para executar.

Solução

▪  Criar novo modelo de dados desnormalizado em GPDB

▪  Criar novos algoritmos de prevenção a evasão de impostos

▪  Sofisticar a análise e contemplar NF-e PF.

33 © 2016 Pivotal Software, Inc. All rights reserved. 33

Concluindo…

34 © 2016 Pivotal Software, Inc. All rights reserved.

!

35 © 2016 Pivotal Software, Inc. All rights reserved.

TO BECOME A

HACKER