SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Lucene nas alturas:
             400 buscas por segundo
                                  ROd
                             Léo Nickel




Saturday, May 14, 2011                    1
ROd

                         Desenvolvedor
                         especialista em
                         arquiteturas de alta
                         performance
                         relacionadas a
                         publicação e busca
                         de conteúdo




   13/05/11                               2
Saturday, May 14, 2011                          2
Léo Nickel

                 Desenvolvedor de
                         sistemas com
                    experiência de 5
              anos em aplicações
                           Java EE nos
                         segmentos de
            telefonia, marketing
                         online e busca
                              orgânica

   13/05/11                                    3
Saturday, May 14, 2011                                 3
MOTIVAÇÃO

       • Substituição do motor de busca FAST SEARCH

       • Alternativas
             – Compass

             – ElasticSearch

             – Lucene

             – Solr

             – Sphinx




   13/05/11                                  4
Saturday, May 14, 2011                                4
LUCENE

       Mar/2000: Versão 0.01 (SourceForge)
               Thu Mar 30 20:02:47 2000 UTC by cutting

       Out/2000: Versão 1.0
       Jun/2002: Versão 1.2 (Apache Jakarta)
       Dez/2004: Lucene in Action (1.4.3)
       Fev/2005: Apache top-level project
       Mai/2006: Versão 2.0
       Set/2009: Versão 2.9
       Nov/2009: Versão 3.0
       Mar/2011: Versão 3.1

   13/05/11                                       5
Saturday, May 14, 2011                                   5
REQUISITOS NÃO FUNCIONAIS

       • Baixa latência de indexação

       • Alta disponibildade de busca

       • Proteção do storage

       • Capacidade adaptativa dos repositórios

       • Estado imutável




   13/05/11                                       6
Saturday, May 14, 2011                                6
REQUISITOS FUNCIONAIS

       • Paginação

       • Ordenações

       • Sharding

       • Otimização de índices

       • Suporte a diversos charsets




   13/05/11                            7
Saturday, May 14, 2011                     7
COMPONENTES

       • Indexer
             – Interface REST para manipulação de documentos

             – API sync e async


       • Searcher
             – Query string para definir a busca

             – Cache




   13/05/11                                           8
Saturday, May 14, 2011                                         8
COMPONENTES

       • Repositório
             – Colunas
             – Tipo de dados   – Comportamento
                   • Texto       • Indexable

                   • Número      • Analyzed

                   • Data        • Sortable

                   • Moeda       • Boost

                   • Url




   13/05/11                                    9
Saturday, May 14, 2011                             9
AMBIENTE

       • Ambiente FAST SEARCH
             – Cluster de 4 máquinas

             – 100 QPS


       • Ambiente Lucene
             – Cluster de 2 máquinas

             – ?? QPS




   13/05/11                            10
Saturday, May 14, 2011                      10
MÉTRICAS

       • scripts bash
                for x in $(seq 1 100) do
                   curl "http://localhost:8080/searcher/?...$x...”;
                done
       • iostat

       • nfsstat
       • top

       • JMeter




   13/05/11                                                   11
Saturday, May 14, 2011                                                11
TIMELINE



                SERVIDOR LINUX 1
                         NFS PARAMS




                         24 QPS


   13/05/11                           12
Saturday, May 14, 2011                     12
TIMELINE


                         EMAIL ROd → Ops
       “Finally, realize that performance over NFS is not great,
                  because the bytes must cross the wires to get
            to the computer doing the searching. It’s possible
                  mounting the NFS directory as read-only may
            improve the performance, but likely you’ll still be far
               from the performance of a local native directory.”


                                                Fonte: Lucene In Action



   13/05/11                                                     13
Saturday, May 14, 2011                                                    13
TIMELINE



                         DESKTOP LINUX
                            DISCO LOCAL




                           200 QPS


   13/05/11                               14
Saturday, May 14, 2011                         14
TIMELINE



                          OTIMIZAÇÃO
                            COMPOUND FILE
                              READ ONLY
                            FIELD SELECTOR
                         ESTRATÉGIA DE REOPEN



   13/05/11                                     15
Saturday, May 14, 2011                               15
TIMELINE



                SERVIDOR LINUX 1
                         NFS PARAMS




                         30 QPS


   13/05/11                           16
