Mais conteúdo relacionado Semelhante a Desenvolvendo Serviços de Alta Performance com APIs NoSQL para MySQL (20) Mais de MySQL Brasil (20) Desenvolvendo Serviços de Alta Performance com APIs NoSQL para MySQL1. Desenvolvendo Serviços de Alta Performance
com APIs NoSQL para MySQL
Airton Lastori
airton.lastori@oracle.com
out-2012
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
2. Alguns clientes MySQL
2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
3. Alguns clientes MySQL
fonte: alexa.com/topsites 10-mai-2012
3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
4. Agenda
Alta Performance com MySQL
Arquitetura e Topologias
Métodos de Acesso e API’s
Instalação e Exemplos
Aprenda Mais
Perguntas?
4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
5. Agenda
Alta Performance com MySQL
Arquitetura e Topologias
Métodos de Acesso e API’s
Instalação e Exemplos
Aprenda Mais
Perguntas?
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
6. Alta Performance
Por que há demanda?
2.2 BILHÕES DE USUÁRIOS
630 MILHÕES DE WEBSITES
40% CRESCIMENTO
DE DADOS POR ANO
1 BILHÃO
USUÁRIOS
Velocidade de escrita
560 MILHÕES
ATIVOS DIARIAMENTE Acesso chave/valor
Modelo de dados flexível
400 MILHÕES Escalabilidade horizontal
DE TWEETS
Suporte à “Big Data”
72 HORAS
POR DIA
UPLOAD A CADA
MINUTO
Disponível 24x7
5,9 BILHÕES ASSINATURAS $1 TRILHÃO
MÓVEIS EM 2011 EM 2013
1,2+ BILHÃO APPS iOS & Android $700 BILHÕES
JÁ AIXADOS EM 2012 EM 2011
6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
7. Resposta tecnológica: NoSQL
Fonte: 451 Group
7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
8. Resposta tecnológica: NoSQL
Usos comuns: usado como cache para
armazenamento de dados requisitados
frequentemente, especialmente em
aplicações web.
Pontos Fortes: escalabilidade,
armazenamento e busca de dados muito
rápidos; dados não estruturados e
parcialmente estruturados.
Pontos Fracos: usualmente todos os dados
tem que caber em memória rápida; falta de
recursos para Queries complexas.
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
9. Uso Tradicional do Memcached
2 níveis de hashing
httpd memcached
Usa chave
para
PHP/Perl/Java memcached
encontrar o
Memcache dado (valor)
friends:12389 memcached
chave memcache
VALUE friends:12389 0 31rn
101, 11009, 11150, 55881, 77798
rn
9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
10. Não encontra valor no cache: sincronização 1/2
aplicação é responsável por buscar no Banco de Dados
httpd memcached
Não há valor
PHP/Perl/Java memcached para chave
informada
Memcache
memcached
MySQL
Slave
10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
11. Não encontra valor no cache: sincronização 2/2
aplicação é responsável por sincronizar
httpd memcached
Armazenar
valor com
PHP/Perl/Java memcached
chave/valor
Memcache informados
memcached
Processo similar ocorre quando há escrita
no MySQL Master: aplicação precisa
sincronizar com cache.
11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
12. Memcached + InnoDB MySQL 5.6
Mais Flexibilidade e Simplicidade Memcached com
Persistência no InnoDB
Método transparente para persistir
os dados em memória volátil
Application Memcached plug-in no mysqld ,
mapeado à API nativa do InnoDB
SQL NoSQL
(MySQL Client) (Memcached Prot.) Shared process para baixa latência
mysqld Acesso chave-valor ao
MySQL Server Memcached plugin InnoDB
Via Memcached API
InnoDB Storage Engine Usa clients Memcached existentes
Sem SQL parsing
Acesso SQL e NotOnlySQL
Operações chave-valor mas
http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached.html também queries SQL, JOINs, FKs,
etc.
12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
13. Resposta tecnológica: NoSQL
Usos comuns: aplicações web ou
outras que requerem melhor
performance e escalabilidade sem que
seja necessários definir esquemas
relacionais.
Pontos Fortes: armazenamento
persistente com recursos de
escalabilidade tais como sharding
nativo; melhor suporte a Queries que
apenas chave-valor.
Pontos Fracos: falta de recursos para
Queries complexas.
13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
14. Resposta tecnológica: NoSQL
Usos comuns: aplicações
científicas ou de tradução direta do
paradigma orientado a objetos.
Pontos Fortes: performance e
mapeamento natural de objetos.
Pontos Fracos: falta de recursos
para realizar Queries complexas.
14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
15. Resposta tecnológica: NoSQL
Usos comuns: log em tempo-real para
aplicações web ou financeiras.
Pontos Fortes: throughput muito alto
para Big Data (de Terabytes a
Petabytes); suporte excelente a
particionamento e acesso aleatório de
leitura-escrita.
Pontos Fracos: APIs de baixo-nível,
falta de recursos para realizar Queries
complexas, alta latência na resposta de
Queries.
15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
16. Requisitos NoSQL
O que a solução deve cumprir?
Alta Performance
alto throughput leitura/escrita
Escalabilidade massiva
Performance auto-sharding
Escalabilidade Facilidade de uso
acesso simples (APIs)
Facilidade de Uso manutenção simples
modelo evolutivo de dados
Disponibilidade ~24x7
Alta Disponibilidade
tolerância a falhas
16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
17. 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
18. Ainda há espaço para SGBDs relacionais
Usos comuns: análise de dados
históricos, data warehousing,
business intelligence.
Pontos Fortes: suporte a Queries
rápidas especialmente em datasets
grandes e compressão.
Pontos Fracos: não adequado
para transações, importações e
exportações rápidas; utilização de
computação pesada.
18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
19. Ainda há espaço para SGBDs relacionais
Usos comuns: processamento de
transações, aplicações interativas
transacionais
Pontos Fortes: formas facilitadas de
manipular registros; consistência;
tecnologia comprovadamente robusta.
Pontos Fracos: problemas de
escalabilidade, especialmente para
Queries contra grande volume de
dados (dezenas de Terabytes).
19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
20. Escalabilidade: horizontal vs vertical
Scale Out Scale Up
• Adicionar mais servidores para • Trocar por hardware mais
aumentar performance poderoso, adicionar memória,
• MySQL adota esta abordagem CPU
em sistemas altamente • Outras soluções normalmente
escaláveis em hardware usam hardware proprietário
commodity (Intel / AMD) (SMP)
É possível combinar as duas abordagens
20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
21. MySQL 5.6 SysBench Benchmarks
MySQL 5.6 vs. 5.5 - Read Write (Linux)
12.000
Transactions per Second
10.000 MySQL 5.6.7
8.000
6.000
MySQL 5.5.28
4.000
2.000
0 Oracle Linux 6
Intel(R) Xeon(R) E7540 x86_64
32 64 128 256 512 MySQL leveraging:
- 48 of 96 available CPU threads
Connections - 2 GHz, 512GB RAM
151% Ganho Performance
23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
22. MySQL 5.6 SysBench Benchmarks
MySQL 5.6 vs. 5.5 - Read Only (Linux)
18.000
Transactions per Second
16.000
MySQL 5.6.7
14.000
12.000
10.000
8.000
6.000 MySQL 5.5.28
4.000
2.000 Oracle Linux 6
Intel(R) Xeon(R) E7540 x86_64
0 MySQL leveraging:
- 48 of 96 available CPU threads
32 64 128 256 512 - 2 GHz, 512GB RAM
Connections
234% Ganho de Performance
24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
23. Comparativo com/sem Thread Pool
MySQL 5.5 Sysbench OLTP Apenas Leitura
12.000
10.000 MySQL Enterprise Edition
ComThread Pool
8.000
6.000
T
4.000
2.000 MySQL Community Server
SemThread Pool
0
Conexões Simultâneas no Banco de Dados MySQL 5.5.16
Oracle Linux 6.1, Unbreakable Kernel 2.6.32
2 sockets, 24 cores, 2 X 12-core
Intel(R) Xeon(R) X5670 2.93GHz CPUs
3x Melhor Escalabilidade com Thread Pool 72GB DDR3 RAM
2 X LSI SCSI Disk (MR9261-8i) (597GB)
25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
24. Comparativo com/sem Thread Pool
MySQL 5.5 Sysbench OLTP Leitura/Escrita
8.000
Transações por segundo
7.000
MySQL Enterprise Edition
6.000 ComThread Pool
5.000
4.000
3.000
2.000
1.000
0
MySQL Community Server
Sem Thread Pool
Conexões Simultâneas no Banco de Dados
MySQL 5.5.16
Oracle Linux 6.1, Unbreakable Kernel 2.6.32
2 sockets, 24 cores, 2 X 12-core
20x Melhor Escalabilidade comThread Pool Intel(R) Xeon(R) X5670 2.93GHz CPUs
72GB DDR3 RAM
2 X LSI SCSI Disk (MR9261-8i) (597GB)
26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
25. Escalabilidade horizontal
3 Abordagens para
Replicação escalar o MySQL
MySQL
Particionamento
Funcional
Data Sharding
27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
26. Escalabilidade horizontal
Replicação • método mais simples e mais comum
• indicado para aplicações de LEITURA intensiva
MySQL • problemas com cache duplicado em aplicações com datasets grandes
• dividir a carga em múltiplos nós, com responsabilidades distintas
Particionamento • os nós podem ter redundância via replicação para alta-disponibilidade
• normalmente não é transparente para a aplicação e também recorre ao
Funcional scale up para cada database funcional, o que impõe limites
• método de maior sucesso para escalar aplicações MySQL de grande
porte hoje
Data Sharding • dados compartilhados em tabelas/caches globais, SOA
• difícil de adaptar aplicações legadas
28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
27. Replicação MySQL: como escalar 1/2
Aplicação
Escritas & Leituras Leituras
Master Slave
• Divisão de leituras e escritas (R/W Split)
• Modelo assíncrono (padrão)
• Modelo semi-síncrono (a partir da versão 5.5)
29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
28. Replicação MySQL: como escalar 2/2
Aplicação Load Balancer
Escritas & Leituras Leituras Leituras
Master Slave Slave
Replicação MySQL
• Escreva para 1 Master
• Leia de vários Slaves, adicione mais quando necessário
• Perfeito para aplicações de leitura intensiva
30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
29. Caso de sucesso
Benefício-chave
Wikipedia • O MySQL permite economias
significativas com custos de
hardware, adicionando novos
servidores commodity de
acordo com o necessário e de
maneira incremental
Por que MySQL?
• Capacidade de escalar
conforme necessidade e de
maneira incremental
• Baixos custos e flexibilidade
mysql.com/customers
31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
30. Escalabilidade horizontal
Replicação • método mais simples e mais comum
• indicado para aplicações de LEITURA intensiva
MySQL • problemas com cache duplicado em aplicações com datasets grandes
• dividir a carga em múltiplos nós, com responsabilidades distintas
Particionamento • os nós podem ter redundância via replicação para alta-disponibilidade
• normalmente não é transparente para a aplicação e também recorre ao
Funcional scale up para cada database funcional, o que impõe limites
• método de maior sucesso para escalar aplicações MySQL de grande
porte hoje
Data Sharding • dados compartilhados em tabelas/caches globais, SOA
• difícil de adaptar aplicações legadas
32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
31. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
P1 Data Node 2
P2
P3 Data Node 3
P4
Data Node 4
33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
32. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1
P1 Data Node 2
P2
P3 Data Node 3
P4
Data Node 4
34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
33. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1
P1 Data Node 2
F1
P2
P3 Data Node 3
P4
Data Node 4
35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
34. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1
P1 Data Node 2
F3 F1
P2
P3 Data Node 3
P4
Data Node 4
36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
35. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Data Node 2
F3 F1
P2
P3 Data Node 3
P4
Data Node 4
37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
36. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Data Node 2
F3 F1
P2
P3 Data Node 3
F2
P4
Data Node 4
38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
37. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Data Node 2
F3 F1
P2
P3 Data Node 3
F2
P4
Data Node 4
F2
39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
38. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Data Node 2
F3 F1
P2
P3 Data Node 3
F2
P4
Data Node 4
F4 F2
40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
39. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Data Node 2
F3 F1
P2
P3 Data Node 3
F2 F4
P4
Data Node 4
F4 F2
41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
40. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Node Group 1
Data Node 2
F3 F1
P2
P3 Data Node 3
F2 F4
P4
Data Node 4
F4 F2
42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
41. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Node Group 1
Data Node 2
F3 F1
P2
P3 Data Node 3
F2 F4
P4
Node Group 2
Data Node 4
F4 F2
43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
42. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Node Group 1
Data Node 2
F3 F1
P2
P3 Data Node 3
F2 F4
P4
Node Group 2
Data Node 4
F4 F2
44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
43. Escalabilidade horizontal: Data Sharding
Table T1 Data Node 1
F1 F3
P1 Node Group 1
Data Node 2
F3 F1
P2
P3 Data Node 3
F2 F4
P4
Node Group 2
Data Node 4
F4 F2
45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
44. Caso de sucesso
Benefícios-chave
• Propriedades ACID
• Solução comprovada por muitas
empresas ao longo de anos
• Por que MySQL?
• Escalabilidade virtualmente infinita:
hoje com 20 milhões de usuários, 1
Evernote bilhão de Notes e 2 bilhões de
arquivos (fotos, documentos etc)
• Flexibilidade para crescer de
maneira incremental e com baixos
custos
blog.evernote.com/tech/2012/02/23/whysql
46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
45. NewSQL
47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
46. Requisitos NewSQL
Relacional + NoSQL
Performance
Escalabilidade Não há solução única para
todas situações. Não há
Facilidade de Uso bala de prata.
Disponibilidade ~24x7
Combine e supere
SQL/Joins
expectativas!
Transações ACID
48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
47. MySQL Cluster
Carrier Grade • Arquitetura shared-nothing in-memory parallel
Database • Modelo relacional ACID, SQL
• 99.999% de disponibilidade
Alta Disponibilidade • Self-healing, failover abaixo de 1 segundo
• Performance em tempo real para altas cargas
Alta Performance • Latência baixa e preditiva
• Elasticidade, crescimento incremental
Escalabilidade • Escalabilidade linear, distribuition aware
• Open Source, hardware commodity
Open Source • APIs NoSQL (C++, Java, Memcached, Node.js)
49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
48. Alguns Clientes MySQL Cluster
50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
49. Caso de sucesso
•2 milhões usuários, com 30.000 novos
usuários por dia
•10.000 usuários concorrentes
•10.000 Transações Por Segundo
•99.999% uptime
“The MySQL support service has
been essential in helping us for
troubleshooting and giving
recommendations for the production
cluster.”
Carlos Morales (DBA), Playfulplay.com
blogs.oracle.com/MySQL/entry/mysql_cluster_powers_el_chavo
51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
50. Performance do MySQL Cluster
SELECT Queries per Minute Performance a
1.200
Escalabilidade
1.000
800 Facilidade de Uso
Millions
600 Disponibilidade ~24x7
400
SQL/Joins
200
0 Transações ACID
2 4 8
Number of Data Nodes
8 Servidores Intel Commodity
UPDATE Queries per Minute – 2 x 6-core processors 2.93GHz
150
– x5670 processors (24 threads)
100
Millions
– 48GB RAM
50
Rede Infiniband
0
4 8 flexAsynch benchmark (NDB API)
Number of Data Nodes
52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
51. Agenda
Alta Performance com MySQL
Arquitetura e Topologias
Métodos de Acesso e API’s
Instalação e Exemplos
Aprenda Mais
Perguntas?
53 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
52. Arquitetura MySQL Cluster Performance
Escalabilidade
a
Facilidade de Uso ?
Clients
Disponibilidade ~24x7
SQL/Joins ?
Transações ACID ?
Application Layer
Data Layer
Management
MySQL Cluster Data Nodes
54 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
53. Arquitetura MySQL Cluster Performance
Escalabilidade
a
Facilidade de Uso a
Clients
Disponibilidade ~24x7
SQL/Joins a
Transações ACID a
Application Layer
NDB
Data Layer
Management
MySQL Cluster Data Nodes
55 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
54. Arquitetura MySQL Cluster Performance
Escalabilidade
a
?
Facilidade de Uso a
Clients
Disponibilidade ~24x7
SQL/Joins a
Transações ACID a
Application Layer
Table T1
Data Layer
P1 P2 P1
Management P3 P4 P2
P3
MySQL Cluster Data Nodes P4
56 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
55. Arquitetura MySQL Cluster Performance
Escalabilidade
a
a
Facilidade de Uso a
Clients
Disponibilidade ~24x7 ?
SQL/Joins a
Transações ACID a
Application Layer
Data Layer
P1 P2
Management P3 P4 Management
MySQL Cluster Data Nodes
57 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
56. Arquitetura MySQL Cluster Performance
Escalabilidade
a
a
Facilidade de Uso a
Clients
Disponibilidade ~24x7 a
SQL/Joins a
Transações ACID a
Application Layer
E mais:
• Permite mudanças no
schema sem interrupção de
leituras ou escritas
Data Layer • Permite adicionar colunas
e índices online
P1 P2 P3 P4
Management P3 P4 P1 P2
MySQL Cluster Data Nodes Management
58 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
57. Flexibilidade da Topologia
Replicação
Replicação síncrona
entre os grupos de nós para HA
Geo-Replicação
Cluster 1 Cluster 2 assíncrona entre nós remotos
NDB para redundância
geográfica
Replicação assíncrona
entre Storage Engines
InnoDB InnoDB InnoDB
diferentes para aplicações
Synchronous
replication especializadas como geração
Asynchronous
replication
de relatórios
59 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
58. Agenda
Alta Performance com MySQL
Arquitetura e Topologias
Métodos de Acesso e API’s
Instalação e Exemplos
Aprenda Mais
Perguntas?
60 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
59. APIs de Acesso aos Dados
Os mesmos dados
acessados
simultaneamente
através de interfaces
SQL e NoSQL
61 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
60. APIs Java: ClusterJ e JPA
ClusterJ
API de persistência Domain
Object Model (DataMapper)
JPA
API de persistência padronizada
pelo OpenJPA
62 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
61. ClusterJ ou JPA?
ClusterJ JPA
Fácil de usar, parecida com Hibernate / A interface JPA interface é compatível
JPA / JDO com o padrão Java Persistent API
– Domain Object Model DataMapper pattern – Implementada como um plugin OpenJPA
– Dados são representados por Objetos de Domínio
Performance mais alta que o JDBC puro
– Objetos de Domínio não contém lógica de negócio (camada
separada) Construída sobre ClusterJ e JDBC
– Objetos de Domínio são mapeados para tabelas no MySQL
– Usa ClusterJ onde possível e reverte para JDBC para
Altíssima Performance algumas operações
Construído sobre interface nativa Java Adoção mais natural para profissionais
– JNI adapter (ndbjtie)
Java
– Parte integral do MySQL Cluster Facilita adoção do Cluster em aplicações
– Mapeamento direto do MySQL Cluster API (NDB API) para web e aplicações legadas
Java
Limitação: não suporta relacionamentos
– Olhe na API JPA / JDO para estes padrões de modelagem
63 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
62. API Memcached
Baseado em chave-valor
API simples e bastante popular entre
desenvolvedores
hash table com persistência em disco
e alta performance
Extensão do Memcached
adiciona persistência em disco sem
perda de performance
evita rotinas de invalidação do cache,
sincronismo manual
Simplicidade e Flexibilidade
evita camadas adicionais na infra-
estrutura
acesso ao dado via tabelas relacionais
64 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
63. Memcached é Schemaless
Evolução rápida da
aplicação:
Novos tipos de dados
adicionados
constantemente
Não requer tempo para
estender o schema ou
parada do servidor
Não requer conhecimento
de modelagem relacional
Escalabilidade incremental
65 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
64. Cluster & Memcached
Schemaless
key value
<town:maidenhead,SL6>
Application view
SQL view key value
set maidenhead 0 0 3
<town:maidenhead,SL6> SL6
STORED
Key Value get maidenhead
town:maidenhead SL6 VALUE maidenhead 0 3
generic table SL6
END
66 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
65. Cluster & Memcached
Schema configurável
key value
<town:maidenhead,SL6>
Application view
SQL view prefix key value
<town:maidenhead,SL6>
Prefix Table Key- Val-col policy
town ... code ...
col
maidenhead ... SL6 ...
town: map.zip town code cluster
Config tables map.zip
67 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12