SlideShare a Scribd company logo
1 of 11
Download to read offline
Thousands of Indexes in the Cloud




                                    1
Greplin searches:




                                                                                        2

- Greplin helps you search all your personal information, wherever it is.

- As Michael Arrington of TechCrunch said, we’ve “attacked the other half of search.”

- Greplin supports over a dozen services today, with more added constantly.
Requirements

          • Many inserts
          • Fewer searches
          • Low per-user cost

                                                                                          3

- We insert up to 5,000 documents/second

- Average document size of 2KB-4KB

- A fully loaded server is an Amazon c1.medium machine responsible for up to 80,000,000
3KB documents

- Each machine has just 1.7GB of RAM!

- Overall, we handle about 50M documents per GB of RAM with median search latencies
around 200ms.
Memory

          • Per doc: 2 longs + 1 int +1 String (avg 5
              letters) into the FieldCache, and average of
              10 norm’d fields/doc
             • 27 bytes/doc * 50M docs = 1.3GB


                                                                                       4

- Ranking requires pulling a few field values and norms into memory.

- For 50M documents would require well over 1.3GB of memory.

- Assuming an optimized index, searching the number of docs we have per machine with
1GB of RAM is impossible without swapping.

- We benchmarked using a single-index + swapping: search times were multi-second.
“Virtual memory was meant to make it
          easier to program when data was larger
           than the physical memory, but people
                  have still not caught on.”
                         Poul-Henning Kamp,Varnish architect and coder.
                              What’s Wrong With 1975 Programming
                      http://www.varnish-cache.org/trac/wiki/ArchitectNotes




                                                                                             5

- Over the last decade, the trend has been to stop manually managing what goes on disk and
what goes in RAM, instead trusting the operating system’s virtual memory and paging
systems to swap data in/out appropriately.

- For example, the caching HTTP proxy Varnish trusts the OS’s virtual memory, and is thus
significantly simpler and faster than Squid, which tries to manage the what-belongs-in-
memory vs what-belongs-on-disk itself.

- This philosophy has been jokingly summarized as “You’re not smarter than Linus, so don’t
try to be.”
We’re Smarter than
                     Linus!*


* When we cheat
                                                                                               6

- Many signals (such as user logins) let us predict which users are likely to do searches better
than the OS can.

- By keeping each user’s data in a separate index, we save memory and improve
performance.

- We only keep open IndexSearchers for users who are likely to do searches.
Other Benefits

           • tar -cvzf user.tar.gz user && mv user.tar.gz
           • du -h
           • Smaller ‘corruption domain’


                                                            7

By keeping each user’s index separate, we can:

- more easily move users between servers

- figure out their space usage

- ensure index corruption affects only one user
RAM Index

                                           • Deletion Filters
                                           • MultiSearcher
                                           • Flush planning



                                                                                               8

- Inspired by Zoie (http://sna-projects.com/zoie/)

- All incoming documents are first added to a RAM Index.

- A user search encompasses a ‘filtered’ view of the RAM Index, the currently flushing index,
plus their disk index.

- When the RAM index is ‘full’ we create a new RAM index.

- We open IndexWriters for each user in turn and flush documents from RAM to disk.

- Interesting cases including updates and deletions are handled with temporary filters on the
disk index.
Amazon Cloud
          •            Script everything

          •            XFS+LVM expandability and snapshots are helpful

          •            Some pain is unavoidable
                                                           EBS Performance
                   150000




                   112500
          KB/sec




                   75000




                   37500




                       0
                              Seq. Write            Seq. Read          Random Read         Random Write


                                           Single EBS     RAID10 EBS     Instance Store   RAID 0 EBS




                                                                                                          9

More info at: http://tech.blog.greplin.com/aws-best-practices-and-benchmarks
Other Cool Stuff
          •   ‘kill -9’ any time with no data-loss via a Protocol
              Buffer Write Ahead Log

          •   Detect duplicate documents with Bloom Filter

          •   Dynamically sized SoftReference Cache

          •   Custom MergeScheduler

          •   Custom FieldCache for multi-valued or sparse
              fields

          •   Efficient result clustering and faceting


                                                                    10

Some of this is open source: https://github.com/Greplin
Questions?
                          Suggestions?


            Robby Walker                    Shaneal Manek

                shaneal@greplin.com
                     @smanek
                                                            11

We’re hiring: http://www.greplin.com/jobs

More Related Content

Viewers also liked

Piel de asno. Renarración de cuento clásico.
Piel de asno. Renarración de cuento clásico.Piel de asno. Renarración de cuento clásico.
Piel de asno. Renarración de cuento clásico.mdelcfp
 
4th june meeting summary
4th june meeting summary4th june meeting summary
4th june meeting summaryAlan Bassett
 
TSG Members Handbook
TSG Members HandbookTSG Members Handbook
TSG Members HandbookAlan Bassett
 
Układ komunikacyjny dla Franowa
Układ komunikacyjny dla FranowaUkład komunikacyjny dla Franowa
Układ komunikacyjny dla FranowaEkokonsultacje
 
Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...
Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...
Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...Alessandro Lovari
 
Lascialo in Rete (set.2007)
Lascialo in Rete (set.2007)Lascialo in Rete (set.2007)
Lascialo in Rete (set.2007)Annarita Salsi
 
Simple SEO - SEO Made Simple - Do It Yourself SEO
Simple SEO - SEO Made Simple - Do It Yourself SEOSimple SEO - SEO Made Simple - Do It Yourself SEO
Simple SEO - SEO Made Simple - Do It Yourself SEOThe JAR Group
 
Are you sitting comfortably?
Are you sitting comfortably?Are you sitting comfortably?
Are you sitting comfortably?Brightwave Group
 
Total learning: Case study: organising space - powering a community of practi...
Total learning: Case study: organising space - powering a community of practi...Total learning: Case study: organising space - powering a community of practi...
Total learning: Case study: organising space - powering a community of practi...Brightwave Group
 
Asbestos New Guide Lucion
Asbestos New Guide LucionAsbestos New Guide Lucion
Asbestos New Guide LucionAlan Bassett
 
Mobile Banking in 2020
Mobile Banking in 2020Mobile Banking in 2020
Mobile Banking in 2020mahendraji
 
Mercurial はオフラインの海を越える
Mercurial はオフラインの海を越えるMercurial はオフラインの海を越える
Mercurial はオフラインの海を越えるzetamatta
 
Os negros africanos no Brasil Colonial Monize e Hanna
Os negros africanos no Brasil Colonial Monize e HannaOs negros africanos no Brasil Colonial Monize e Hanna
Os negros africanos no Brasil Colonial Monize e Hannanice miranda
 
Groundworks Shad Booking Form
Groundworks Shad Booking FormGroundworks Shad Booking Form
Groundworks Shad Booking FormAlan Bassett
 
kasina: Costs of Compensation - Sales & National Accounts 2009
kasina: Costs of Compensation - Sales & National Accounts 2009kasina: Costs of Compensation - Sales & National Accounts 2009
kasina: Costs of Compensation - Sales & National Accounts 2009kasina
 
Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...
Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...
Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...Alan Bassett
 
Mud In Stock...Discontinued Items
Mud In Stock...Discontinued ItemsMud In Stock...Discontinued Items
Mud In Stock...Discontinued Itemscnunnally
 

Viewers also liked (18)

Piel de asno. Renarración de cuento clásico.
Piel de asno. Renarración de cuento clásico.Piel de asno. Renarración de cuento clásico.
Piel de asno. Renarración de cuento clásico.
 
4th june meeting summary
4th june meeting summary4th june meeting summary
4th june meeting summary
 
TSG Members Handbook
TSG Members HandbookTSG Members Handbook
TSG Members Handbook
 
Układ komunikacyjny dla Franowa
Układ komunikacyjny dla FranowaUkład komunikacyjny dla Franowa
Układ komunikacyjny dla Franowa
 
Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...
Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...
Non basta essere su Facebook per essere 2.0. La qualità della presenza della ...
 
Lascialo in Rete (set.2007)
Lascialo in Rete (set.2007)Lascialo in Rete (set.2007)
Lascialo in Rete (set.2007)
 
Simple SEO - SEO Made Simple - Do It Yourself SEO
Simple SEO - SEO Made Simple - Do It Yourself SEOSimple SEO - SEO Made Simple - Do It Yourself SEO
Simple SEO - SEO Made Simple - Do It Yourself SEO
 
Are you sitting comfortably?
Are you sitting comfortably?Are you sitting comfortably?
Are you sitting comfortably?
 
Total learning: Case study: organising space - powering a community of practi...
Total learning: Case study: organising space - powering a community of practi...Total learning: Case study: organising space - powering a community of practi...
Total learning: Case study: organising space - powering a community of practi...
 
Asbestos New Guide Lucion
Asbestos New Guide LucionAsbestos New Guide Lucion
Asbestos New Guide Lucion
 
Mobile Banking in 2020
Mobile Banking in 2020Mobile Banking in 2020
Mobile Banking in 2020
 
Mercurial はオフラインの海を越える
Mercurial はオフラインの海を越えるMercurial はオフラインの海を越える
Mercurial はオフラインの海を越える
 
Os negros africanos no Brasil Colonial Monize e Hanna
Os negros africanos no Brasil Colonial Monize e HannaOs negros africanos no Brasil Colonial Monize e Hanna
Os negros africanos no Brasil Colonial Monize e Hanna
 
Groundworks Shad Booking Form
Groundworks Shad Booking FormGroundworks Shad Booking Form
Groundworks Shad Booking Form
 
kasina: Costs of Compensation - Sales & National Accounts 2009
kasina: Costs of Compensation - Sales & National Accounts 2009kasina: Costs of Compensation - Sales & National Accounts 2009
kasina: Costs of Compensation - Sales & National Accounts 2009
 
Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...
Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...
Hse alert 2013 35 two fatalities as a result of a failure of a bonnet-to...
 
POSO - podsumowanie
POSO - podsumowaniePOSO - podsumowanie
POSO - podsumowanie
 
Mud In Stock...Discontinued Items
Mud In Stock...Discontinued ItemsMud In Stock...Discontinued Items
Mud In Stock...Discontinued Items
 

Recently uploaded

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Greplin at Lucene Revolution 2011

  • 1. Thousands of Indexes in the Cloud 1
  • 2. Greplin searches: 2 - Greplin helps you search all your personal information, wherever it is. - As Michael Arrington of TechCrunch said, we’ve “attacked the other half of search.” - Greplin supports over a dozen services today, with more added constantly.
  • 3. Requirements • Many inserts • Fewer searches • Low per-user cost 3 - We insert up to 5,000 documents/second - Average document size of 2KB-4KB - A fully loaded server is an Amazon c1.medium machine responsible for up to 80,000,000 3KB documents - Each machine has just 1.7GB of RAM! - Overall, we handle about 50M documents per GB of RAM with median search latencies around 200ms.
  • 4. Memory • Per doc: 2 longs + 1 int +1 String (avg 5 letters) into the FieldCache, and average of 10 norm’d fields/doc • 27 bytes/doc * 50M docs = 1.3GB 4 - Ranking requires pulling a few field values and norms into memory. - For 50M documents would require well over 1.3GB of memory. - Assuming an optimized index, searching the number of docs we have per machine with 1GB of RAM is impossible without swapping. - We benchmarked using a single-index + swapping: search times were multi-second.
  • 5. “Virtual memory was meant to make it easier to program when data was larger than the physical memory, but people have still not caught on.” Poul-Henning Kamp,Varnish architect and coder. What’s Wrong With 1975 Programming http://www.varnish-cache.org/trac/wiki/ArchitectNotes 5 - Over the last decade, the trend has been to stop manually managing what goes on disk and what goes in RAM, instead trusting the operating system’s virtual memory and paging systems to swap data in/out appropriately. - For example, the caching HTTP proxy Varnish trusts the OS’s virtual memory, and is thus significantly simpler and faster than Squid, which tries to manage the what-belongs-in- memory vs what-belongs-on-disk itself. - This philosophy has been jokingly summarized as “You’re not smarter than Linus, so don’t try to be.”
  • 6. We’re Smarter than Linus!* * When we cheat 6 - Many signals (such as user logins) let us predict which users are likely to do searches better than the OS can. - By keeping each user’s data in a separate index, we save memory and improve performance. - We only keep open IndexSearchers for users who are likely to do searches.
  • 7. Other Benefits • tar -cvzf user.tar.gz user && mv user.tar.gz • du -h • Smaller ‘corruption domain’ 7 By keeping each user’s index separate, we can: - more easily move users between servers - figure out their space usage - ensure index corruption affects only one user
  • 8. RAM Index • Deletion Filters • MultiSearcher • Flush planning 8 - Inspired by Zoie (http://sna-projects.com/zoie/) - All incoming documents are first added to a RAM Index. - A user search encompasses a ‘filtered’ view of the RAM Index, the currently flushing index, plus their disk index. - When the RAM index is ‘full’ we create a new RAM index. - We open IndexWriters for each user in turn and flush documents from RAM to disk. - Interesting cases including updates and deletions are handled with temporary filters on the disk index.
  • 9. Amazon Cloud • Script everything • XFS+LVM expandability and snapshots are helpful • Some pain is unavoidable EBS Performance 150000 112500 KB/sec 75000 37500 0 Seq. Write Seq. Read Random Read Random Write Single EBS RAID10 EBS Instance Store RAID 0 EBS 9 More info at: http://tech.blog.greplin.com/aws-best-practices-and-benchmarks
  • 10. Other Cool Stuff • ‘kill -9’ any time with no data-loss via a Protocol Buffer Write Ahead Log • Detect duplicate documents with Bloom Filter • Dynamically sized SoftReference Cache • Custom MergeScheduler • Custom FieldCache for multi-valued or sparse fields • Efficient result clustering and faceting 10 Some of this is open source: https://github.com/Greplin
  • 11. Questions? Suggestions? Robby Walker Shaneal Manek shaneal@greplin.com @smanek 11 We’re hiring: http://www.greplin.com/jobs