Saturday, May 14, 2011                     16
TIMELINE



                SERVIDOR LINUX 2
                         RAM Directory




                         550 QPS


   13/05/11                              17
Saturday, May 14, 2011                        17
TIMELINE



                SERVIDOR LINUX 2
                         DISCO LOCAL




                         500 QPS


   13/05/11                            18
Saturday, May 14, 2011                      18
TIMELINE



                SERVIDOR LINUX 2
                         NFS DEFAULT




                         420 QPS


   13/05/11                            19
Saturday, May 14, 2011                      19
TIMELINE



                SERVIDOR LINUX 1
                         NFS DEFAULT + RO




                         450 QPS


   13/05/11                                 20
Saturday, May 14, 2011                           20
TIMELINE



                            PROBLEMA
                   VÁRIOS SEARCHERS NO MESMO
                         NFS DEGRADARIA SEU USO?




   13/05/11                                    21
Saturday, May 14, 2011                              21
TIMELINE



          SERVIDOR LINUX 1 e 2
                         CARGA: SERVIDOR LINUX 3 e 4




                               450 QPS


   13/05/11                                            22
Saturday, May 14, 2011                                      22
TIMELINE



                SERVIDOR LINUX 1
                         MOD_MEMCACHE LRU




                         3000 QPS


   13/05/11                                 23
Saturday, May 14, 2011                           23
ENTRADA EM PRODUÇÃO...



          SERVIDOR LINUX 1 e 2
                         NFS DEFAULT + RO




                          27 QPS


   13/05/11                                 24
Saturday, May 14, 2011                           24
E CRESCENDO...



          SERVIDOR LINUX 1 e 2
                         NFS DEFAULT + RO




                         213 QPS


   13/05/11                                 25
Saturday, May 14, 2011                           25
RECORDE!



          SERVIDOR LINUX 1 e 2
                         NFS DEFAULT + RO




                         462 QPS


   13/05/11                                 26
Saturday, May 14, 2011                           26
APÓS UM ANO...

       • Transição de conteúdo da busca antiga

       • Novas abordagens de busca

       • Reutilização em produtos internos

       • Plataforma em constante evolução




   13/05/11                                      27
Saturday, May 14, 2011                                27
PERGUNTAS




   13/05/11              28
Saturday, May 14, 2011        28
Obrigado =)
                                 ROd (rzaccara@uolinc.com)
                         Léo Nickel (cad_lnickel@uolinc.com)




Saturday, May 14, 2011                                         29

Mais conteúdo relacionado

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
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 ChatGPTExpeed Software
 
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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
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...
 

