108
From big GORM-centered into a cloud of fast nodes Jorge Uriarte Aretxaga @jorgeuriarte http://www.slideshare.com/gailen/

From Big GORM-centered into a cloud of fast redis nodes

Embed Size (px)

Citation preview

Page 1: From Big GORM-centered into a cloud of fast redis nodes

From bigGORM-centeredinto a cloud offast nodes

Jorge Uriarte Aretxaga@jorgeuriarte

http://www.slideshare.com/gailen/

Page 2: From Big GORM-centered into a cloud of fast redis nodes

About me

Page 4: From Big GORM-centered into a cloud of fast redis nodes

Origins

Page 5: From Big GORM-centered into a cloud of fast redis nodes

In the beginning...

Page 6: From Big GORM-centered into a cloud of fast redis nodes

In the beginning...

Page 7: From Big GORM-centered into a cloud of fast redis nodes

Well-known territory

Page 8: From Big GORM-centered into a cloud of fast redis nodes

Well-known territory

JVM based!

Page 9: From Big GORM-centered into a cloud of fast redis nodes

Well-known territory

Old good SQL& RDBMs

JVM based!

Page 10: From Big GORM-centered into a cloud of fast redis nodes

Well-known territory

Old good SQL& RDBMs

JVM based!

GORM magic!

Page 11: From Big GORM-centered into a cloud of fast redis nodes
Page 12: From Big GORM-centered into a cloud of fast redis nodes

Productive development environment

Page 13: From Big GORM-centered into a cloud of fast redis nodes

Productive development environment

Affordable learning curve

Page 14: From Big GORM-centered into a cloud of fast redis nodes

Productive development environment

Affordable learning curve

Good-enough performance

Page 15: From Big GORM-centered into a cloud of fast redis nodes

Evolution

Page 16: From Big GORM-centered into a cloud of fast redis nodes
Page 17: From Big GORM-centered into a cloud of fast redis nodes
Page 18: From Big GORM-centered into a cloud of fast redis nodes
Page 19: From Big GORM-centered into a cloud of fast redis nodes

“Mmmhhh... I wouldn’t build it that way

nowadays...”Enrique Amodeo

Page 20: From Big GORM-centered into a cloud of fast redis nodes

“Mmmhhh... I wouldn’t build it that way

nowadays...”Enrique Amodeo

Page 21: From Big GORM-centered into a cloud of fast redis nodes

“Mmmhhh...nowadays...

neither would I!”Me

“Mmmhhh... I wouldn’t build it that way

nowadays...”Enrique Amodeo

Page 22: From Big GORM-centered into a cloud of fast redis nodes
Page 23: From Big GORM-centered into a cloud of fast redis nodes
Page 24: From Big GORM-centered into a cloud of fast redis nodes
Page 25: From Big GORM-centered into a cloud of fast redis nodes

New brands& countries

Page 26: From Big GORM-centered into a cloud of fast redis nodes

Reality Check

Page 27: From Big GORM-centered into a cloud of fast redis nodes

Reality bites

Page 28: From Big GORM-centered into a cloud of fast redis nodes

Reality bites

Page 29: From Big GORM-centered into a cloud of fast redis nodes
Page 30: From Big GORM-centered into a cloud of fast redis nodes
Page 31: From Big GORM-centered into a cloud of fast redis nodes
Page 32: From Big GORM-centered into a cloud of fast redis nodes
Page 33: From Big GORM-centered into a cloud of fast redis nodes
Page 34: From Big GORM-centered into a cloud of fast redis nodes

-server -Xmx1024m -XX:MaxPermSize=128m -XX

:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:

+UseTLAB -XX:+CMSIncrementalMode

-XX:+CMSIncrementalPacing -XX:CMSIncrement

alDutyCycleMin=0 -XX:CMSIncrementalDutyCyc

le=10 -XX:MaxTenuringThreshold=0

-XX:SurvivorRatio=256 -XX:CMSInitiatingOcc

