webinar - couchbase in action - real-world app demo
Post on 22-Jun-2015
1.640 Views
Preview:
DESCRIPTION
TRANSCRIPT
Technical)Evangelist)/)Scalability)Sherpa
twitter:)@scalabl3email:)jasdeep@scalabl3.com
Jasdeep)Jaitla
Building)Apps)with)Couchbase
WIFI:%HeavyBitGuestp/w:%guestbit
Jasdeep'JaitlaTechnical)Evangelist
@scalabl3jasdeep@couchbase.com
Give'me'a'shout'out'with'@couchbase'@scalabl3!
Why$I$found$Couchbase...
We wanted high performance and near real-time interactions, PHP wasn’t cutting it.
I rebuilt the whole app using Ruby/Rails,Backbone.js, Pubnub, Couchbase and Neo4J.
We didn’t get funding so I left and startedworking for Couchbase.
Couchbase*Server*Core*Principles
EasyScalability
Consistent/HighPerformance
Always/On24x365
Grow*cluster*withoutapplication*changes,*withoutdowntime*with*a*single*click
Consistent*sub;millisecond*read*and*write*response*times*with*consistent*high*throughput
No*downtime*for*softwareupgrades,*hardwaremaintenance,*etc.
Flexible/DataModel
JSON*document*model*with*nofixed*schema.
JSONJSONJSON
JSONJSON
PERFORMANCE
UNDERSTAND
Applications+Have+Many+Dimensions
Inception.
Why’d he put that there?
Our$Developer$Brain$isn’t...
The$Modernist$Mindlate%19th%)%early%20th%Centuries
Our$Real$Developer$Brain
In#Fact,#the#World#Is#More#Like#this:
The#Postmodern#Mindmid$20th$Century$/$Now?
The$Post)Postmodern$Mind21st%century%,%Now.
bigdata
Mmm,$data.
bigdata
..."this"makes"sense"...
Users%“do”%these%actions>>"methods
Users%“have”properties/state>>"instance"variables
•4
•
4
..."this"makes"sense"...
Relational)Modeling
In#Memory,#your#objects#have#an#implicit#data#structure#
An)object)is)a)collection)of)data)structures
These)data)Structures)are)rich:
Keys)(variable)names)
Simple)Single)Values)(string,)integer,)float))
RDBMS#handles#Simple#Single#Values#as#Columns
BB
••
Relational)Modeling
In#Memory,#your#objects#have#an#implicit#data#structure
Complex)Collection)Values)(arrays,)dictionary/hashes)
More)Complex)Values:)Collections)of)Objects
Structures)can)be)nested)within)Structures
RDBMS#Can’t#Map#Complex#Collection#Values#SIMPLY
Most#commonly#it’s#via#a#JOIN#with#
1H1#or#1..n#type#foreign_key#relationship
•••
Relational)Modeling
Ends)up)with)a)table)sprawl)that)makesJOINs)very)slow)at)scale.
Aggregate'View'of'Data
http://martinfowler.com/bliki/AggregateOrientedDatabase.html
Store&and&Retrieve&Aggregates
Easier&to&DistributeDataMore&FlexibilityReduced&Latency
•
••
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&}}
JSON%supports%direct%relationship%of%In%Memory%Data%Structures%to%Data%Storage
No%Impedance%Mismatch
Objects(Serialized(to(JSON(and(Backstring uid
string firstname
string lastname
int age
array favorite_colors
string email
User%Object u::jasdeep@couchbase.com{“uid”:(123456,“firstname”:(“jasdeep”,“lastname”:(“Jaitla”,“age”:(22,“favorite_colors”:([“blue”,(“black”],“email”:(“jasdeep@couchbase.com”}
string uid
string firstname
string lastname
int age
array favorite_colors
string email
User%Object u::jasdeep@couchbase.com{“uid”:(123456,“firstname”:(“jasdeep”,“lastname”:(“Jaitla”,“age”:(22,“favorite_colors”:([“blue”,(“black”],“email”:(“jasdeep@couchbase.com”}
set()
get()
JSON%Document%Structuremeta{“id”:%“u::jasdeep@couchbase.com”,“rev”:%“1>0002bce0000000000”,“flags”:%0,“expiration”:%0,“type”:%“json”}
document{“uid”:%123456,“firstname”:%“jasdeep”,“lastname”:%“Jaitla”,“age”:%22,“favorite_colors”:%[“blue”,%“black”],“email”:%“jasdeep@couchbase.com”}
Meta6InformationIncluding%Key
All%Keys%Unique%andKept%in%RAM
Document6Value
Most%Recent%In%RamAnd%Persisted%To%Disk
the$best$products$don’t$just$solve$a$need.
the$best$products$create$and$solve$a$need.
Jean1Baptiste$Say$(176711832)Say’s$Law:$“Supply'creates'its'own'Demand”
Keynesian$Economics
What%happens%when%you%do%both%well?
Scale.'Acquisition.'IPO.
SCALE
DrawSomething:/Non1Linear/Growth
191715131197533/12826242220181614121082/6
Draw%Something%by%OMGPOPDaily&Active&Users&(millions)
21
2
4
6
8
10
12
14
16
By/March/19,/there/were/
30M%downloads3,000+%drawings/second
2%Billion%Drawings3.3+%Terabytes
Apps$in$1995
Client'(Browsers)' App'Server' SQL'Database'Server'
Double$your$salary$by$making$a$“dynamic”$website
Late%1990’s
Client'(Browsers)' App'Servers' SQL'Database'Server'
Early&2000’s
Memcached(Client((Browsers)( App(Servers( SQL(Database(Server(
Mid$2000’sApp#Servers# Memcached#
(Membase)#
SQL#Database#Clusters#
8"
App"Servers"
API"Servers"
Couchbase"Server"Cluster"
Couchbase*Simplifies
Client'SDKs
Couchbase'Client
App#Server
make'conn
ection
receive'top
ologyCouchbaseTopologyUpdate
Official'SDKs
Community'SDKs
www.couchbase.com/develop
PythonRuby
Go Clojure
REPOWALL.COM
DEMO
User%Documents1.#Primary#User#Document
u::{github_id}%%%%%%%%%%%%%%%%%%%%%%%%%%%=>%%u::1718606
2.#Reference#Document
u::{github_username}%%%%%%%%%%%%%%%%=>%u::scalabl3
3.#Repo#List#Document
r::{github_id}%%%%%%%%%%%%%%%%%%%%%%%%=>%r::1718606
4.%Repo#List#Raw#JSON
r::{github_id}::github%%%%%%%%%%%%%%%%=>%r::1718606::github
User%Document{""doctype"":""user",""last_retrieve"":"1363171793,""is_registered"":"true,""superuser"":"false,""last_retrieve_repos"":"1363171977,""github_id"":"1718606,""github_username"":""scalabl3",""num_followers"":"14,""num_following"":"50,""url"":""https://github.com/scalabl3",""avatar"":"https://secure.gravatar.com/avatar/56665ca94bdd4ad5d41b239e07fa823c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2FgravatarJuserJ420.png",""gravatar_id"":""56665ca94bdd4ad5d41b239e07fa823c",""num_repos"":"57,""num_repos_private"":"J1,""user_type"":""User",""email"":""jasdeep@scalabl3.com",""bio"":"null,""proficiencies"":"null,""github_json"":"{"..."""""}"""}"},""github_access_token"":""xxx",""pubnub_channel"":""dc7580f1b474"}
User%Repo%List{""doctype"":""repos",""github_id"":"1718606,""github_username"":""scalabl3",""language_dist"":"{"unknown":""["Unknown",7],"shell":""["Shell",1],"java":""["Java",2],"actionscript":""["ActionScript",1],"javascript":""["JavaScript",3],"c":""["C",3],"python":""["Python",2],"go":""["Go",5],"c#":""["C#",1],"clojure":""["Clojure",3],"ruby":""["Ruby",28],"objective9c":""["ObjectiveMC",1]},""repos"":"{""""8737681"":"{""""""repo_id"":"8737681,""""""name"":""ironworkerMlibcouchbase",""""""full_name"":""scalabl3/ironworkerMlibcouchbase",""""""updated_at"":"1363120145,""""""created_at"":"1363120145,""""""pushed_at"":"1363119688,""""""is_fork"":"true,""""""language"":"null,""""""forks_count"":"0,""""""watchers_count"":"0,""""""description"":""",""""""is_private"":"false,""""""owner"":""scalabl3",
User%Instance%Vars%&%Save%Method
class%User%<%ModelBase%%%%fattr%:doctype,%:default%=>%self.to_s.downcase%fattr%:last_retrieve,%:default%=>%Time.now.getutc.to_i%fattr%:is_registered,%:default%=>%false%fattr%:superuser,%:default%=>%false
%fattr%:last_retrieve_repos,%:default%=>%nil%fattr%:github_id,%:github_username,%:num_followers,%:num_following,%:url,:avatar,%:gravatar_id,%:num_repos,%:num_repos_private,%:user_type,%:email,%:bio,%:proficiencies,:github_json,%:github_access_token,%:pubnub_channel
#%update%with%new%last_retrieve_reposc.replace(“u::1718606”,3self.to_hash)
Learn&More&Patterns
Couchbase*&*RailsCouchbaseOnRails.com
Couchbase*ModelsCouchbaseModels.com
Questions?
Jasdeep'JaitlaTechnical/Evangelist
@scalabl3jasdeep@couchbase.com
Give'me'a'shout'out'with'@couchbase'@scalabl3!
top related