scopeandreef - brown universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf ·...

28
SCOPE and REEF Quan Fang Xiaofeng Tao 9/25/2013

Upload: others

Post on 22-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  and  REEF    Quan  Fang  Xiaofeng  Tao    9/25/2013  

Page 2: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Background  • Dryad  -­‐  MS  Research  project  to  inves6gate  programming  models  for  running    distributed  programs  •  Similar  goals  to  Hadoop  and  map  reduce  

•  SCOPE  -­‐  Query  language  powered  by  Dryad  •  Similar  goals  to  Hive  

• Dryad  and  SCOPE  never  commercialized!  • MicrosoF  developing  open  source  technologies  for  Hadoop  with  REEF  

Page 3: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE:  Structured  Computations  Optimized  for  Parallel  Execution    A  declarative  and  extensible  scripting  language  for  ef>icient  parallel  processing  on  massive  datasets  

Page 4: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  •  Structured  Computa6ons  Op6mized  for  Parallel  Execu6on  • Proprietary  internal  MicrosoF  technology  for  using  COSMOS  • Declara6ve  language  resembling  SQL  • Highly  extensible  with  C#  • Compiled  into  MicrosoF  Dryad  execu6on  plan  

Page 5: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

COSMOS  •  Internal  MicrosoF  system  for  distributed  storage  and  parallelized  processing  of  big  data  •  Stores  over  2  petabytes  of  new  data  per  day  •  SCOPE  is  the  query  language  for  Cosmos  

(Chaiken  2008)  

Page 6: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Writing  a  Select  Query  •  Syntax  is  similar  to  SELECT  statement    from  SQL  • USING    keyword  used  to  specify  C#  extractor  class  to  get  the  data  

 SELECT  query,  COUNT(*)  AS  count  FROM  "search.log"    USING  LogExtractor  GROUP  BY  query  HAVING  count  >  1000  ORDER  BY  count  DESC;  OUTPUT  TO  "qcount.result";  

(Chaiken  2008)  

Page 7: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

C#  SCOPE  Extensions  • C#  expressions  are  directly  used  in  queries  • C#  func6ons  can  be  defined  and  used  • User  defined  type  (C#  class)  can  be  a  column  

 SELECT  Timestamp.ToUniversalTime()  +  ":"  +  Query  AS  Q  FROM  "search.log"  USING  LogExtractor  WHERE  StringOccurs(Query,  "#")  >  1      #CS    public  static  int  StringOccurs(string  str,  string  ptrn)    {            int  cnt=0;            int  pos=-­‐1;            while  (pos+1  <  str.Length)            {                  pos  =  str.IndexOf(ptrn,  pos+1);                    if  (pos  <  0)  break;  cnt++;            }            return  cnt;    }    #ENDCS     (Chaiken  2008)  

Page 8: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  Process  Command  •  Process  provides  custom  data  transforma6on  and  mapping    PROCESS  Query,  Timestamp,  Market,  User,  Browser  USING  TrimProcessor    #CS  public  class  TrimProcessor  :  Processor  {          //  This  function  trims  all  string  valued  columns            public  override  IEnumerable<Row>  Process(RowSet  input,    Row  outRow,  string[]  args)            {                    foreach  (Row  row  in  input.Rows)                    {                          row.Copy(outRow);                            for  (int  i=0;  i  <  row.Count;  i++)                            {                                    if(outRow.Schema[i].Type  ==  ColumnDataType.String)                                  {                                    outRow[i].Set(outRow[i].String.Trim());                                    }                            }                            yield  return  outRow;                    }            }  }    #ENDCS   (Chaiken  2008)  

Page 9: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  Reduce/Combine  Commands  •  Reduce  provides  custom  data  grouping  and  aggrega6on  •  Combine  provides  custom  data  joins  REDUCE  RowSet1  ON  ColumnA  USING  TrimProcessor    #CS  public  class  CountReducer  :  Reducer    {  

        public  override  IEnumerable<Row>  Reduce(RowSet  input,  Row  outputRow,  string[]  args)             {                   int  count  =  0;                     foreach  (Row  row  in  input.Rows)                       {                               if  (count  ==  0)                                         outputRow[0].Set(row[0].String);                               count++;                       }                       outputRow[1].Set(count.ToString());                     yield  return  outputRow;               }    

}  #ENDCS  