upancyFraction=60 -XX:+DisableExplicitGC

Page 35: From Big GORM-centered into a cloud of fast redis nodes

-server -Xmx1024m -XX:MaxPermSize=128m -XX

:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:

+UseTLAB -XX:+CMSIncrementalMode

-XX:+CMSIncrementalPacing -XX:CMSIncrement

alDutyCycleMin=0 -XX:CMSIncrementalDutyCyc

le=10 -XX:MaxTenuringThreshold=0

-XX:SurvivorRatio=256 -XX:CMSInitiatingOcc

upancyFraction=60 -XX:+DisableExplicitGC -server

-Xms3g -Xmx4g

-XX:MaxPermSi

ze=128m -XX:+U

seParNewGC

-XX:+UseConcMa

rkSweepGC -XX:

+UseTLAB -XX:+

CMSIncremental

Mode

-XX:+CMSIncrem

entalPacing -X

X:CMSIncrement

alDutyCycleMin

=0

-XX:CMSIncreme

ntalDutyCycle=

10 -XX:MaxTenu

ringThreshold=

0

-XX:SurvivorRa

tio=256 -XX:CM

SInitiatingOcc

upancyFraction

=60

-XX:+DisableEx

plicitGC

Page 36: From Big GORM-centered into a cloud of fast redis nodes

Productivity slows down...

Page 37: From Big GORM-centered into a cloud of fast redis nodes

Fragility...

Page 38: From Big GORM-centered into a cloud of fast redis nodes

Evolution stopped...

Page 39: From Big GORM-centered into a cloud of fast redis nodes
Page 40: From Big GORM-centered into a cloud of fast redis nodes

Slow development

Page 41: From Big GORM-centered into a cloud of fast redis nodes

Slow development

Fragile system... prone to errors

Page 42: From Big GORM-centered into a cloud of fast redis nodes

Slow development

Fragile system... prone to errors

Tuning hell with JVM heap

Page 43: From Big GORM-centered into a cloud of fast redis nodes

Slow development

Fragile system... prone to errors

Tuning hell with JVM heap

Terracota cluster issues

Page 44: From Big GORM-centered into a cloud of fast redis nodes

Slow development

Fragile system... prone to errors

Tuning hell with JVM heap

Terracota cluster issues

Overall excessive complexity

Page 45: From Big GORM-centered into a cloud of fast redis nodes

Change?Surgery?Refactor?

keep tuning?

Page 46: From Big GORM-centered into a cloud of fast redis nodes

Meanwhile... in another mental thread...

Page 47: From Big GORM-centered into a cloud of fast redis nodes
Page 48: From Big GORM-centered into a cloud of fast redis nodes
Page 49: From Big GORM-centered into a cloud of fast redis nodes

A solution looking for a problem?

Page 50: From Big GORM-centered into a cloud of fast redis nodes

But get back to the previous point...

Page 51: From Big GORM-centered into a cloud of fast redis nodes

Will you dare jump off it?

But get back to the previous point...

Page 52: From Big GORM-centered into a cloud of fast redis nodes
Page 53: From Big GORM-centered into a cloud of fast redis nodes
Page 54: From Big GORM-centered into a cloud of fast redis nodes

• New side-project• Potentially deadly traffic• Still to be tighly connected with our core system

Page 55: From Big GORM-centered into a cloud of fast redis nodes

• New side-project• Potentially deadly traffic• Still to be tighly connected with our core system•Solutions?

•Dedicated system?•More machines & tuning?•Catch that train!

Page 56: From Big GORM-centered into a cloud of fast redis nodes
Page 57: From Big GORM-centered into a cloud of fast redis nodes
Page 58: From Big GORM-centered into a cloud of fast redis nodes
Page 59: From Big GORM-centered into a cloud of fast redis nodes
Page 60: From Big GORM-centered into a cloud of fast redis nodes
Page 61: From Big GORM-centered into a cloud of fast redis nodes
Page 62: From Big GORM-centered into a cloud of fast redis nodes

