available in real time
play

AVAILABLE IN REAL TIME WITH ELASTICSEARCH Yann Cluchey CTO @ - PowerPoint PPT Presentation

MAKING ENTERPRISE DATA AVAILABLE IN REAL TIME WITH ELASTICSEARCH Yann Cluchey CTO @ Cogenta CTO @ GfK Online Pricing Intelligence What is Enterprise Data? What is Enterprise Data? Online Pricing Intelligence 1. Gather data from 500+ of


  1. MAKING ENTERPRISE DATA AVAILABLE IN REAL TIME WITH ELASTICSEARCH Yann Cluchey CTO @ Cogenta CTO @ GfK Online Pricing Intelligence

  2. What is Enterprise Data?

  3. What is Enterprise Data?

  4. Online Pricing Intelligence 1. Gather data from 500+ of eCommerce sites 2. Organise into high quality market view 3. Competitive intelligence tools

  5. Custom Crawler HTML  Parse web content HTML Price,  Discover product data Stock, Price, Meta HTML  Tracking 20m products Stock, Meta  Daily+ HTML Price, Stock, Meta Price, Stock, Meta

  6. Processing, Storage  Enrichment  Persistent Storage Processing  Product Catalogue  + time series data Database

  7. Thing #1 - Detection  Identify distinct products  Automated information retrieval  Lucene + custom index builder  Continuous process Matcher  (Humans for QA) Index Builder Database Lucene Index GUI

  8. Thing #2 - BI Tools  Web Applications Database  Also based on Lucene  Batch index build process  Per-customer indexes Index Builder Customer Customer Customer Index 1 Index 2 Index 3 BI Tools

  9. Thing #1 - Pain  Continuously indexing Database  Track changes, read back out to index  Drain on performance  Latency, coping with peaks  Full rebuild for index schema change Index Builder or inconsistencies  Full rebuild doesn’t scale well… Lucene  Unnecessary work..? Index GUI

  10. Thing #2 - Pain Batch Sync  Twice daily batch rebuild, per customer Database Indexing  Very slow Database  Moar customers?  Moar data?  Moar often? Index Builder  Data set too complex, keeps changing Customer Customer Customer  Index shipping Web Server 1 Web Server 2 Index 1 Index 2 Index 3  Moar web servers? BI Tools

  11. Pain Points  As data, customers scale, Database processes slow down  Adapting to change  Easy to layer on, hard to make fundamental changes Index Builder  Read vs write concerns  Database Maintenance Index

  12. Goals  Eliminate latencies  Improve scalability  Improve availability  Something achievable  Your mileage will vary

  13. elasticsearch  Open source, distributed search engine  Based on Lucene, fully featured API  Querying, filtering, aggregation  Text processing / IR  Schema-free  Yummy (real-time, sharding, highly available)  Silver bullets not included

  14. Our Pipeline Indexing Indexing Database Database Processors Processors Processors Database Processors Indexers Processors Processors Indexes Web Servers Crawlers Indexes Web Servers Crawlers Indexes Web Servers

  15. Our New Pipeline Processors Database Processors Processors Processors Processors Processors Indexers Indexes Web Servers Indexes Crawlers Indexes Web Servers Crawlers Web Servers

  16. Event Hooks  Messages fired OnCreate.. and OnUpdate  Payload contains everything needed for indexing  The data  Keys (still mastered in SQL)  Versioning  Sender has all the information already  Use RabbitMQ to control event message flow  Messages are durable

  17. Indexing Strategy  RESTful API (HTTP, Thrift, Memcache)  Use bulk methods Event Q  They support percolation  Rivers (pull) Index Q Indexer  RabbitMQ River  JDBC River  Mongo/Couch/etc. River  Logstash

  18. Model Your Data  What’s in your documents?  Database = Index Table = Type ...?  Start backwards  What do your applications need?  How will they need to query the data?  Prototyping! Fail quickly!  elasticsearch supports Nested objects, parent/child docs

  19. Joins  Events relate to line-items  Amazon decreased price  Pixmania is running a promotion  Need to group by Product Key/value store  Use key/value store  Get full Product document  Modify it, write it back 5  Enqueue indexing instruction 1 3 3 5 4 1 Indexer Event Q Index Q 3 2 1 4

  20. Where to join?  elasticsearch  Consider performance  Depends how data is structured/indexed (e.g. parent/child)  Compression, collisions  In-memory cache (e.g. Memcache)  Persistent storage (e.g. Cassandra or Mongo)  Two awesome benefits  Quickly re-index if needed  Updates have access to the full Product data  Serialisation is costly

  21. Synchronisation & Concurrency  Fault tolerance  Code to expect missing data  Out of sequence events  Concurrency Control  Apply Optimistic Concurrency Control at Mongo  Optimise for collisions

  22. Synchronisation & Concurrency  Synchronisation  Out of sequence index instructions  elasticsearch external versioning  Can rebuild from scratch if need to  Consistency  Which version is right?  Dates  Revision numbers from SQL  Independent updates

  23. Figures  Ingestion  20m data points/day (continuously)  ~ 200GB Custom-Built elasticsearch Lucene  3K msgs/second at peak Latency 3 hours < 1 second Bottleneck Disk (SQL) CPU  Hardware  SQL: 2 x 12-core, 64GB, 72-spindle SAN  Indexing: 4 x 4-core, 8GB  Mongo: 1 x 4-core, 16GB, 1xSSD  Elastic: 5 x 4-core, 16GB, 1xSSD

  24. Managing Change Client Key/value store Alias Index Index_A Index_A Index_B Index_B Indexer Event Q

  25. Thanks  @YannCluchey  Concurrency Patterns with MongoDB http://slidesha.re/YFOehF  Consistency without Consensus Peter Bourgon, SoundCloud http://bit.ly/1DUAO1R  Eventually Consistent Data Structures Sean Cribbs, Basho https://vimeo.com/43903960

Recommend


More recommend