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

Układ komunikacyjny dla Franowa
Układ komunikacyjny dla FranowaUkład komunikacyjny dla Franowa
Układ komunikacyjny dla Franowa
Ekokonsultacje
 
Mobile Banking in 2020
Mobile Banking in 2020Mobile Banking in 2020
Mobile Banking in 2020
mahendraji
 
Mud In Stock...Discontinued Items
Mud In Stock...Discontinued ItemsMud In Stock...Discontinued Items
Mud In Stock...Discontinued Items
cnunnally
 

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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

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