Proof of concept and... JUMP!

Page 63: From Big GORM-centered into a cloud of fast redis nodes
Page 64: From Big GORM-centered into a cloud of fast redis nodes
Page 65: From Big GORM-centered into a cloud of fast redis nodes
Page 66: From Big GORM-centered into a cloud of fast redis nodes

Some details?

Page 67: From Big GORM-centered into a cloud of fast redis nodes

Prototype- show me the code -

RedisFast Controllers

Ajax (fewer requests)

Fast importer from existing XMLs

Quick & dirty (1w)

Groovy!!!(XML parsing, JSON

rendering, grails controllers, ...)

Elasticsearch

Page 68: From Big GORM-centered into a cloud of fast redis nodes
Page 69: From Big GORM-centered into a cloud of fast redis nodes

• Simply groovy.util.XmlSlurper

Page 70: From Big GORM-centered into a cloud of fast redis nodes

• Simply groovy.util.XmlSlurper• Two importers, really

Page 71: From Big GORM-centered into a cloud of fast redis nodes

• Simply groovy.util.XmlSlurper• Two importers, really• Bulk

Page 72: From Big GORM-centered into a cloud of fast redis nodes

• Simply groovy.util.XmlSlurper• Two importers, really• Bulk• Incremental (continuous)

Page 73: From Big GORM-centered into a cloud of fast redis nodes

• Simply groovy.util.XmlSlurper• Two importers, really• Bulk• Incremental (continuous)

• Born as a temporary hack...

Page 74: From Big GORM-centered into a cloud of fast redis nodes

• Simply groovy.util.XmlSlurper• Two importers, really• Bulk• Incremental (continuous)

• Born as a temporary hack...soon to give way to a better system

Page 75: From Big GORM-centered into a cloud of fast redis nodes
Page 76: From Big GORM-centered into a cloud of fast redis nodes

• Redis master/slaves replication

Page 77: From Big GORM-centered into a cloud of fast redis nodes

• Redis master/slaves replication• Fast

Page 78: From Big GORM-centered into a cloud of fast redis nodes

• Redis master/slaves replication• Fast• Trivial

Page 79: From Big GORM-centered into a cloud of fast redis nodes

• Redis master/slaves replication• Fast• Trivial• Fast

Page 80: From Big GORM-centered into a cloud of fast redis nodes

• Redis master/slaves replication• Fast• Trivial• Fast• Trivial

Page 81: From Big GORM-centered into a cloud of fast redis nodes

• Redis master/slaves replication• Fast• Trivial• Fast• Trivial• Did I mention fast and trivial?

Page 82: From Big GORM-centered into a cloud of fast redis nodes

Deadly simple Grails app

Page 83: From Big GORM-centered into a cloud of fast redis nodes

Deadly simple Grails app

Page 84: From Big GORM-centered into a cloud of fast redis nodes

Deadly simple Grails app

Page 85: From Big GORM-centered into a cloud of fast redis nodes

Deadly simple Grails app

“Look mum, no GORM!”

Page 86: From Big GORM-centered into a cloud of fast redis nodes

From ‘searchable’ to ElasticSearch

Page 87: From Big GORM-centered into a cloud of fast redis nodes

• Fat-trimmed new fronts• Fast, *light* application• Information still safe in the core system

• Much more capacity with less resources• Simple integration

Page 88: From Big GORM-centered into a cloud of fast redis nodes

Wait... where did the red arrows go?

New system

Old system

Page 89: From Big GORM-centered into a cloud of fast redis nodes

Subdomain based write-through

Page 90: From Big GORM-centered into a cloud of fast redis nodes

Subdomain based write-through

• Login, session, tracking...

Page 91: From Big GORM-centered into a cloud of fast redis nodes

Subdomain based write-through

• Login, session, tracking...• Purchases, payments, subscriptions

Page 92: From Big GORM-centered into a cloud of fast redis nodes

Subdomain based write-through