(Chaiken  2008)  

Page 10: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  Compiler  and  Optimizer  • Compiled  and  op6mized  into  Dryad  execu6on  plan  based  on  directed  acyclic  graph  •  Edges  are  communica6on  channels  •  Ver6ces  are  processing  nodes  

(Isard  et  al.  2007)  

Page 11: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  Compiler  and  Optimizer  • Advantages  of  Dryad  over  Map  Reduce  •  More  general  and  subsumes  all  map  reduce  func6onality  •  Less  replicated  storage  in  big  jobs  •  Can  “split”  different  output  types  from  ver6ces  •  Data  dependent  re-­‐par66oning  at  run6me  Ex:  “A”  nodes  split  into  “*”  and  “+”  nodes  by  network  topology    and  merged  on  new  internal  nodes  

(Isard  et  al.  2007)  

Page 12: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  Compiler  and  Optimizer  • PeriSCOPE  for  code  op6miza6ons  of  compiled  SCOPE  jobs  • Column  Reduc6on  •  Early  Filtering  •  Smart  Cuts  

• Run6me  op6miza6ons  •  Fault  tolerance  • Data  dependent    re-­‐par66oning  

(Guo  et  al.  2012)  

Page 13: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SCOPE  Summary  • Never  released  MicrosoF  query  language  for  using  COSMOS  • Resembles  SQL  and  very  extensible  with  C#  • Process,  Reduce,  and  Combine  commands  analogous  to  map,  reduce,  and  merge  • Compiles  into  directed  acyclic  graph  based  execu6on  plan  • Data  dependent  op6miza6ons  at  run6me  

Page 14: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

REEF:  Retainable  Evaluator  Execution  Framework    Build  persistent  (cross-­‐job)  caches  and  cluster-­‐wide  services  to  support  high-­‐performance  iterative  graph  processing  and  machine  learning  algorithms      Microsoft  Cloud  and  Information  Services  Lab  (CISL)    

Page 15: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Hadoop  •  Hadoop  Common:  the  common  u6li6es  that  support  the  other  Hadoop  facility  

•  Hadoop  Distributed  File  System  (HDFS):  A  distributed  file  system  that  provides  high-­‐throughput  access  to  applica6on  data.  

•  Hadoop  MapReduce:  A  soFware  framework  for  distributed  processing  of  large  data  sets  on  compute  cluster.  

•  Hadoop  YARN:  A  framework  for  job  scheduling  and  cluster  resource  management.  

Page 16: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

YARN  •  Yet  Another  Resource  Nego6ator  •  Resource  manager  for  Hadoop2.x  •  Allocates  compute  containers  to  compe6ng  jobs  

Page 17: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

SQL  /  Hive  

REEF  in  the  Stack  

17  

YARN  /  HDFS  

…   …   Machine  Learning  

REEF  

Page 18: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

REEF  in  the  Stack  (Future)  

18  

YARN  /  HDFS  

SQL  /  Hive   …   …   Machine  Learning  

REEF  

Operator  API  and  Library  

Logical  Abstrac6on  

Page 19: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

REEF  builds  on  YARN  •  Retainability  of  hardware  resources  across  tasks  and  jobs    •  Composability  of  operators  wrigen  for  mul6ple  computa6onal  frameworks  and  storage  backends.  

•  Cost  modeling  for  data  movement  and  single  machine  parallelism.  

•  Fault  handling  including  checkpoin6ng  of  task  state,  and  determinis6c  task  invoca6ons.  

•  Elas?city  REEF’s  checkpoin6ng  and  preemp6on  mechanisms  allow  jobs  to  adapt  as  resource  alloca6ons  changes.  

Page 20: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Digital  Shoebox  Architecture  

Rela6onal    Queries  

Machine  Learning  

 Operators  

REEF  

YARN  

HDFS-­‐as-­‐Cache    

WAS  

Tiered  Storage  

Compute  Fabric  

Analysis  Engine  

Page 21: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Extensible  Control  Flow  Data  Management  Services  Storage  Abstrac6ons:  Map  and  Spool  Local  and  Remote  

Network  Message  passing  Bulk  Transfers  Collec6ve  Communica6ons  

