• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
GR8Conf 2011: Grails Infinispanplugin, Tom Fuller
 

GR8Conf 2011: Grails Infinispanplugin, Tom Fuller

on

  • 881 views

 

Statistics

Views

Total Views
881
Views on SlideShare
881
Embed Views
0

Actions

Likes
0
Downloads
13
Comments
0

0 Embeds 0

No embeds

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

    GR8Conf 2011: Grails Infinispanplugin, Tom Fuller GR8Conf 2011: Grails Infinispanplugin, Tom Fuller Presentation Transcript

    • Introduction to theGrails Infinispan Plugin Tom Fuller Coherent Logic Limited
    • Overview• A story• Design principles• Code examples• Conclusion
    • Why all the stress? Application Server Application Server
    • Traffic spike = trouble Hits per minute100000 90000 80000700006000050000 Hits per minute40000300002000010000 0 01 02 03 04 05 06 07 08 09 10 11 12 13 30 40 43 45 50 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 : 10 :
    • (CC) griffithchris
    • (CC) Mr. Gunn
    • Refactor here, optimise there… Application Server Application Server
    • Again – a traffic spike = trouble Hits per minute14000012000010000080000 Hits per minute600004000020000 0 10:01 10:02 10:03 10:04 10:05 10:06 10:07 10:08 10:09 10:10 10:11 10:12 10:13 10:30 10:40 10:43 10:45 10:50 10:55
    • (CC) amboo who?
    • (CC) Stephi 2006
    • Just buy bigger servers Application Server Application Server
    • 0 50000 100000 150000 200000 25000010:0110:0210:0310:0410:0510:0610:0710:0810:0910:1010:1110:12 Hits per minute10:1310:3010:4010:4310:4510:5010:55 Traffic spike = trouble Hits per minute
    • (CC) fireflythegreat
    • (CC) Ray_from_LA
    • Replicate here, replicate there… Application Server Application Server Application Server
    • No surprise – a traffic spike = trouble Hits per minute400000350000300000250000200000 Hits per minute15000010000050000 0 01 03 05 07 09 11 13 40 45 55 05 10: 10: 10: 10: 10: 10: 10: 10: 10: 10: 11:
    • (CC) Tweek
    • Where we’re at:• Optimisation alone won’t solve this problem.• Neither will larger servers.• Scaling the application server and databases doesn’t work.
    • (CC) Mattastic!
    • A solution that works! Cache Cache Cache Application Server Cache Cache Cache Cache Cache Application Server
    • Infinispan• Based in part on code from JBoss Cache• Licensed under the LGPL• Is a distributed in-memory data grid• Has competition• As of May 2011 Infinispan is officially supported by Red Hat.
    • Traffic spike = not a problem! Hits per minute 600000 500000 400000 300000 Hits per minute 200000 100000 0 01 03 05 07 09 11 13 40 45 55 05 10: 10: 10: 10: 10: 10: 10: 10: 10: 10: 11:
    • Just grow the grid! Cache Cache Cache Cache Cache Cache Cache Application Server Cache Cache Cache Cache Cache Application Server Cache Cache* NOTE: Caveat with session clustering.
    • Design Principles of the Grails Infinispan Plugin(CC) El Bibliomata
    • We aim to help developers:Work with Grails and Groovy naturally.
    • We aim to help developers:Work with Grails and Groovy naturally.Avoid and diagnose problems quickly.
    • We aim to help developers:Work with Grails and Groovy naturally.Avoid and diagnose problems quickly.Save time.
    • Configuring Infinispan in Grailsdevelopment { infinispan = { register { cacheManager { named "matrixCacheManager" configured { externally { using "grails-app/conf/infinispan/infinispan-config.xml" } } caches "agentCache", “citiesCache" } queryHelper { named "agentQueryHelper" referencing "agentCache" properties queryHelperProperties classes infinispantestapp.Agent, infinispantestapp.SuperHero } } } }}
    • Configuring Infinispan in Grailsproduction { infinispan = { register { cacheManager { named "matrixCacheManager" configured { declaratively { using globalConfiguration using configuration } } caches "agentCache", "illinoisCitiesCache" } queryHelper { named "agentQueryHelper" referencing "agentCache" properties queryHelperProperties classes infinispantestapp.Agent, infinispantestapp.SuperHero } } } }}
    • Use the cacheLoadAgentCacheController { def agentCache def index = { for (int ctr in 1..1000) { agentCache.put ( "person id $ctr", new Agent (name:"Agent Smith", weapon:"gun") ) } }}
    • Execute a transactional operationcache.transactionally { cache.put(someKey, someValue); cache.remove(someOtherKey);}
    • Query and iterate over the resultsdef term = new Term (WEAPON, GUN)def termQuery = new TermQuery (term)def results = agentCache.query (queryHelper, Agent, termQuery)results.each { log.info ("it: $it")}
    • Add closures as listenersagentCache.onCacheEntryCreated { log.info ("Cache entry created: $it")}
    • Food for Thought• Infinispan 5.0 is currently under development and will deliver fork/join and map/reduce implementations.• Infinispan can help reduce costs for any data source.• Infinispan can be very useful in the cloud and service-oriented architectures (SOA).
    • A p p lic a tio n A p p lic a tio n S e rv e r S e rv e r C u s to m e r I n fo r m a t io n O rd e r h is t o r y O rd e r h is t o r yA p p lic a tio n A p p lic a tio n A p p lic a tio n Paym ent S e rv e r O rd e r S e rv e r S e rv e r p r o c e s s in g , p r o c e s s in g S h ip p in gA p p lic a tio n S e rv e r P ro d u ct in fo r m a t io n P a rtn e r & p ro d u ct A n a ly t ic s in fo r m a t io n P a rtn e r r e g is t r a t io n A p p lic a tio n A p p lic a tio n A p p lic a tio n A p p lic a tio n S e rv e r S e rv e r S e rv e r S e rv e r
    • Conclusion• Three attempts that failed to deliver a solution that could cope with the load.• Design principles behind the Grails Infinispan Plugin.• Example code.• Further documentation is available at http://www.grails.org/plugin/infinispan
    • Any questions? Contact me Email:thomas.fuller@coherentlogic.com