from several hundred million to some billion words
play

From Several Hundred Million to Some Billion Words: - PowerPoint PPT Presentation

From Several Hundred Million to Some Billion Words: Scaling up a Corpus Indexer and a Search Engine with MapReduce Jordi Porta ComputaBonal


  1. From ¡Several ¡Hundred ¡Million ¡to ¡Some ¡Billion ¡Words: ¡ ¡ Scaling ¡up ¡a ¡Corpus ¡Indexer ¡and ¡a ¡Search ¡Engine ¡ ¡ with ¡MapReduce ¡ Jordi ¡Porta ¡ ComputaBonal ¡LinguisBcs ¡Area ¡ Departamento ¡de ¡Tecnología ¡y ¡Sistemas ¡ Centro ¡de ¡Estudios ¡de ¡la ¡Real ¡Academia ¡Española ¡ (porta@rae.es) ¡

  2. Outline ¡ ¡ “The ¡more ¡observa-ons ¡we ¡gather ¡about ¡language ¡use, ¡ the ¡more ¡accurate ¡descrip-on ¡we ¡have ¡about ¡language ¡itself” ¡ ¡ Lin ¡& ¡Dyer, ¡2010: ¡ Data-­‑intensive ¡text ¡processing ¡with ¡MapReduce ¡ • A ¡Case ¡Study: ¡ Elpais.com ¡ “The ¡only ¡thing ¡ • Basic ¡Data ¡Structures ¡for ¡Complex ¡Queries ¡ ¡ be<er ¡than ¡big ¡data ¡ • IntroducBon ¡to ¡MapReduce ¡ is ¡bigger ¡data” ¡ • The ¡Scale ¡out ¡vs. ¡Scale ¡up ¡Dilemma ¡ • Scaling ¡up ¡with ¡Phoenix++ ¡ • Experiments ¡introducing ¡MapReduce ¡into ¡a ¡CMS: ¡ – Query ¡Engine: ¡ • Word ¡CounBng ¡ • Word ¡Cooccurrencies ¡ • N-­‑grams ¡ – Indexer ¡ • File ¡Inversion ¡ – Text ¡Inversion ¡ – Structure ¡Inversion ¡ 2 ¡

  3. A ¡Case ¡Study: ¡ Elpais.com ¡on-­‑line ¡archive ¡ ¡ Base ¡Corpus: ¡ ¡ Elpais .com ¡on-­‑line ¡archive: ¡ • 1976–2011 ¡ • 2.3 ¡million ¡news ¡ ¡ • Cleaned ¡+ ¡PoS ¡tagged ¡ • 23 ¡million ¡structural ¡elements ¡ • 878 ¡million ¡tokens ¡ • ¡ • Lists ¡of ¡linguisBc ¡elements: ¡ • Concordances ¡ • Counts ¡ • AssociaBons ¡ • DistribuBons ¡ • … ¡ • Sub-­‑corpora ¡ • Non-­‑trivial ¡processing: ¡ ¡ • Cooccurrence ¡networks ¡/ ¡ ¡ ¡ ¡ ¡ ¡ ¡clustering ¡/ ¡… ¡ • Word ¡vectors ¡ • … ¡ 3 ¡

  4. Basic ¡Data ¡Structures ¡for ¡Corpus ¡Indexing ¡ SupporBng ¡Complex ¡Queries ¡ ¡ ¡ • Textual ¡indices: ¡ ¡ Doc ¡id ¡ Hits ¡ Pos 1 ¡ ¡ ¡Pos 2 ¡ … ¡ – PosBng ¡Lists: ¡ ¡ • [token=“de”] ¡ • [token=“la” ¡and ¡msd=“Nfs”] ¡ • [token=“pelota”] ¡within ¡[secBon=“sports”] ¡ • … ¡ First ¡ • Structural ¡indices: ¡ ¡ Token ¡ Last ¡ – Interval ¡Trees: ¡ Token ¡ … ¡ Doc ¡id ¡ • P ¡within ¡TEXT ¡ • P ¡containing ¡HI[REND=IT] ¡containing ¡[lemma=“de”] ¡ ¡ • … ¡ • Red/Black-­‑Trees ¡ <p> ¡ 4 ¡ </p> ¡

  5. How ¡Text ¡is ¡Indexed ¡ ¡ Documents: ¡ begin, ¡ • end, ¡ 3.7G ¡ • offset ¡ • ¡… ¡ • 135M ¡ 54M ¡ String ¡ Corpus ¡Layers ¡ Singletons ¡ PosBng ¡list ¡ ¡ PosiBonal ¡ Indices ¡ 331M+6.8G ¡ 321M+7.5G ¡ Hash ¡Table ¡ ¡ 168M+4.7G ¡ Interval ¡tree ¡ Structural ¡ 130M ¡ Indices ¡ 779M ¡ 1.5G ¡(tags) ¡ 5 ¡

  6. What ¡is ¡MapReduce? ¡ ¡ A ¡widely ¡used ¡parallel ¡compuBng ¡model ¡ • For ¡batch ¡processing ¡of ¡data ¡on ¡terabyte ¡or ¡petabyte ¡scales ¡ • On ¡clusters ¡of ¡commodity ¡servers ¡(typically) ¡ • Fault ¡tolerance: ¡task ¡monitoring ¡and ¡replicaBon ¡ • Abstracts ¡parallelizaBon, ¡synchronizaBon ¡and ¡communicaBon ¡ • Hadoop ¡is ¡the ¡most ¡popular ¡MapReduce ¡scale ¡out ¡implementaBon ¡ ¡ • ¡ 6 ¡

  7. Hadoop ¡MapReduce ¡ ¡ ¡ Map(k1, ¡v1) ¡-­‑> ¡list(k2, ¡v2) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Reduce(k2, ¡list(v2)) ¡-­‑> ¡list(v2) ¡ ¡ 7 ¡

  8. Scaling ¡out ¡vs ¡Scaling ¡up ¡Dilemma ¡ ¡ • Scaling ¡out ¡(horiz.) ¡ • Scaling ¡up ¡(vert.) ¡ – Cluster ¡of ¡commodity ¡servers ¡ ¡ ¡ ¡ – Powerful ¡server ¡(+proc./+RAM) ¡ – Pros: ¡ – Pros: ¡ • Cheaper ¡ • Power ¡consumpBon ¡ • Fault ¡tolerance ¡ • Cooling ¡ • Easy ¡to ¡update ¡ • Space ¡ – Cons: ¡ • Easy ¡to ¡implement ¡ • Networking ¡equip. ¡~ ¡0 ¡ • Power ¡consumpBon ¡ • Licensing ¡costs ¡ ¡ • Cooling ¡ – Cons: ¡ • Space ¡ • Difficult ¡to ¡implement ¡ • Expensive ¡ • Networking ¡equipment ¡ • Fault ¡tolerance ¡ • Licensing ¡costs ¡ • Difficult ¡to ¡update ¡ 8 ¡

  9. Scaling ¡out ¡vs ¡Scaling ¡up ¡Dilemma ¡ ¡ • Appuswamy ¡& ¡al. ¡(2014) ¡ ¡“ Scale-­‑up ¡vs ¡Scale-­‑out ¡for ¡ Hadoop : ¡Time ¡ to ¡rethink? ” ¡In ¡ Proc. ¡4th ¡Ann. ¡Symp. ¡on ¡Cloud ¡CompuFng . ¡ 50%, ¡< ¡14 ¡Gb ¡ • Input ¡size ¡in ¡analyBcs ¡producBon ¡clusters: ¡ ¡ – Microsot ¡/ ¡Yahoo: ¡median ¡< ¡14 ¡Gb, ¡Facebook: ¡90% ¡< ¡100 ¡Gb ¡ • Conclusion: ¡ ¡ – “Scaling ¡up ¡is ¡ more ¡cost-­‑effec-ve ¡for ¡ many ¡real-­‑word ¡problems ” ¡ 9 ¡ ¡

  10. Scaling ¡up ¡with ¡Phoenix++ ¡MapReduce ¡ ¡ "Phoenix++: ¡Modular ¡MapReduce ¡for ¡Shared-­‑Memory ¡Systems", ¡2011: ¡JusBn ¡Talbot, ¡Richard ¡M. ¡Yoo, ¡and ¡ Christos ¡Kozyrakis. ¡ Second ¡InternaFonal ¡Workshop ¡on ¡MapReduce ¡and ¡its ¡ApplicaFons. ¡ ¡ (Code: ¡hyp://mapreduce.stanford.edu) ¡ ¡ • Split: ¡divides ¡input ¡data ¡to ¡chunks ¡for ¡map ¡tasks ¡ • Combiner: ¡are ¡thread-­‑local ¡objects ¡ ¡ • Map: ¡invokes ¡the ¡Combiner ¡for ¡each ¡key-­‑value ¡pair ¡emiyed ¡(not ¡at ¡the ¡end ¡of ¡Map) ¡ • ParBBon/Suffle: ¡not ¡in ¡Phoenix++ ¡ • Reduce: ¡aggregates ¡key-­‑value ¡pairs ¡in ¡Combiners ¡(All ¡Map ¡task ¡are ¡finished) ¡ • Merge: ¡sort ¡key-­‑value ¡pairs ¡(opBonal ¡phase) ¡ • Problems: ¡introduces ¡rehash ¡between ¡map ¡and ¡reduce ¡phases ¡ 10 ¡

  11. Experiments: ¡Data ¡& ¡Machinery ¡ ¡ • Base ¡Corpus ¡ – Elpais .com ¡on-­‑line ¡archive ¡(1976–2011) ¡ – 2.3 ¡million ¡news ¡ ¡ – Cleaned ¡+ ¡PoS ¡tagged ¡ 4.5e+06 – 23 ¡million ¡structural ¡elements ¡ 4e+06 3.5e+06 – 878 ¡million ¡tokens ¡ 3e+06 2.5e+06 • MulBples ¡of ¡ Elpais .com ¡ Types 2e+06 – x2, ¡x4, ¡x8, ¡x16 ¡ 1.5e+06 1e+06 – Don’t ¡obey ¡Heaps’ ¡Law ¡( V ( n ) ¡= ¡ K·√n β ) ¡ 500000 0 • 1x ¡Dell ¡PowerEdge ¡R615 ¡ 0 5e+08 1e+09 1.5e+09 2e+09 Tokens – RAM: ¡256 ¡Gb ¡ – CPUs: ¡2 ¡x ¡Xeon ¡E5-­‑2620 ¡/ ¡2 ¡GHz ¡(24 ¡threads) ¡ – DISKS: ¡3 ¡x ¡SAS ¡7.200 ¡rpm, ¡RAID-­‑5 ¡ ¡ ¡ 11 ¡

  12. Word ¡CounBng ¡ Given ¡a ¡(sub-­‑)corpus, ¡ ¡ compute ¡the ¡frequencies ¡ ¡ of ¡all ¡the ¡words ¡ (word ¡frequency ¡profile) ¡ 12 ¡

  13. Word ¡CounBng ¡ … ¡ Split(docs) ¡= ¡ Map(<doc, ¡begin, ¡end>) ¡= ¡ ¡ ¡ ¡divide ¡docs ¡into ¡<doc, ¡begin, ¡end> ¡ ¡ ¡ ¡for ¡i ¡= ¡begin ¡to ¡end ¡do ¡ ¡ ¡ ¡ ¡ ¡ ¡emit(words[docs[doc].offset ¡+ ¡i], ¡1) ¡ ¡ ¡ ¡end ¡ Word ¡ Freq. ¡ 0 ¡(la) ¡ 456 ¡ Combiner: ¡ ¡ ¡ 19 ¡(de) ¡ 5667 ¡ … ¡ … ¡ 13 ¡

  14. Word ¡CounBng ¡ 75 ¡s, ¡8 ¡Bw ¡ 75 1 threads 2 threads 70 4 threads Baseline ¡(1 ¡thread) ¡ 8 threads 65 16 threads 24 threads 60 55 50 Elapsed Time (seconds) 45 40 35 30 ~11 ¡s, ¡1 ¡Bw ¡ 25 20 15 10 5 ~10 ¡s, ¡8 ¡Bw ¡ 0 0 1e+09 2e+09 3e+09 4e+09 5e+09 6e+09 7e+09 8e+09 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡1 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡2 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡3 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡4 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡5 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡6 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡7 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡8 ¡ Corpus ¡Size ¡(billions ¡of ¡tokens) ¡ ~2 ¡s, ¡1 ¡Bw ¡ 16 ¡threads ¡~ ¡24 ¡threads ¡ 14 ¡

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