State  Management  Fault  Tolerance  Checkpoin6ng  

Job  Driver  

Control  plane  implementa6on.  User  code  executed  on  YARN’s  Applica6on  Master  

Ac6vity  User  code  executed  within  an  Evaluator.    

Evaluator  Execu6on  Environment  for  Ac?vi?es.  One  Evaluator  is  bound  to  one  YARN  Container.   Tang  and  Wake  

Con>iguration  Manager  Event  framework  

Page 22: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

REEF  Key  Abstractions  •  Job  Driver:  The  user-­‐supplied  control  logic.  There  is  exactly  one  Driver  for  each  Job.  The  dura6on  and  characteris6cs  of  the  Job  are  determined  by  this  module.  

•  Ac?vity:  User-­‐supplied  logic  that  performs  the  data  processing.  Ac6vi6es  are  a  generaliza6on  of  Hadoop’s  Map  and  Reduce  Tasks.    

•  Evaluator:  The  run6me  for  Ac6vi6es.    

•  Services:  Objects  and  daemon  threads  that  are  retained  across  Ac6vi6es  that  run  within  an  Evaluator.    

Page 23: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Data  Management  Services  •  A   set   of   libraries   that   provides   mechanisms   for   networking,  storage,   checkpoin1ng,   and   other   data   processing  infrastructure.  Iden%fier  is  the  basis  for  many  mechanisms.  

 •  Two  APIs:  Driver  API  requests  and  configures  Services  and  Ac6vity  API  provides  access  to  the  actual  func6onality.  

Page 24: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Wake:  Data  And  Control  Planes  •  A  state-­‐of-­‐art  event-­‐driven  programming  framework  

•  Extensibility  to  mul?ple  I/O  subsystems  

•  Profiling  and  boHleneck  analysis  tools  

•  Inlining  of  event  handlers  

•  Immutable  dataflows  

Page 25: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

TANG:  Job  Con>iguration  •  A  configura6on  manager  and  dependency  injector  

•  Sta?c  checking  of  configura6ons  allows  jobs  to  fail  earlier.  

•  Language  independence  Drivers  wrigen  in  one  language  can  configure  Ac6vi6es  wrigen  in  mul6ple  languages.  

•  Separa?on  of  concerns  between  configura6on  processing  and  Driver  implementa6ons.    

•  Graceful  handling  of  ambiguity  for  configura6ons  that  require  further  specializa6on.    

Page 26: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

•  What  they  have  built  on  top  of  REEF  ?  •  MapReduce  Library  •  Runs  Hive  and  Pig  •  Excellent  star6ng  point  for  M/R  op6miza6ons:  Caching,  Shuffle,  Map-­‐Reduce-­‐Reduce,  Sessions…  

•  Machine  Learning  algorithms  •  Scalable  implementa6ons:  Decision  Trees,  Linear  Model.  Soon:  SVD  

•  Excellent  star6ng  point  for:  fault  awareness  in  ML    

Page 27: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

Questions  ?  

Page 28: SCOPEandREEF - Brown Universitycs.brown.edu/courses/cs195w/slides/scoop_reef.pdf · HDFS’as’Cache&& WAS& Tiered Storage& Compute& Fabric& Analysis& Engine& ExtensibleControlFlow

References  •  Chaiken,  Ronnie,  et  al.  "SCOPE:  easy  and  efficient  parallel  processing  of  massive  data  sets."  Proceedings  of  the  VLDB  Endowment  1.2  (2008):  1265-­‐1276.  

•  Chun,  Byung-­‐Gon,  et  al.  "REEF:  Retainable  Evaluator  Execu6on  Framework."Interna1onal  Conference  on  Very  Large  Data  Bases.  2013.  

•  Guo,  Zhenyu,  et  al.  "Spotng  code  op6miza6ons  in  data-­‐parallel  pipelines  through  PeriSCOPE."  Proc.  of  the  10th  USENIX  conference  on  Opera1ng  systems  design  and  implementa1on,  OSDI.  2012.  

•  Isard,  Michael,  et  al.  "Dryad:  distributed  data-­‐parallel  programs  from  sequen6al  building  blocks."  ACM  SIGOPS  Opera1ng  Systems  Review  41.3  (2007):  59-­‐72.