Lucene alcança 400 buscas por segundo com otimizações

  • 1. Lucene nas alturas: 400 buscas por segundo ROd Léo Nickel Saturday, May 14, 2011 1
  • 2. ROd Desenvolvedor especialista em arquiteturas de alta performance relacionadas a publicação e busca de conteúdo 13/05/11 2 Saturday, May 14, 2011 2
  • 3. Léo Nickel Desenvolvedor de sistemas com experiência de 5 anos em aplicações Java EE nos segmentos de telefonia, marketing online e busca orgânica 13/05/11 3 Saturday, May 14, 2011 3
  • 4. MOTIVAÇÃO • Substituição do motor de busca FAST SEARCH • Alternativas – Compass – ElasticSearch – Lucene – Solr – Sphinx 13/05/11 4 Saturday, May 14, 2011 4
  • 5. LUCENE Mar/2000: Versão 0.01 (SourceForge) Thu Mar 30 20:02:47 2000 UTC by cutting Out/2000: Versão 1.0 Jun/2002: Versão 1.2 (Apache Jakarta) Dez/2004: Lucene in Action (1.4.3) Fev/2005: Apache top-level project Mai/2006: Versão 2.0 Set/2009: Versão 2.9 Nov/2009: Versão 3.0 Mar/2011: Versão 3.1 13/05/11 5 Saturday, May 14, 2011 5
  • 6. REQUISITOS NÃO FUNCIONAIS • Baixa latência de indexação • Alta disponibildade de busca • Proteção do storage • Capacidade adaptativa dos repositórios • Estado imutável 13/05/11 6 Saturday, May 14, 2011 6
  • 7. REQUISITOS FUNCIONAIS • Paginação • Ordenações • Sharding • Otimização de índices • Suporte a diversos charsets 13/05/11 7 Saturday, May 14, 2011 7
  • 8. COMPONENTES • Indexer – Interface REST para manipulação de documentos – API sync e async • Searcher – Query string para definir a busca – Cache 13/05/11 8 Saturday, May 14, 2011 8
  • 9. COMPONENTES • Repositório – Colunas – Tipo de dados – Comportamento • Texto • Indexable • Número • Analyzed • Data • Sortable • Moeda • Boost • Url 13/05/11 9 Saturday, May 14, 2011 9
  • 10. AMBIENTE • Ambiente FAST SEARCH – Cluster de 4 máquinas – 100 QPS • Ambiente Lucene – Cluster de 2 máquinas – ?? QPS 13/05/11 10 Saturday, May 14, 2011 10
  • 11. MÉTRICAS • scripts bash for x in $(seq 1 100) do curl "http://localhost:8080/searcher/?...$x...”; done • iostat • nfsstat • top • JMeter 13/05/11 11 Saturday, May 14, 2011 11
  • 12. TIMELINE SERVIDOR LINUX 1 NFS PARAMS 24 QPS 13/05/11 12 Saturday, May 14, 2011 12
  • 13. TIMELINE EMAIL ROd → Ops “Finally, realize that performance over NFS is not great, because the bytes must cross the wires to get to the computer doing the searching. It’s possible mounting the NFS directory as read-only may improve the performance, but likely you’ll still be far from the performance of a local native directory.” Fonte: Lucene In Action 13/05/11 13 Saturday, May 14, 2011 13
  • 14. TIMELINE DESKTOP LINUX DISCO LOCAL 200 QPS 13/05/11 14 Saturday, May 14, 2011 14
  • 15. TIMELINE OTIMIZAÇÃO COMPOUND FILE READ ONLY FIELD SELECTOR ESTRATÉGIA DE REOPEN 13/05/11 15 Saturday, May 14, 2011 15
  • 16. TIMELINE SERVIDOR LINUX 1 NFS PARAMS 30 QPS 13/05/11 16 Saturday, May 14, 2011 16
  • 17. TIMELINE SERVIDOR LINUX 2 RAM Directory 550 QPS 13/05/11 17 Saturday, May 14, 2011 17
  • 18. TIMELINE SERVIDOR LINUX 2 DISCO LOCAL 500 QPS 13/05/11 18 Saturday, May 14, 2011 18
  • 19. TIMELINE SERVIDOR LINUX 2 NFS DEFAULT 420 QPS 13/05/11 19 Saturday, May 14, 2011 19
  • 20. TIMELINE SERVIDOR LINUX 1 NFS DEFAULT + RO 450 QPS 13/05/11 20 Saturday, May 14, 2011 20
  • 21. TIMELINE PROBLEMA VÁRIOS SEARCHERS NO MESMO NFS DEGRADARIA SEU USO? 13/05/11 21 Saturday, May 14, 2011 21
  • 22. TIMELINE SERVIDOR LINUX 1 e 2 CARGA: SERVIDOR LINUX 3 e 4 450 QPS 13/05/11 22 Saturday, May 14, 2011 22
  • 23. TIMELINE SERVIDOR LINUX 1 MOD_MEMCACHE LRU 3000 QPS 13/05/11 23 Saturday, May 14, 2011 23
  • 24. ENTRADA EM PRODUÇÃO... SERVIDOR LINUX 1 e 2 NFS DEFAULT + RO 27 QPS 13/05/11 24 Saturday, May 14, 2011 24
  • 25. E CRESCENDO... SERVIDOR LINUX 1 e 2 NFS DEFAULT + RO 213 QPS 13/05/11 25 Saturday, May 14, 2011 25
  • 26. RECORDE! SERVIDOR LINUX 1 e 2 NFS DEFAULT + RO 462 QPS 13/05/11 26 Saturday, May 14, 2011 26
  • 27. APÓS UM ANO... • Transição de conteúdo da busca antiga • Novas abordagens de busca • Reutilização em produtos internos • Plataforma em constante evolução 13/05/11 27 Saturday, May 14, 2011 27
  • 28. PERGUNTAS 13/05/11 28 Saturday, May 14, 2011 28
  • 29. Obrigado =) ROd (rzaccara@uolinc.com) Léo Nickel (cad_lnickel@uolinc.com) Saturday, May 14, 2011 29