SlideShare uma empresa Scribd logo
1 de 46
Baixar para ler offline
NoSQL: Vantagens,
Desvantagens e Compromissos


      Mauricio De Diana (mestrando)
    Marco Aurélio Gerosa (orientador)
Agenda

Definição de NoSQL

Atributos de qualidade e trocas

Modelo de dados

Escalabilidade

Transações

Consistência e disponibilidade

Desempenho
                                  01/45
Dados em larga escala na web - Publicações


Bigtable (Google)

Dynamo (Amazon)

PNUTS (Yahoo!)


Além de:
GFS, MapReduce, Chubby...


Chang, F. et al (2006). Bigtable: A Distributed Storage System for Structured Data.
DeCandia, G. et al (2007). Dynamo: Amazon's Highly Available Key-value Store.
Cooper, B. et al (2008). PNUTS: Yahoo!'s Hosted Data Serving Platform.
                                                                                 02/45
Dados em larga escala na web - FLOSS


Cassandra

MongoDB

Neo4J

Redis

Riak

...

                                       03/45
SGBDs NoSQL

Não-relacionais

Não-ACID

Distribuídos




                  04/45
SGBDs NoSQL

Não-relacionais

Não-ACID

Distribuídos




Para modelos de dados:
24/09, 14:00, CEC (lab 06): Aula de MAC5855
                                              05/45
Atributos de qualidade

Tempo de projeto                                  Tempo de execução

Modificabilidade                                  Desempenho

Testabilidade                                     Disponibilidade

...                                               Escalabilidade

                                                  Segurança

                                                  ...
 Barbacci, M. (1995). Quality Attributes.
 Bass, L. et al. (2003). Software Architecture in Practice. 2a ed.
                                                                      06/45
Atributos de qualidade - Trocas




                                  07/45
  Fonte: Quality Attributes.
Modelo de dados
Modelos não-relacionais

Grafos: interconectividade dos dados é tão ou mais importante
quanto os dados em si

Chave-valor: modelo simples

Orientado a documentos: dados semiestruturados




Angles, R. e Gutierrez, C. (2008) Survey of Graph Database Models.
Buneman, P. (1997). Semistructured Data.
                                                                     09/45
SGBDs relacionais

Esquema

Restrições de integridade
(entidade, referencial, domínio)

Normalização




                                   10/45
Esquema
 Banco de dados compartilhado




Hohpe, G e Woolf, B. (2003). Enterprise Integration Patterns.
                                                                11/45
Diferença de impedância

OO                                            Relacional

Herança                                       Relacionamentos

Encapsulamento                                Junções

Polimorfismo                                  Normalização

...                                           ...


 Ambler, S. The Object-Relational Impedance Mismatch. http://www.agiledata.
 org/essays/impedanceMismatch.html
                                                                              12/45
Escalabilidade
Escalando relacional
N servidores web
1 db
Mestre / Escravo
Mestre / Escravo
Particionamento funcional
Particionamento horizontal




Pritchett, D. (2008). BASE: An Acid Alternative.
Perde-se

Junções

Normalização

Integridade de entidade e referencial

Transparência de localização




                                        20/45
Transações
ACID

Atomicidade

Consistência

Isolamento

Durabilidade




               22/45
ACID e escalabilidade

Atomicidade: protocolo distribuído (2PC)

Consistência: problemas com réplicas

Isolamento: locks distribuídos




Abadi, D. (2010). The problems with ACID, and how to fix them without going NoSQL.
http://dbmsmusings.blogspot.com/2010/08/problems-with-acid-and-how-to-fix-them.html
                                                                             23/45
Exemplos de trocas com ACID em NoSQL


Atomicidade e isolamento: em único banco de dados (Bigtable)

Consistência: em momento indeterminado (Dynamo)

Durabilidade: memória + snapshotting (Redis)




Pritchett, D. (2008). BASE: An Acid Alternative.
Vogels, W. (2009). Eventually Consistent.             24/45
Consistência e Disponibilidade
Teorema CAP

Consistência

Disponibilidade

Tolerância à partição




                                          Fonte: http://blog.mattwoodward.com/

Brewer, E. (2000). Towards Robust Distributed Systems.
Gilbert, S. e Lynch, N. (2002). Brewer's Conjecture and the Feasibility of Consistent,
Available, Partition-tolerant Web Services
                                                                                    26/45
ACID x BASE

Basicamente disponível (Basically available)

Soft state

Consistente em momento indeterminado (Eventually
consistent)