• Login, session, tracking...• Purchases, payments, subscriptions• Everything goes to our *good old core system*

Page 93: From Big GORM-centered into a cloud of fast redis nodes

Subdomain based write-through

• Login, session, tracking...• Purchases, payments, subscriptions• Everything goes to our *good old core system*• ACID, consistency, GORM, SQL, transactions...

Page 94: From Big GORM-centered into a cloud of fast redis nodes

Subdomain based write-through

• Login, session, tracking...• Purchases, payments, subscriptions• Everything goes to our *good old core system*• ACID, consistency, GORM, SQL, transactions...• ...but now with a small fraction of the load

Page 95: From Big GORM-centered into a cloud of fast redis nodes

Evaluation

Page 96: From Big GORM-centered into a cloud of fast redis nodes

Evaluation

Terracota/Clustering approach vs “new thing”

Page 97: From Big GORM-centered into a cloud of fast redis nodes

Evaluation

Terracota/Clustering approach vs “new thing”

Memory, speed, size, codebase

Page 98: From Big GORM-centered into a cloud of fast redis nodes

Evaluation

Terracota/Clustering approach vs “new thing”

Memory, speed, size, codebase

Decoupled search system

Page 99: From Big GORM-centered into a cloud of fast redis nodes

Evaluation

Terracota/Clustering approach vs “new thing”

Memory, speed, size, codebase New problems,

synchronization

Decoupled search system

Page 100: From Big GORM-centered into a cloud of fast redis nodes

Productivity increasing again...

Page 101: From Big GORM-centered into a cloud of fast redis nodes

New landscape

Page 102: From Big GORM-centered into a cloud of fast redis nodes

New landscapeGet rid of XML importer(event driven pub/subs...?)

Page 103: From Big GORM-centered into a cloud of fast redis nodes

New landscapeGet rid of XML importer(event driven pub/subs...?)

Delete old code (yeah!)

Page 104: From Big GORM-centered into a cloud of fast redis nodes

New landscapeGet rid of XML importer(event driven pub/subs...?)

Keep pushing for speed

Delete old code (yeah!)

Page 105: From Big GORM-centered into a cloud of fast redis nodes

New landscapeGet rid of XML importer(event driven pub/subs...?)

Keep pushing for speed

Delete old code (yeah!)

Keep it simple (this time)

Page 106: From Big GORM-centered into a cloud of fast redis nodes

Just ask me... in two years

Page 107: From Big GORM-centered into a cloud of fast redis nodes

@jorgeuriarte

Page 108: From Big GORM-centered into a cloud of fast redis nodes

External sources

PITAhttp://www.quicksales.com.au/ad/p-i-t-a-pain-in-the-ass-car-number-plate/2606513

Hamsterhttp://www.flickr.com/photos/sualk61/3117477410/

Cliff viewhttp://www.flickr.com/photos/epsos/4376727123/sizes/l/

Knight in the white horsehttp://www.flickr.com/photos/photoplod/7982134342/

Snailhttp://www.flickr.com/photos/raphaelquinet/693813637/

Fast snailhttp://www.flickr.com/photos/zorro13/4086173313

Timanfaya devilhttp://www.flickr.com/photos/yelacis/6941891989/

Light patternshttp://www.flickr.com/photos/aerosolhalos/6676192013/

Kick in the top of the cliffhttp://www.flickr.com/photos/4elevenpix/5056089861/

Homer evolutionhttp://www.flickr.com/photos/photonquantique/1858685882/

Lego machinehttp://www.flickr.com/photos/djimison/3058818283/

Landscapehttp://www.flickr.com/photos/blmiers2/6112610781/

Examhttp://www.flickr.com/photos/albertogp123/5843577306/

Future is pasthttp://www.flickr.com/photos/tind/7533681980/

"From big GORM-centered into a cloud of fast nodes" por Jorge Uriarte se encuentra bajo una

Licencia Creative Commons Atribución-CompartirIgual 3.0 Unported.