softshake 2013 proud to be a polyglot

28
Monday, October 28, 13

Upload: couchbase

Post on 10-May-2015

2.792 views

Category:

Technology


0 download

DESCRIPTION

As presented by Tugdual Grall at Softshake in Geneva Switzerland. In his presentation, attendees will learn the benefits of being polyglot, how developers can mix the Java platform with other technologies like NodeJS and AngularJS to build applications, and the new Command Query Responsibility Segregation pattern.

TRANSCRIPT

Page 1: Softshake 2013 Proud to be a Polyglot

Monday, October 28, 13

Page 2: Softshake 2013 Proud to be a Polyglot

Polyglot  Applica-on  Development

Tugdual  “Tug”  Grall

Technical  Evangelist

@[email protected]

Monday, October 28, 13

Page 3: Softshake 2013 Proud to be a Polyglot

Modern  Applica-ons

• Modern  Applica-ons  Must­ Manage  any  type  of  data­ Scale­ Be  fault  tolerant­ Adapt  to  change

Monday, October 28, 13

Page 4: Softshake 2013 Proud to be a Polyglot

Standard  Architecture

• Mono-­‐Technology­ Same  “language/architecture”­ Single  Database  :  RDBMS

• One  size  fits  all  approachJSP/JSFServicesMessaging

JTADAO/JPA

Monday, October 28, 13

Page 5: Softshake 2013 Proud to be a Polyglot

Is  it  good  for  me?

• Many  files­ XML,  Sources,  ..

• Does  Hibernate/JPA  is  good  for  all?­ Impedance  mismatch

• Need  to  scale­ from  0  to  50millions  users  in  6  weeks  (real  life)­ can  I  do  that  easily  with  such  architecture?

• How  to  add  new  features  easily?­ code,  schema  change,  ...­ and  all  this  for  yesterday!

• Lot  of  code

Monday, October 28, 13

Page 6: Softshake 2013 Proud to be a Polyglot

One  size  does  NOT  fit  all!

Monday, October 28, 13

Page 7: Softshake 2013 Proud to be a Polyglot

Look  at  our  Data....

Monday, October 28, 13

Page 8: Softshake 2013 Proud to be a Polyglot

0

0.50

1.00

1.50

2.00

2011 2006 2000

Source:  IDC  2011  Digital  Universe  Study  (h<p://www.emc.com/collateral/demos/microsites/emc-­‐digital-­‐universe-­‐2011/index.htm)

Trillions  of  G

igabytes  (Ze<

abytes)

Big  DataHigh  Data  Variety  and  Velocity

Unstructured  and  Semi-­‐Structured  Data

Structured  Data

Text,  Log  Files,  Click  Streams,  Blogs,  Tweets,  Audio,  Video,  etc.

More  Flexible  Data  Model  Required

Monday, October 28, 13

Page 9: Softshake 2013 Proud to be a Polyglot

50  Million  Users  in  50  Days

191715131197533/12826242220181614121082/6

Draw  Something  by  OMGPOPDaily  Ac)ve  Users  (millions)

21

2

4

6

8

10

12

14

16

Monday, October 28, 13

Page 10: Softshake 2013 Proud to be a Polyglot

RDBMS  is  good  for  many  thing,  but  hard  to  scale

RDBMS  Scales  UpGet  a  bigger,  more  complex  server

Users

ApplicaIon  Scales  OutJust  add  more  commodity  web  servers

Users

System  CostApplicaTon  Performance  

Rela:onal  Database

Web/App  Server  Tier

System  CostApplicaTon  Performance  

Won’t  scale  beyond  this  point

How  do  you  take  this  growth?

Monday, October 28, 13

Page 11: Softshake 2013 Proud to be a Polyglot

Scaling  out  fla?ens  the  cost  and  performance  curves

NoSQL  Database  Scales  OutCost  and  performance  mirrors  app  Ier

Users

NoSQL  Distributed  Data  Store

Web/App  Server  Tier

ApplicaIon  Scales  OutJust  add  more  commodity  web  servers

Users

System  CostApplicaTon  Performance  

ApplicaTon  Performance  System  Cost

NoSQL  Technology  Scales  Out

Monday, October 28, 13

Page 12: Softshake 2013 Proud to be a Polyglot

ClouderaHortonworks

Mapr

OperaTonal  vs.  AnalyTc  Databases

CouchbaseMongoDB

CassandraHbase

AnalyFcDatabases

Get  insights  from  data

Real-­‐Fme,  InteracFve  Databases

Fast  access  to  data

NoSQL

Monday, October 28, 13

Page 13: Softshake 2013 Proud to be a Polyglot

Polyglot  Persistence

Document  &  K/V

•  Products•  User  Profiles•  Game  AcTons•  Sessions•  Shopping  Cart

RDBMS

•  Financial  Data•  ReporTng

Big  Data/Analysis

•  Log  Capture•  RecommendaTons•  AdCampaign

Indexing

•Full  Text  Search•Ad  hoc  queries

Monday, October 28, 13

Page 14: Softshake 2013 Proud to be a Polyglot

Developer  New  Skills

• Understand  the  pros/cons  of  each  solu-ons­ Programming  API­ How  to  access  the  data?  (API,  Query  Languages)

• Learn  how  to  design  data-­‐model­ De-­‐normalizing  and  duplicate  data  is  not  a  problem

• Integrate  each  solu-on  to  your  applica-on

• Note:  This  is  something  you  already  do  !­ OperaTonal  RDBMS  and  Data  Warehouse

Monday, October 28, 13

Page 15: Softshake 2013 Proud to be a Polyglot

Data  Service  Layer

Data  Service

• Wrap  datastore  in  Services­ loosely  coupled

Monday, October 28, 13

Page 16: Softshake 2013 Proud to be a Polyglot

Use  Case  :  Content  Driven  Site

Monday, October 28, 13

Page 17: Softshake 2013 Proud to be a Polyglot

Use  Case:  Mobile  Services

PIM  Database

-­‐  Legacy  Applica:on-­‐  Product  Informa:on

NoSQL

-­‐  Product  Data-­‐  Addi:onal  Metada

Web/App  Server  Tier Web/App  Server  Tier

Monday, October 28, 13

Page 18: Softshake 2013 Proud to be a Polyglot

Now  what?

Monday, October 28, 13

Page 19: Softshake 2013 Proud to be a Polyglot

Why  mul-ple  languages?

• Some-mes  we  have  no  choice­ HTML/CSS/JavaScript  +  Server  Side­ Mobile  NaTve  ApplicaTons

• Java/.Net  have  not  evolved  that  must  these  past  years­ Java  EE  5.0  is  sTll  mainstream  (2006)

• Many  languages  and  frameworks­ Scala,  Clojure,  Groovy,  Dart,  Go,  Ruby,  Python,  F#,  Erlang­ Node.js,  Rails,  Play!,  Grails,  ...

Monday, October 28, 13

Page 20: Softshake 2013 Proud to be a Polyglot

Examples

• Real-me  interac-on  with  WebSockets  :­ Wait  for  Java  EE  7  to  be  out?­ Hack  your  app  server  and  applicaTon  with  ConTnuaTon  ?­ Use  Node.js  and  Socket.io  ?

• Data  Collec-on  and  Treatment?­ Find  a  library?­ Create  your  library?­ Wait  for  Java  8  and  Lambdas?­ Use  Scala?  ...  or  other

Monday, October 28, 13

Page 21: Softshake 2013 Proud to be a Polyglot

Examples

• Simple  CRUD  Applica-on­ Use  the  JavaEE  stack  with  JPA  and  JSF?­ Use  Spring  ?­ Use  tools  like  Play!,  Grails,  Rails  ?

Monday, October 28, 13

Page 22: Softshake 2013 Proud to be a Polyglot

How  to  chose?

• Maturity/Supportability  

• Features  Set

• Learning  Curve

• Produc-vity

Monday, October 28, 13

Page 23: Softshake 2013 Proud to be a Polyglot

Polyglot  Programming  in  Ac-on

• Build  a  distributed  database­ Manage  distributed  processes­ Save  and  retrieve  data  on  disk­ Cache  the  data  on  RAM­ Build  a  query  engine  

Monday, October 28, 13

Page 24: Softshake 2013 Proud to be a Polyglot

Polyglot  Programming  in  Ac-on

• Manage  Distributed  Process­ Erland  and  OTP  (Open  Telecom  Plaform)  has  been  built  for  that­ Taking  this  will  bootstrap  a  project  quickly  instead  of  implemenTng  in  

another  language

• Data  access  and  Caching­ C/C++  is  the  best/fastest  way  to  interact  with  I/O­ Leverage  exisTng  Caching  layer,  for  example  Memcached  wrigen  in  C

• Query  &  Indexing­ Easy  to  code  for  developer  :  Let’s  use  JavaScript

Monday, October 28, 13

Page 25: Softshake 2013 Proud to be a Polyglot

Couchbase  Server  Architecture

ReplicaTon,  Rebalance,    Shard  State  Manager

REST  management  API/Web  UI

8091Admin  Console

Erlang  /O

TP

11210  /  11211Data  access  ports

Object-­‐managedCache

Storage  Engine

8092Query  API

Que

ry  Engine h\p

Data  Manager Cluster  Manager

Cluster  ManagerWriOen  in  Erlang

Data  ManagerWriOen  in  C/C++

Monday, October 28, 13

Page 26: Softshake 2013 Proud to be a Polyglot

Use  Case:  Second  Screen  Gaming

Java/Play  Applica:onPython  scrips

Administra-on

Node.js  +  Socket  IO

Monday, October 28, 13

Page 27: Softshake 2013 Proud to be a Polyglot

Conclusion

• Use  the  good  tool  for  the  good  task­ Do  not  try  to  “hack”  something  when  you  have  a  shorter  soluTon

­ Think  about  your  users  first...  so  deliver  and  get  feedback

• Learning  is  part  of  our  job  !­ And  this  will  help  you  and  your  project

• What  about  maintenance?­ Do  you  think  it  is  easier  to  maintain  complex  code?

Monday, October 28, 13