Pritchett, D. (2008). BASE: An Acid Alternative.   27/45
Consistência em momento indeterminado
Consertando inconsistências

Fazer nada

Tentar novamente

Ação de compensação




Hohpe, G. (2004). Starbucks Does Not Use Two-Phase Commit. http://www.
eaipatterns.com/ramblings/18_starbucks.html
                                                                         37/45
Desempenho
Cenários
Cargas de trabalho diferentes precisam de tratamento
diferente

OLTP                                          OLAP

Operação                                      Informação (BI)

CRUD pequeno e rápido                         Batches demorados

Consultas simples                             Consultas complexas


Stonebraker, M. e Cetintemel, U. (2005)."One Size Fits All": An Idea Whose Time Has
Come and Gone.
                                                                               39/45
Experimentos
OLTP                                            OLAP

H-Store (VoltDB)                                C-Store (Vertica)

82x mais rápido que um                          124x mais rápido que um
SGBD comercial                                  SGBD comercial orientado a
                                                linha

                                                21x mais rápido que um
                                                SGBD comercial orientado a
                                                coluna

Stonebraker, M. et al. (2007).The End of an Architectural Era (It's Time for a Complete
Rewrite).
Stonebraker, M. et al. (2005). C-store: a Column-oriented DBMS.                    40/45
Tempos em um SGBDR

Logging, locking, latching e gerenciamento de buffer

1/60 das instruções em uma transação são trabalho útil

20x mais rápido sem esses sub-subsistemas




Harizopoulos, S. et al. (2008). OLTP Through the Looking Glass, and What We Found
There.
                                                                             41/45
Especializações

Problema não está no modelo relacional, nem na SQL

Ordens de grandeza de diferença

Persistência poliglota




                                                     42/45
Conclusões

Contexto importa

Balancear vantagens e desvantagens é fundamental




                                                   43/45
Próximos passos

Foco em chave-valor (DHT)

Desenvolvimento de taxonomia

Arquitetura de referência

Experimentos de escalabilidade e desempenho
 riak_core
 Benchmark para cloud do Yahoo!




                                              44/45
Obrigado.

Comentários, dúvidas, sugestões?




                  mdediana@ime.usp.br
                  mdediana@gmail.com
                      @mdediana

Mais conteúdo relacionado

Último

Assessement Boas Praticas em Kubernetes.pdf
Assessement Boas Praticas em Kubernetes.pdfAssessement Boas Praticas em Kubernetes.pdf
Assessement Boas Praticas em Kubernetes.pdf
Natalia Granato
 

Último (6)

Assessement Boas Praticas em Kubernetes.pdf
Assessement Boas Praticas em Kubernetes.pdfAssessement Boas Praticas em Kubernetes.pdf
Assessement Boas Praticas em Kubernetes.pdf
 
Padrões de Projeto: Proxy e Command com exemplo
Padrões de Projeto: Proxy e Command com exemploPadrões de Projeto: Proxy e Command com exemplo
Padrões de Projeto: Proxy e Command com exemplo
 
ATIVIDADE 1 - CUSTOS DE PRODUÇÃO - 52_2024.docx
ATIVIDADE 1 - CUSTOS DE PRODUÇÃO - 52_2024.docxATIVIDADE 1 - CUSTOS DE PRODUÇÃO - 52_2024.docx
ATIVIDADE 1 - CUSTOS DE PRODUÇÃO - 52_2024.docx
 
ATIVIDADE 1 - GCOM - GESTÃO DA INFORMAÇÃO - 54_2024.docx
ATIVIDADE 1 - GCOM - GESTÃO DA INFORMAÇÃO - 54_2024.docxATIVIDADE 1 - GCOM - GESTÃO DA INFORMAÇÃO - 54_2024.docx
ATIVIDADE 1 - GCOM - GESTÃO DA INFORMAÇÃO - 54_2024.docx
 
Boas práticas de programação com Object Calisthenics
Boas práticas de programação com Object CalisthenicsBoas práticas de programação com Object Calisthenics
Boas práticas de programação com Object Calisthenics
 
ATIVIDADE 1 - LOGÍSTICA EMPRESARIAL - 52_2024.docx
ATIVIDADE 1 - LOGÍSTICA EMPRESARIAL - 52_2024.docxATIVIDADE 1 - LOGÍSTICA EMPRESARIAL - 52_2024.docx
ATIVIDADE 1 - LOGÍSTICA EMPRESARIAL - 52_2024.docx
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

NoSQL: Vantagens, Desvantagens e Compromissos