Developing apps with Couchbase
 

Developing apps with Couchbase

on

  • 1,179 views

 

Statistics

Views

Total Views
1,179
Views on SlideShare
880
Embed Views
299

Actions

Likes
0
Downloads
8
Comments
0

5 Embeds 299

http://g33ktalk.staging.wpengine.com 178
http://g33ktalk.com 97
http://www.hakkalabs.co 20
http://twimblr.appspot.com 2
https://hakka.herokuapp.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Developing apps with Couchbase Developing apps with Couchbase Presentation Transcript

  • Friday, December 7, 12
  • Developing  Apps  with   Couchbase Jasdeep  Jaitla Technical  Evangelist email:  jasdeep@couchbase.com twi0er:  @scalabl3Friday, December 7, 12
  • Developing  Apps  with   Couchbase Jasdeep  Jaitla Technical  Evangelist email:  jasdeep@couchbase.com twi0er:  @scalabl3Friday, December 7, 12
  • Friday, December 7, 12
  • SETTING  UP  TO  DEVELOPFriday, December 7, 12
  • Install  Couchbase  Server  2.0 ✴ www.couchbase.com/couchbase-­‐server/beta OR,  for  the  Latest  2.0  Build ✴ www.couchbase.com/download ✴ select  2.0.0  recent  builds  in  dropdown Ubuntu RedHat Mac  OS  X WindowsFriday, December 7, 12
  • Install  Couchbase  Server  2.0 ✴ www.couchbase.com/couchbase-­‐server/beta OR,  for  the  Latest  2.0  Build ✴ www.couchbase.com/download ✴ select  2.0.0  recent  builds  in  dropdown Ubuntu RedHat select 2.0.0 recent builds Mac  OS  X WindowsFriday, December 7, 12
  • Install  Couchbase  Server  2.0 ✴ www.couchbase.com/couchbase-­‐server/beta OR,  for  the  Latest  2.0  Build ✴ www.couchbase.com/download ✴ select  2.0.0  recent  builds  in  dropdown Ubuntu RedHat Mac  OS  X WindowsFriday, December 7, 12
  • Install  Couchbase  Server  2.0 ✴ www.couchbase.com/couchbase-­‐server/beta OR,  for  the  Latest  2.0  Build ✴ www.couchbase.com/download ✴ select  2.0.0  recent  builds  in  dropdown Ubuntu RedHat Mac  OS  X WindowsFriday, December 7, 12
  • Official  SDKs www.couchbase.com/develop Community  SDKs GoFriday, December 7, 12
  • Official  SDKs Ruby Python www.couchbase.com/develop Community  SDKs GoFriday, December 7, 12
  • Official  SDKs Ruby Python www.couchbase.com/develop Community  SDKs Clojure GoFriday, December 7, 12
  • Official  SDKs Ruby libcouchbase Clojure Python www.couchbase.com/develop GoFriday, December 7, 12
  • Friday, December 7, 12
  • JSON  DOCUMENTSFriday, December 7, 12
  • Aggregate  View  of  Data h0p://marWnfowler.com/bliki/AggregateOrientedDatabase.htmlFriday, December 7, 12
  • Store  and  Retrieve  Aggregates order::1001 { uid:  ji22jd, customer:  Ann, line_items:  [   {  sku:  0321293533,  quan:  3,  unit_price:  48.0  }, {  sku:  0321601912,  quan:  1,  unit_price:  39.0  }, {  sku:  0131495054,  quan:  1,  unit_price:  51.0  }   ], payment:  {  type:  Amex,  expiry:  04/2001,   last5:  12345  } } • Easier  to  Distribute  Data • More  Flexibility • Reduced  LatencyFriday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303 2 Joe   Smith 2 2 SF CA 94103 3 Ali Dodson 2 3 CHI IL 60609 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303 2 Joe   Smith 2 2 SF CA 94103 3 Ali Dodson 2 3 CHI IL 60609 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303 2 3 Joe   Ali Smith Dodson 2 2 + 2 3 SF CHI CA IL 94103 60609 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303 2 3 Joe   Ali Smith Dodson 2 2 + 2 3 SF CHI CA IL 94103 60609 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303 2 3 Joe   Ali Smith Dodson 2 2 + 2 3 SF CHI CA IL 94103 60609 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303 2 3 Joe   Ali Smith Dodson 2 2 + 2 3 SF CHI CA IL 94103 60609 = 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303    {        “ID”:  1, + =        “First”:  “Jasdeep”, 2 Joe   Smith 2 2 SF CA 94103        “Last”:  “Jaitla”,        “ZIP”:  “94103”,        “CITY”:  “SF”, 3 Ali Dodson 2 3 CHI IL 60609        “STATE”:  “CA”    } JSON 4 John Doe 3 4 NY NY 10010 All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303    {        “ID”:  1, + =        “First”:  “Jasdeep”, 2 Joe   Smith 2 2 SF CA 94103        “Last”:  “Jaitla”,        “ZIP”:  “94103”,        “CITY”:  “SF”, 3 Ali Dodson 2 3 CHI IL 60609        “STATE”:  “CA”    } JSON 4 John Doe 3 4 NY NY 10010 Document Data is an Aggregate All  data  in  a  single  document 10Friday, December 7, 12
  • Documents  are  Aggregates Users Addresses KEY First Last ZIP_ID ZIP_ID CITY STATE ZIP 1 Jasdeep Jaitla 2 1 DEN CO 30303    {        “ID”:  1, + =        “First”:  “Jasdeep”, 2 Joe   Smith 2 2 SF CA 94103        “Last”:  “Jaitla”,        “ZIP”:  “94103”,        “CITY”:  “SF”, 3 Ali Dodson 2 3 CHI IL 60609        “STATE”:  “CA”    } JSON 4 John Doe 3 4 NY NY 10010 Document Data is an Aggregate All  data  in  a  single  document couchbase.get(“user::1”) 10Friday, December 7, 12
  • JSON  Document  Structure meta { Meta  Informa^on   “id”:  “u::jasdeep@couchbase.com”, Including  Key “rev”:  “1-­‐0002bce0000000000”, “flags”:  0, “expira^on”:  0, All  Keys  Unique  and   “type”:  “json” Kept  in  RAM } document { “uid”:  123456, Document  Value “firstname”:  “jasdeep”, “lastname”:  “Jaitla”, Most  Recent  In  Ram   “age”:  22, “favorite_colors”:  [“blue”,  “black”], And  Persisted  To  Disk “email”:  “jasdeep@couchbase.com” }Friday, December 7, 12
  • Objects  Serialized  to  JSON  and  Back   User  Object u::jasdeep@couchbase.com string uid { set() “uid”:  123456, string firstname “firstname”:  “jasdeep”, string lastname “lastname”:  “Jaitla”, int age “age”:  22, “favorite_colors”:  [“blue”,  “black”], array favorite_colors “email”:  “jasdeep@couchbase.com” string email } User  Object u::jasdeep@couchbase.com get() string uid { “uid”:  123456, string firstname “firstname”:  “jasdeep”, string lastname “lastname”:  “Jaitla”, int age “age”:  22, “favorite_colors”:  [“blue”,  “black”], array favorite_colors “email”:  “jasdeep@couchbase.com” string email }Friday, December 7, 12
  • Model  Structures USER Couchbase instance variables JSON Couchbase JSON USER instance variables JSON Couchbase Array Data Couchbase Hash Data Set/List Data JSON JSONFriday, December 7, 12
  • eCommerce  Model USER JSON instance variables shopping_carts ORDER ORDER JSON Couchbase orders instance variables instance variables statistics JSON JSON JSON JSON JSON ShoppingCart JSON JSON JSON instance variables JSON CartItems JSON JSON JSON PRODUCT PRODUCT CartItems JSON CartItems JSON instance variables JSON instance variables instance variables instance variablesFriday, December 7, 12
  • Friday, December 7, 12
  • RAPID  APPFriday, December 7, 12
  • Modeling  Is  Fun  &  Easy class User < ModelBase I  didn’t  have  to  waste  hours   # doctype value fattr :doctype, :default => self.to_s.camelize upon  hours  making  columns,   fattr :uid tables,  foreign  keys,  and   fattr :is_netwerkd, :default => false picking  column  data  types. # facebook stuff fattr :has_facebook, :default => false fattrs :fb_id, :fb_firstname, :fb_lastname, :fb_fullname, :fb_nickname, :fb_username, :fb_gender,:fb_email, :fb_hometown, :fb_location, :fb_img_square, :fb_img_small, :fb_img_normal, :fb_img_large, :fb_access_token, :fb_token_expires # twitter stuff fattr :has_twitter, :default => false fattrs :tw_id, :tw_handle, :tw_nickname, :tw_fullname, :tw_location, :tw_img, :tw_desc, :tw_following_count, :tw_followers_count, :tw_tweets_count, :tw_member_since, :tw_access_token, :tw_access_secret # linkedin stuff fattr :has_linkedin, :default => false fattrs :li_id, :li_firstname, :li_lastname, :li_fullname, :li_headline, :li_email, :li_img, :li_skills, :li_industry, :li_connections_count, :li_access_token, :li_access_secret, :li_public_urlFriday, December 7, 12
  • Consolidated  Document {"doctype"=>"User",  "uid"=>1,  "is_netwerkd"=>true,  "has_facebook"=>true,  "fb_id"=>"661111011", I  got  the  Basic  App  Running    "fb_firstname"=>"Jasdeep",  "fb_lastname"=>"Jaitla", in  a  few  hours!  Then  added    "fb_fullname"=>"Jasdeep  Jaitla",  "fb_nickname"=>"jasdeep.jaitla", more  features    "fb_username"=>"jasdeep.jaitla",  "fb_gender"=>"male", incrementally...  "fb_email"=>"jasdeep@metasphere.com",  "fb_hometown"=>    {"id"=>"110184922344060",  "name"=>"Washington,  District  of  Columbia"},  "fb_location"=>{"id"=>"114952118516947",  "name"=>"San  Francisco,  California"},  "fb_img_square"=>"http://graph.facebook.com/661111011/picture?type=square",  "fb_img_small"=>"http://graph.facebook.com/661111011/picture?type=small",  "fb_img_normal"=>"http://graph.facebook.com/661111011/picture?type=normal",  "fb_img_large"=>"http://graph.facebook.com/661111011/picture?type=large",  "fb_access_token"=>     "AAACa7POXlM4BAC0yPc4NFlPGqTGdZANFKEYo2yucXAQSLXtUfBHPCHNVKWXcosm4D4uWk0OJkWWqjkbo9LZAxR6FrIKf2t2eCU3O884wZD ZD",  "fb_token_expires"=>1359369670,  "has_twitter"=>true,  "tw_id"=>"573365281",  "tw_handle"=>"scalabl3",  "tw_nickname"=>nil,  "tw_fullname"=>"Scalabl3",  "tw_location"=>"San  Francisco",  "tw_img"=>    "http://a0.twimg.com/profile_images/2403799460/1i9qyazuxw9gm8cenceh_normal.jpeg",  "tw_desc"=>    "Creating  Scalable  applications  and  social  games  for  the  next  millenium,  yeah  Im  talkin  the  3000s.",Friday, December 7, 12
  • Simplified  OperaWons def update_save raise "Cannot Save without UID (creation)" unless @uid replace_document(@docs[:id], to_hash) update_refs self end couchbase.replace(“u::1”, hash_to_json)Friday, December 7, 12
  • Cross Data Center Replication Recent  Cool  Things (XDCR) Couchbase Couchbase Couchbase XDCR Receiver Endpoints XDCR >> Elastic Search Filter by JSON or String Search Couchbase Beanstalkd Job Queue Elastic Search Cluster Worker Worker Worker XDCR >> Worker Cluster Couchbase Neo4J Worker ClusterFriday, December 7, 12
  • Q  &  A Dip^  Borkar Jasdeep  Jaitla @dborkar @scalabl3Friday, December 7, 12