spark overview high level architecture indexing from
play

Spark Overview / High-level Architecture Indexing from Spark - PowerPoint PPT Presentation

Spark Overview / High-level Architecture Indexing from Spark Reading data from Solr + term vectors & Spark SQL Document Matching user since 2010, committer since April 2014, work for SolrCloud features and bin/solr! Release manager


  1. Spark Overview / High-level Architecture Indexing from Spark Reading data from Solr + term vectors & Spark SQL Document Matching

  2. user since 2010, committer since April 2014, work for SolrCloud features … and bin/solr! Release manager for Lucene / Solr 5.1 in Action Several years experience working with Hadoop, Pig, Hive, , but only started using Spark about 6 months

  3. Wealth of overview / getting started resources on the Web https://spark.apache.org/ https://www.cs.berkeley.edu/~matei/papers/2012/nsdi_spark.pdf Faster, more modernized alternative to MapReduce Hadoop sorted 100TB in 23 minutes (3x faster than Yahoo’s previous record while using10x Unified platform for Big Data Great for iterative algorithms (PageRank, K-Means, Logistic regression) & interactive data mining

  4. MLlib Spark GraphX Spark (machine SQL (BSP) Streaming learning) Spark Core Execution The Shuffle Caching Model

  5. Spark Master (daemon) Spark Worker Node (1...N of these) • Keeps track of live workers • Web UI on port 8080 Spark Slave (daemon) • Task Scheduler • Restart failed tasks Spark Executor (JVM process) Losing a master prevents new applications from being executed Tasks Can achieve HA using ZooKeeper and multiple master nodes

  6. val ¡file ¡= ¡spark.textFile(" val ¡counts ¡= ¡file.flatMap(line ¡=> ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡.map(word ¡=> ¡(word, ¡1)

  7. map(word ¡=> ¡(word, ¡1)) ¡ Map words into Split lines into words pairs with count of 1 quick ¡ (quick,1) ¡ (brown,1) ¡ brown ¡ (fox,1) ¡ fox ¡ x quick ¡ (quick,1) ¡ … ¡ quick ¡ (quick,1) ¡ … ¡

  8. Created from external system OR using a transformation of another RDD lineage of coarse-grained transformations (map, join, filter, is lost, RDDs can be re-computed by re-playing the transformations User can choose to persist an RDD (for reusing during interactive data-mining)

  9. https://github.com/LucidWorks/spark-solr/ Streaming applications Real-time, streaming ETL jobs as sink for Spark job Real-time document matching against stored queries Distributed computations (interactive data mining, machine learning) Solr query as Spark RDD (resilient distributed dataset) Optionally process results from each shard in parallel

  10. Transform a stream of records into small, deterministic batches Discretized stream: sequence of RDDs Once you have an RDD, you can use all the other Spark libs (MLlib, etc) Low-latency micro batches Time to process a batch must be less than the batch interval time Two types of operators: Transformations (group by, join, etc) Output (send to some external sink, e.g. Solr) Impressive performance!

  11. zkHost ¡localhost:2181 ¡–collection ¡social ¡ Various transformations / enrichments SolrSupport.indexDStreamOfDocs on each tweet (e.g. sentiment analysis, language detection) map() <Status> tweets = jssc, null, filters); JavaDStream<SolrInputDocument> docs = tweets.map

  12. <Status> ¡tweets ¡= ¡ createStream (jssc, ¡ null , ¡filters); ¡ // ¡map ¡incoming ¡tweets ¡into ¡SolrInputDocument ¡objects ¡for ¡indexing ¡in ¡Solr SolrInputDocument> ¡docs ¡= ¡tweets.map( ¡ Status,SolrInputDocument>() ¡{ ¡ SolrInputDocument ¡call(Status ¡status) ¡{ ¡ ¡doc ¡= ¡ autoMapToSolrInputDoc ( "tweet-­‑" +status.getId(), ¡status, ¡ provider_s" , ¡ "twitter" ); ¡ author_s" , ¡status.getUser().getScreenName()); ¡ " , ¡status.isRetweet() ¡? ¡ "echo" ¡ : ¡ "post" ); ¡

  13. > ¡docs) ¡ SolrInputDocument>, ¡Void>() ¡{ ¡ SolrInputDocument> ¡solrInputDocumentJavaRDD) ¡throws ¡Exception ¡{ ¡ solrInputDocumentJavaRDD. foreachPartition ( ¡ <Iterator<SolrInputDocument>>() ¡{ ¡ (Iterator<SolrInputDocument> ¡solrInputDocumentIterator) ¡throws ¡Exception ¡{ ¡ solrServer ¡= ¡getSolrServer(zkHost); ¡ SolrInputDocument> ¡batch ¡= ¡new ¡ArrayList<SolrInputDocument>(); ¡ solrInputDocumentIterator.hasNext()) ¡{ ¡ solrInputDocumentIterator.next()); ¡ () ¡>= ¡batchSize) ¡ sendBatchToSolr(solrServer, ¡collection, ¡batch); ¡ batch.isEmpty()) ¡ (solrServer, ¡collection, ¡batch); ¡

  14. For each document, determine which of a large set of stored queries Useful for alerts, alternative flow paths through a stream, etc Index a micro-batch into an embedded (in-memory) Solr instance and then determine which queries match Matching framework; you have to decide where to load the stored queries from and what to do when matches are found Scale it using Spark … need to scale to many queries, checkout

  15. JavaDStream<SolrInputDocument> enriched = SolrSupport. filterDocuments (docFilterContext Get queries … map() Index docs into an EmbeddedSolrServer = Initialized from configs , null, filters); stored in ZooKeeper JavaDStream<SolrInputDocument> docs = tweets.map ( new Function<Status,SolrInputDocument>() {

  16. Custom partitioning scheme for RDD using Solr’s DocRouter Stream docs directly to each shard leader using metadata from document shard assignment, and ConcurrentUpdateSolrClient shardPartitioner ¡= ¡ new ¡ ShardPartitioner(zkHost, ¡collection); ¡ shardPartitioner).foreachPartition( ¡ <Iterator<Tuple2<String, ¡SolrInputDocument>>>() ¡{ ¡ call(Iterator<Tuple2<String, ¡SolrInputDocument>> ¡tupleIter) ¡ ConcurrentUpdateSolrClient ¡cuss ¡= ¡ null ; ¡ tupleIter.hasNext()) ¡{ ¡ ConcurrentUpdateSolrClient ¡once ¡per ¡partition ¡

  17. Can execute any query and expose as an RDD produces JavaRDD<SolrDocument> ¡ Use deep-paging if needed (cursorMark) For reading full result sets where global sort order doesn’t matter, parallelize query execution by distributing requests across the Spark SolrDocument> ¡results ¡= ¡ ¡ solrRDD.queryShards(jsc, ¡solrQuery); ¡

  18. Can be used to construct RDD<Vector> which can then be passed to new ¡ SolrRDD(zkHost, ¡collection); ¡ <Vector> ¡vectors ¡= ¡ ¡ solrRDD.queryTermVectors(jsc, ¡solrQuery, ¡field, ¡numFeatures ¡clusters ¡= ¡ ¡ vectors.rdd(), ¡numClusters, ¡numIterations);

  19. new ¡ SolrQuery(...); ¡ "text_t" , "type_s" ); ¡ SolrRDD(zkHost, ¡collection); ¡ solrJavaRDD ¡= ¡solrRDD.queryShards(jsc, ¡solrQuery); ¡ new ¡ SQLContext(jsc); ¡ sqlContext, ¡solrQuery, ¡solrJavaRDD, ¡zkHost, ¡collection); ¡ "tweets" ); ¡ "SELECT ¡COUNT(type_s) ¡FROM ¡tweets ¡WHERE ¡type_s='echo'" results.javaRDD().map( new ¡ Function<Row, ¡Long>() ¡{ ¡ Long ¡call(Row ¡row) ¡{ ¡

  20. Reference implementation of Solr and Spark on YARN Formal benchmarks for reads and writes to Solr Checkout SOLR-6816 – improving replication performance Add Spark support to Solr Scale Toolkit Integrate metrics to give visibility into performance More use cases … Feel free to reach out to me with questions:

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend